Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Change position of dialog via Java API #138

Closed
stefanuebe opened this issue Aug 21, 2018 · 5 comments
Closed

Change position of dialog via Java API #138

stefanuebe opened this issue Aug 21, 2018 · 5 comments

Comments

@stefanuebe
Copy link

Our dialog's position cannot be changed via Java API out of the box. This should be provided, since not all dialogues needed to be centered.

Following methods as a proposal:
setPositionXYZ(int value, Unit unit), where XYZ could be Top, Left, Bottom, Right. Sets the position of the dialog respective to the set values, as if the user uses css to position the dialog (like "top: 20px; left: 10px")

setPositionOutsideOfViewportAllowed(boolean). If set to false, the dialog position will be modified to prevent, that the dialog is set outside of the viewport. This method is an optional convenience method, since it can be calculated by the developer if needed.

// creating a dialog that is placed on 200,500 from the viewport
Dialog d = new Dialog();
d.setPositionLeft(200, Unit.PIXEL);
d.setPositionTop(500, Unit.PIXEL);
d.setPositionOutsideOfViewportAllowed(false); 
d.open();

// move it around
d.setPositionLeft(300, Unit.PIXEL); 
@ywuliu
Copy link

ywuliu commented Aug 19, 2019

Hi, how is it going? It seems that Vaadin company is not very active now!

@pleku
Copy link
Contributor

pleku commented Aug 20, 2019

Hi, how is it going? It seems that Vaadin company is not very active now!

Hi @ywuliu. I can assure you that we have been very busy with the Vaadin 14 release and have not really stopped to rest after shipping that last week. Since this is an open source project (both the vaadin-dialog web component and this Java integration to it), you can either

  1. Contribute the feature yourself if you have time and know-how, we are happy to help. Then you can directly affect how fast it will be available. Also by contributing to open source you can check that ✅ in your CV if you have not already.
  2. Kindly request for this by giving a positive comment and +1 to the issue since we are actively looking at what enhancements people are voting for when prioritize the backlogs. It would also hlep if you explain why this is critical for your use case. After that though you can't really do anything else than wait.
  3. Try to get someone else to implement the feature by backing it in https://www.bountysource.com/, but then you still might have to wait for unknown time.
  4. Make sure it will be available quickly by paying us to develop it, as we do offer that and other services to Vaadin, as we still have to eat while we make open source products.

IMO this feature does have merit and should be added once we have time for other more important features. Though, this has been added to the wrong repository as I think the API should be for the Dialog component, not for the framework. Moving the issue.

@pleku
Copy link
Contributor

pleku commented Aug 20, 2019

Though, this has been added to the wrong repository as I think the API should be for the Dialog component, not for the framework.

If there were more than one component that could benefit from the API, then it might make sense as a mixin interface for the framework, but at the moment I can't think of any other cases for this. Thus it should be just in the component for now.

@pleku pleku transferred this issue from vaadin/flow Aug 20, 2019
@mvysny
Copy link
Member

mvysny commented Oct 10, 2019

I would also appreciate to have a dialog.setPositionRelativeTo(Component) - that would allow me to implement e.g. a ComboBox-ish component easily, by simply positioning the Dialog right below a button acting as a combo box (e.g. when implementing some kind of Popup tree picker).

@web-padawan
Copy link
Member

Closing in favor of #154. Now when we are working on draggable dialog support for the upcoming 14.2 this actually makes more sense. Let's use that issue, I linked this one from there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants