Hi im trying to close a existing windows but i cant. the closeListener is active but the windows is still on screen
thanks you for help.
Button btnNotification = new Button();
btnNotification.setIcon(FontAwesome.BELL);
btnNotification.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
btnNotification.addStyleName(ValoTheme.BUTTON_BORDERLESS);
btnNotification.addClickListener(clickevent->{
if (notificationsWindow == null) {
notificationsWindow = new Window();
notificationsWindow.setWidth(300.0f, Unit.PIXELS);
notificationsWindow.addStyleName("notifications");
notificationsWindow.setClosable(false);
notificationsWindow.setResizable(false);
notificationsWindow.setDraggable(false);
notificationsWindow.addCloseListener(event->{System.out.println("Closed");});
notificationsWindow.setContent(Notification());
}
if(!notificationsWindow.isAttached()) {
notificationsWindow.setPositionY(clickevent.getClientY()
- clickevent.getRelativeY() + 40);
notificationsWindow.setPositionX(100);
getUI().addWindow(notificationsWindow);
notificationsWindow.focus();
}else {
notificationsWindow.close();
}
});