List of usage examples for com.vaadin.event LayoutEvents.LayoutClickListener LayoutEvents.LayoutClickListener
LayoutEvents.LayoutClickListener
From source file:com.garyclayburg.vconsole.VConsole.java
License:Open Source License
private void createNotifyButton() { notify = new Button(); notify.setDescription("No errors in policy"); // notify.addStyleName("borderless"); notify.addStyleName("notifications"); notify.addStyleName("unread"); notify.addStyleName("icon-only"); notify.addStyleName("icon-bell"); notify.addClickListener(new Button.ClickListener() { @Override/*from ww w. j ava 2s. c o m*/ public void buttonClick(Button.ClickEvent event) { log.info("clicked on notifications"); if (notifications.getUI() != null) { notifications.close(); log.debug("closed notifications"); } else { buildNotifications(event); getUI().addWindow(notifications); notifications.focus(); ((VerticalLayout) getUI().getContent()) .addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { notifications.close(); ((VerticalLayout) getUI().getContent()).removeLayoutClickListener(this); } }); } } }); }