Search code examples
vaadinvaadin7

How can I get a component's position on screen (screen coordinates)


I want to show a window at a position relative to a given component.

Is there a way to determine a component's screen coordinates?

So I can then use those to set the window's position:

window.setPosition(x, y);

Solution

  • No. You can not get position of any Component at server side, that information resides client side. Ultimately you can not achieve this directly in vaadin. But you can create an extension of the Component and extend your server side component in it and from the Connector you can provide the position of vaadin client side widget to the extension reside at Server side. You can manage position of component in State.This may sound difficult but you can easily accomplish this. You can follow Book of vaadin as usual for this.