Hink
Hink

Reputation: 1103

Vaadin: Moving window into corner after opening

I have a new window with undefined size. How to place it into right bottom corner in the page? The getWidth() and getHeight() functions return -1, because I didnt set them by setWidth() and setHeight().
I dont want to set them to keep the size depending on the content.

Upvotes: 0

Views: 1296

Answers (1)

geert3
geert3

Reputation: 7341

You can use Window.setPositionX() to change the horizontal offset from the LEFT border, and setPositionY() for offset from TOP. Unfortunately there is no way to set offset from RIGHT/BOTTOM. So unless you know the width/height of both your window and the main window, this is not possible through Vaadin server calls (as far as I know).

However you can solve it through CSS: define a style name e.g. mywindow using addStyleName("mywindow") and then make a CSS rule like this:

.v-window.v-widget.mywindow { 
    right: 0;
    bottom: 0;
    left: auto !important;
    top: auto !important;
}

Upvotes: 1

Related Questions