How can I show the subWindow based on component position??
I have a button Logout and want show the “cambiar contraseña” subwindow below it, like profile in gmail.
I am searching the position X & Y of the button but I don´t find it.
I tried using the width of the navigation window (resizable) to locate this position but do not get it.
@SuppressWarnings("serial")
public class ChangePasswordSubwindow extends Window {
public ChangePasswordSubwindow(int positionX, int positionY) {
this.setCaption("Cambiar contraseña");
this.setModal(true);
this.setDraggable(false);
this.setResizable(false);
this.setPositionX(positionX);
this.setPositionY(positionY);
// Configure the windws layout; by default a VerticalLayout
VerticalLayout layout = (VerticalLayout) this.getContent();
layout.setMargin(true);
layout.setSpacing(true);
layout.setSizeUndefined();
}
}
(...)
ChangePasswordSubwindow changePasswordSubwindow = new ChangePasswordSubwindow(event.getRelativeX(), event.getRelativeY() + 10);
if (changePasswordSubwindow.getParent() != null) {
// window is already showing
getWindow().showNotification(
"La ventana está abierta");
} else {
// Open the subwindow by adding it to the parent
// window
getWindow().addWindow(changePasswordSubwindow);
}
Any help?
Thanks.