List of usage examples for com.vaadin.ui PopupView getContent
public PopupView.Content getContent()
From source file:com.mycollab.module.crm.ui.components.CrmFollowersComp.java
License:Open Source License
public void displayFollowers(final V bean) { this.bean = bean; try {//from w w w . j ava 2 s . c o m typeId = (Integer) PropertyUtils.getProperty(bean, "id"); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { LOG.error("Error", e); return; } this.removeAllComponents(); MHorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label followerHeader = new Label( FontAwesome.EYE.getHtml() + " " + UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS), ContentMode.HTML); header.addComponent(followerHeader); if (hasEditPermission()) { final PopupView addPopupView = new PopupView(UserUIContext.getMessage(GenericI18Enum.ACTION_MODIFY), new MVerticalLayout()); addPopupView.addPopupVisibilityListener(popupVisibilityEvent -> { PopupView.Content content = addPopupView.getContent(); if (popupVisibilityEvent.isPopupVisible()) { MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent(); popupComponent.removeAllComponents(); popupComponent.with(new ELabel(UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS)) .withStyleName(ValoTheme.LABEL_H3), new ModifyWatcherPopup()); } else { MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent(); ModifyWatcherPopup popup = (ModifyWatcherPopup) popupComponent.getComponent(1); List<MonitorItem> unsavedItems = popup.getUnsavedItems(); monitorItemService.saveMonitorItems(unsavedItems); loadWatchers(); } }); header.addComponent(addPopupView); } header.addComponent(ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE).withStyleName(WebThemes.INLINE_HELP) .withDescription(UserUIContext.getMessage(FollowerI18nEnum.FOLLOWER_EXPLAIN_HELP))); this.addComponent(header); watcherLayout = new MCssLayout().withFullWidth().withStyleName(WebThemes.FLEX_DISPLAY); this.addComponent(watcherLayout); loadWatchers(); }
From source file:com.mycollab.module.project.ui.components.ProjectFollowersComp.java
License:Open Source License
public void displayFollowers(final V bean) { this.bean = bean; try {//w w w. j a v a 2 s.c o m typeId = (Integer) PropertyUtils.getProperty(bean, "id"); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { LOG.error("Error", e); return; } this.removeAllComponents(); MHorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label followerHeader = new Label( FontAwesome.EYE.getHtml() + " " + UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS), ContentMode.HTML); header.addComponent(followerHeader); if (hasEditPermission()) { final PopupView addPopupView = new PopupView(UserUIContext.getMessage(GenericI18Enum.ACTION_MODIFY), new MVerticalLayout()); addPopupView.addPopupVisibilityListener(popupVisibilityEvent -> { PopupView.Content content = addPopupView.getContent(); if (popupVisibilityEvent.isPopupVisible()) { MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent(); popupComponent.removeAllComponents(); popupComponent.with(new ELabel(UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS)) .withStyleName(ValoTheme.LABEL_H3), new ModifyWatcherPopup()); } else { MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent(); ModifyWatcherPopup popup = (ModifyWatcherPopup) popupComponent.getComponent(1); List<MonitorItem> unsavedItems = popup.getUnsavedItems(); monitorItemService.saveMonitorItems(unsavedItems); loadWatchers(); } }); header.addComponent(addPopupView); } header.addComponent(ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE).withStyleName(WebThemes.INLINE_HELP) .withDescription(UserUIContext.getMessage(FollowerI18nEnum.FOLLOWER_EXPLAIN_HELP))); this.addComponent(header); watcherLayout = new MCssLayout().withFullWidth().withStyleName(WebThemes.FLEX_DISPLAY); this.addComponent(watcherLayout); loadWatchers(); }