List of usage examples for com.vaadin.ui PopupView PopupView
public PopupView(PopupView.Content content)
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectMavenBox.java
License:Open Source License
@Override public Component getContent(Project project, ExtensionUtil util) { Layout layout = new CssLayout(); layout.addStyleName(STYLE_MAVEN_INFOBOX); layout.setSizeFull();// w w w.j a v a2 s . c o m boolean rendered = false; String groupId = null; MavenReactorProjectExt reactorExt = project.getExtension(MavenReactorProjectExt.class); if (reactorExt != null) { MavenReactor mavenReactor = reactorExt.getMavenReactor(); if (mavenReactor != null) { MavenCoordinate coordinate = mavenReactor.getCoordinate(); groupId = coordinate.getGroupId(); createLabel(layout, "GroupId: <b>" + groupId + "</b>");//$NON-NLS-1$ //$NON-NLS-2$ createLabel(layout, "ArtifactId: <b>" + coordinate.getArtefactId() + "</b>");//$NON-NLS-1$ //$NON-NLS-2$ TreeSet<MavenModule> modules = mavenReactor.getModules(); StringBuilder sb = new StringBuilder(); if (modules.size() > 0) { int lineLength = 0; for (MavenModule module : modules) { //create popup with xml snippet sb.append("<dependency>\n"); sb.append(" <artifactId>" + module.getArtefactId() + "</artifactId>\n"); sb.append(" <groupId>" + module.getGroupId() + "</groupId>\n"); String latestVersion = module.getLatestVersion(); if (StringUtils.isNotBlank(latestVersion)) { sb.append(" <version>" + latestVersion + "</version>\n"); } else { sb.append(" <!--<version>0.0.0</version>-->\n"); } String packaging = module.getPackaging(); if (StringUtils.isNotBlank(packaging)) { sb.append(" <type>" + packaging + "</type>\n"); } sb.append("</dependency>\n"); lineLength = calculateLineLength(module, lineLength); } final Label label = new Label(sb.toString(), Label.CONTENT_PREFORMATTED); //add a buffer 10, as we didn't calculate the length of surrounding strings. label.setWidth(lineLength + 10, Sizeable.UNITS_EM); PopupView.Content content = new PopupView.Content() { private static final long serialVersionUID = -8362267064485433525L; @Override public String getMinimizedValueAsHTML() { return "Modules"; } @Override public Component getPopupComponent() { return label; } }; PopupView popup = new PopupView(content); popup.setHideOnMouseOut(false); popup.addStyleName(STYLE_MODULE_POPUP); layout.addComponent(popup); } rendered = true; } } MavenProjectExt mavenExt = project.getExtension(MavenProjectExt.class); if (mavenExt != null) { if (groupId == null) { groupId = mavenExt.getGroupID(); if (StringUtils.isNotBlank(groupId)) { createLabel(layout, "GroupId: <b> " + groupId + "</b>");//$NON-NLS-1$ //$NON-NLS-2$ rendered = true; } } DevInfProjectExt devInf = project.getExtension(DevInfProjectExt.class); if (devInf != null) { String reactorPomUrl = getReactorPomUrl(project, devInf, mavenExt); if (reactorPomUrl == null) { String reactorPomPath = mavenExt.getReactorPOM(); String caption = MessageFormat.format("Reactor POM Path: {0} (relative to SCM root location)", StringUtils.isNotBlank(reactorPomPath) ? reactorPomPath : "/"); createLabel(layout, caption); } else { createLink(layout, "Reactor POM", reactorPomUrl); } rendered = true; } if (StringUtils.isNotBlank(mavenExt.getSiteUrl())) { createLink(layout, "Project Site", mavenExt.getSiteUrl()); rendered = true; } } if (!rendered) { createLabel(layout, "Maven extension added but no data maintained."); } return layout; }
From source file:org.opencms.ui.components.CmsToolBar.java
License:Open Source License
/** * Creates the app select drop down.<p> * * @return the drop down component/*w w w. j a va2 s . c o m*/ */ private Component createQuickLaunchDropDown() { PopupView pv = new PopupView(new PopupView.Content() { private static final long serialVersionUID = 1L; public String getMinimizedValueAsHTML() { return getDropDownButtonHtml(FontOpenCms.APPS); } public Component getPopupComponent() { CmsObject cms = A_CmsUI.getCmsObject(); Locale locale = UI.getCurrent().getLocale(); HorizontalLayout layout = new HorizontalLayout(); layout.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); layout.addStyleName(OpenCmsTheme.QUICK_LAUNCH); // layout.setSpacing(true); layout.setMargin(true); for (I_CmsWorkplaceAppConfiguration config : OpenCms.getWorkplaceAppManager() .getQuickLaunchConfigurations(cms)) { layout.addComponent(CmsDefaultAppButtonProvider.createAppButton(cms, config, locale)); } return layout; } }); pv.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_QUICK_LAUNCH_TITLE_0)); pv.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN); pv.setHideOnMouseOut(false); return pv; }
From source file:org.opencms.ui.components.CmsToolBar.java
License:Open Source License
/** * Creates the user info drop down.<p> * * @return the drop down component/*from w w w . java 2 s . co m*/ */ 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; }
From source file:org.opennms.features.vaadin.jmxconfiggenerator.ui.HeaderPanel.java
License:Open Source License
public HeaderPanel() { label = new Label(); label.setContentMode(ContentMode.HTML); helpPopupView = new PopupView(new HelpContent(UiState.ServiceConfigurationView)); helpPopupView.setVisible(false);//from w ww. j av a 2 s.c o m 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); }
From source file:org.ripla.web.demo.widgets.views.FormView.java
License:Open Source License
/** * FormView constructor.//from w w w . j a v a2 s . c om * * @param inController * {@link FormController} this view's controller */ public FormView(final FormController inController) { super(); final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "widgets.title.page.form"); //$NON-NLS-1$ final FormBean lFormItem = new FormBean(); final RegistrationFormCreator lFormCreator = new RegistrationFormCreator(lFormItem); lLayout.addComponent(lFormCreator.createForm()); final PopupContent lPopupContent = new PopupContent(); final PopupView lPopup = new PopupView(lPopupContent); lPopup.setHideOnMouseOut(false); lPopup.setPopupVisible(false); lLayout.addComponent(lPopup); final Button lSave = new Button(lMessages.getMessage("widgets.view.button.label.save")); lSave.setClickShortcut(KeyCode.ENTER); lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { try { lFormCreator.commit(); final String lFeedback = inController.save(lFormItem); lPopupContent.setFeedback(lFeedback); lPopup.setPopupVisible(true); } catch (final CommitException exc) { Notification.show(exc.getCause().getMessage(), Type.ERROR_MESSAGE); } } }); lLayout.addComponent(lSave); }