/** * This is an internal constructor. Use * {@link PopupView#PopupView(String, Component)} instead. * * @since 7.5.0 */ @Deprecated public PopupView() { registerRpc(rpc); setHideOnMouseOut(true); setContent(createContent("", new Label(""))); }
@Override public void setVisible(boolean visible) { if (!visible) { setPopupVisible(false); } super.setVisible(visible); } }
/** * Set the visibility of the popup. Does not hide the minimal * representation. * * @param visible */ public void setPopupVisible(boolean visible) { if (isPopupVisible() != visible) { if (visible) { visibleComponent = content.getPopupComponent(); if (visibleComponent == null) { throw new IllegalStateException( "PopupView.Content did not return Component to set visible"); } if (visibleComponent.getParent() != null) { // If the component already has a parent, try to remove it AbstractSingleComponentContainer .removeFromParent(visibleComponent); } visibleComponent.setParent(this); } else { if (equals(visibleComponent.getParent())) { visibleComponent.setParent(null); } visibleComponent = null; } fireEvent(new PopupVisibilityEvent(this)); markAsDirty(); } }
@Override public void readDesign(Element design, DesignContext designContext) { // Read content first to avoid NPE when setting popup visible Component popupContent = null; String minimizedValue = ""; for (Node childNode : design.childNodes()) { if (childNode instanceof Element) { Element child = (Element) childNode; if (child.tagName().equals("popup-content")) { popupContent = designContext.readDesign(child.child(0)); } else { minimizedValue += child.toString(); } } else { minimizedValue += childNode.toString(); } } setContent(createContent(minimizedValue.trim(), popupContent)); super.readDesign(design, designContext); }
/** * Creates a drop down menu.<p> * * @param buttonHtml the button HTML * @param content the drop down content * @param title the button title * * @return the component */ public static Component createDropDown(String buttonHtml, Component content, String title) { PopupView pv = new PopupView(buttonHtml, content); pv.setDescription(title); pv.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN); pv.setHideOnMouseOut(false); return pv; }
public HeaderPanel() { label = new Label(); label.setContentMode(ContentMode.HTML); helpPopupView = new PopupView(new HelpContent(UiState.ServiceConfigurationView)); helpPopupView.setVisible(false); helpPopupView.setPopupVisible(false); Button popupButton = UIHelper.createButton("", "help", Config.Icons.HELP, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { helpPopupView.setPopupVisible(true); helpPopupView.setVisible(true); } }); HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(popupButton); layout.addComponent(helpPopupView); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.MIDDLE_LEFT); setContent(layout); }
notesField.setStyleName("coursedetailtext"); final PopupView notesPopupView = new PopupView("Details", notesField); notesPopupView.setCaption("Details"); notesPopupView.setHideOnMouseOut(false); notesPopupView.setData(event.getAlert() + this);
/** * Constructor.<p> */ public CmsToolBar() { m_quickLaunchDropDown = createQuickLaunchDropDown(); m_userDropDown = createUserInfoDropDown(); m_leftButtons = new VerticalLayout(); m_rightButtons = new VerticalLayout(); VerticalLayout layout = new VerticalLayout(); layout.addComponent(m_leftButtons); layout.addComponent(m_rightButtons); m_foldedButtonsMenu = new PopupView(getDropDownButtonHtml(FontOpenCms.CONTEXT_MENU_DOTS), layout); m_foldedButtonsMenu.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN); m_foldedButtonsMenu.setHideOnMouseOut(false); Design.read("CmsToolBar.html", this); }
public OrganisaatioSearchWidget(OrganisaatioProxy organisaatioProxy, OrganisaatioSearchTree organisaatioSearchTree) { super(); this.organisaatioSearchTree = organisaatioSearchTree; this.organisaatioProxy = organisaatioProxy; organisaatioSearchTree.getTree().addListener(this); organisaatioSearchTree.getTree().setImmediate(true); rootLayout = new HorizontalLayout(); searchResult = UiUtil.label(null, ""); rootLayout.addComponent(searchResult); searchButton = UiUtil.button(null, I18N.getMessage(SEARCH_BUTTON_CAPTION_KEY)); rootLayout.addComponent(searchButton); orgTreePopup = new OrganisaatioSearchPopup(organisaatioSearchTree); searchTreePopup = new PopupView(orgTreePopup); searchTreePopup.setHideOnMouseOut(false); rootLayout.addComponent(searchTreePopup); setCompositionRoot(rootLayout); searchButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { searchTreePopup.setPopupVisible(true); } }); this.setDebugIds("orgSearchWidget_searchBtn", "orgSearchWidget_searchResultLbl"); }
this.filtersPopup.setImmediate(true); this.filtersPopup.setContent(new Content() this.filtersPopup.markAsDirty();
@Override public void buttonClick(Button.ClickEvent event) { helpPopupView.setPopupVisible(true); helpPopupView.setVisible(true); } });
@Override public void setHideOnMouseOut(boolean value) { component.setHideOnMouseOut(value); component.markAsDirty(); }
@Override public void setPopupVisible(boolean value) { component.setPopupVisible(value); component.markAsDirty(); }
/** * Creates a PopupView through the PopupView.Content interface. This allows * the creator to dynamically change the contents of the PopupView. * * @param content * the PopupView.Content that contains the information for this */ public PopupView(PopupView.Content content) { this(); setContent(content); }
public WebPopupView() { component = new com.vaadin.ui.PopupView(new EmptyContent()); }
/** * This method will replace the current content of the panel with a new one. * * @param newContent * PopupView.Content object containing new information for the * PopupView * @throws IllegalArgumentException * if the method is passed a null value, or if one of the * content methods returns null */ public void setContent(PopupView.Content newContent) throws IllegalArgumentException { if (newContent == null) { throw new IllegalArgumentException("Content must not be null"); } content = newContent; markAsDirty(); }
/** * Returns the current visibility of the popup. * * @return true if the popup is visible */ public boolean isPopupVisible() { return getPopupView().isPopupVisible(); } }
@Override public Subscription addPopupVisibilityListener(Consumer<PopupVisibilityEvent> listener) { getEventHub().subscribe(PopupVisibilityEvent.class, listener); if (popupVisibilityListenerRegistration == null) { popupVisibilityListenerRegistration = component.addPopupVisibilityListener(e -> publish(PopupVisibilityEvent.class, new PopupVisibilityEvent(this)) ); } return () -> removePopupVisibilityListener(listener); }
@Override public void setImmediate(boolean immediate) { super.setImmediate(immediate); searchResult.setImmediate(true); searchTreePopup.setImmediate(immediate); }
/** * Creates the user info drop down.<p> * * @return the drop down component */ private Component createUserInfoDropDown() { PopupView pv = new PopupView(new PopupView.Content() { private static final long serialVersionUID = 1L; public String getMinimizedValueAsHTML() { CmsObject cms = A_CmsUI.getCmsObject(); return getDropDownButtonHtml( new ExternalResource( OpenCms.getWorkplaceAppManager().getUserIconHelper().getSmallIconPath( cms, cms.getRequestContext().getCurrentUser()))); } public Component getPopupComponent() { return new CmsUserInfo(new I_UploadListener() { public void onUploadFinished(List<String> uploadedFiles) { handleUpload(uploadedFiles); } }, getDialogContext()); } }); pv.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_USER_INFO_TITLE_0)); pv.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN); pv.setHideOnMouseOut(false); pv.addStyleName(OpenCmsTheme.USER_INFO); return pv; }