Example usage for com.vaadin.ui PopupView addStyleName

List of usage examples for com.vaadin.ui PopupView addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui PopupView addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:eu.fp7.eagle.portal.ui.dashboard.design.impl.ActivitiesDesignImpl.java

License:Apache License

private GridLayout buildSubjectsLayout() {

    gridLayoutSubjects = new GridLayout(8, 1);
    gridLayoutSubjects.setImmediate(false);
    gridLayoutSubjects.setWidth("100%");
    gridLayoutSubjects.setHeight("-1px");
    gridLayoutSubjects.setSpacing(true);
    gridLayoutSubjects.setCaption("My Subjects");
    gridLayoutSubjects.addStyleName("gridLayoutSubjects");
    MarginInfo margin = new MarginInfo(true, false, true, false);
    gridLayoutSubjects.setMargin(margin);
    gridLayoutSubjects.setSpacing(false);
    gridLayoutSubjects.setColumnExpandRatio(7, 1.0f);

    PopupView popup = new PopupView(null, buildTableActivity("Migration", 3, 2));
    popup.addStyleName("popupviewActivities");
    Button migration = new Button("Migration" + " " + "(5)", click -> popup.setPopupVisible(true));
    migration.addStyleName("buttonSubjectsListAct");
    gridLayoutSubjects.addComponent(migration, 0, 0);
    //popup.setWidth("100px");
    gridLayoutSubjects.addComponent(popup, 1, 0);

    PopupView popup2 = new PopupView(null, buildTableActivity("Housing", 0, 0));
    popup2.addStyleName("popupviewActivities");
    Button housing = new Button("Housing", click -> popup.setPopupVisible(false));
    housing.addStyleName("buttonSubjectsEmptyAct");
    gridLayoutSubjects.addComponent(housing, 2, 0);
    //popup2.setWidth("100px");
    gridLayoutSubjects.addComponent(popup2, 3, 0);

    return gridLayoutSubjects;
}

From source file:eu.fp7.eagle.portal.ui.dashboard.design.impl.ActivitiesDesignImpl.java

License:Apache License

private GridLayout buildResourcesLayout() {

    gridLayoutResources = new GridLayout(8, 1);
    gridLayoutResources.setImmediate(false);
    gridLayoutResources.setWidth("100%");
    gridLayoutResources.setHeight("-1px");
    gridLayoutResources.setSpacing(true);
    gridLayoutResources.setCaption("My Resources");
    gridLayoutResources.addStyleName("gridLayoutResources");
    MarginInfo margin = new MarginInfo(true, false, true, false);
    gridLayoutResources.setMargin(margin);
    gridLayoutResources.setSpacing(false);
    gridLayoutResources.setColumnExpandRatio(7, 1.0f);

    PopupView popup = new PopupView(null, buildTableActivity("OER", 2, 2));
    popup.addStyleName("popupviewActivities");
    Button oer = new Button("OER" + " " + "(4)", click -> popup.setPopupVisible(true));
    oer.addStyleName("buttonResourcesListAct");
    gridLayoutResources.addComponent(oer, 0, 0);
    //popup.setWidth("100px");
    gridLayoutResources.addComponent(popup, 1, 0);

    PopupView popup2 = new PopupView(null, buildTableActivity("Wiki", 1, 2));
    popup2.addStyleName("popupviewActivities");
    Button wiki = new Button("Wiki" + " " + "(3)", click -> popup2.setPopupVisible(true));
    wiki.addStyleName("buttonResourcesListAct");
    gridLayoutResources.addComponent(wiki, 2, 0);
    popup2.setWidth("100px");
    gridLayoutResources.addComponent(popup2, 3, 0);

    PopupView popup3 = new PopupView(null, buildTableActivity("Blogs", 0, 0));
    popup3.addStyleName("popupviewActivities");
    Button blogs = new Button("Blogs", click -> popup3.setPopupVisible(false));
    blogs.addStyleName("buttonResourcesEmptyAct");
    gridLayoutResources.addComponent(blogs, 4, 0);
    //popup3.setWidth("100px");
    gridLayoutResources.addComponent(popup3, 5, 0);

    PopupView popup4 = new PopupView(null, buildTableActivity("Comments", 5, 5));
    popup4.addStyleName("popupviewActivities");
    Button comments = new Button("Comments" + " " + "(10)", click -> popup4.setPopupVisible(true));
    comments.addStyleName("buttonResourcesListAct");
    gridLayoutResources.addComponent(comments, 6, 0);
    //popup4.setWidth("100px");
    gridLayoutResources.addComponent(popup4, 7, 0);

    return gridLayoutResources;
}

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();//from  w w w . j ava2  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>&nbsp;" + 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.escidoc.browser.ui.GroupRolesView.java

License:Open Source License

private VerticalLayout addRoleExcludeInformation() {
    VerticalLayout rlexclude = new VerticalLayout();
    final Label content = new Label("<ul><li>The following Roles have been excluded from this view: <br />"
            + ViewConstants.roleExcludeList.toString() + "</li></ul>", Label.CONTENT_RAW);
    content.setWidth("300px");

    final PopupView popup = new PopupView("?", content);
    popup.setHideOnMouseOut(true);//w  ww  .  j  ava 2s. c  om
    popup.addListener(new PopupVisibilityListener() {
        @Override
        public void popupVisibilityChange(PopupVisibilityEvent event) {
        }
    });

    popup.addStyleName("paddingright10");
    rlexclude.addComponent(popup);
    rlexclude.setComponentAlignment(popup, Alignment.MIDDLE_RIGHT);
    rlexclude.setMargin(true);
    return rlexclude;
}

From source file:org.escidoc.browser.ui.mainpage.HeaderContainer.java

License:Open Source License

private void createSearchForm() {
    final Form form = new Form();
    searchField.setImmediate(true);//from  w  ww .j a v  a 2 s . c o  m
    form.getLayout().addComponent(searchField);
    form.addStyleName("paddingright10");
    hl.addComponent(form);
    hl.setComponentAlignment(form, Alignment.MIDDLE_RIGHT);

    final Button btnSearch = new Button("Go", this, "onClickSearch");

    // btnSearch.setClickShortcut(KeyCode.ENTER);
    btnSearch.addStyleName("primary");
    btnSearch.removeStyleName("v-button");

    btnSearch.addStyleName("paddingright10");
    hl.addComponent(btnSearch);
    hl.setComponentAlignment(btnSearch, Alignment.MIDDLE_RIGHT);

    // Create the content for the popup
    final Label content = new Label(
            "<ul><li>&raquo; The default search operator is AND</li><li>&raquo; To search for a phrase place the text in double quotes</li></ul>",
            Label.CONTENT_RAW);
    // The PopupView popup will be as large as needed by the content
    content.setWidth("300px");

    // Construct the PopupView with simple HTML text representing the
    // minimized view
    final PopupView popup = new PopupView("?", content);
    popup.setHideOnMouseOut(true);
    popup.addListener(this);

    popup.addStyleName("paddingright10");
    hl.addComponent(popup);
    hl.setComponentAlignment(popup, Alignment.MIDDLE_RIGHT);
}

From source file:org.opencms.ui.components.CmsToolBar.java

License:Open Source License

/**
 * Creates a drop down menu.<p>/*from   ww w .j  a  v  a  2  s.co  m*/
 *
 * @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;
}

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//from  ww w  .  j a v a2  s  . co  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//w  w  w .  j  a  v a  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.vaadin.tori.component.DebugControlPanel.java

License:Apache License

public DebugControlPanel(final DebugAuthorizationService authorizationService) {
    Page.getCurrent().getStyles()/*from   w w  w. java2  s  .  co  m*/
            .add(".v-popupview-popup { background: #fff; } .v-popupview-popup .v-widget { font-size: 12px; }");
    addStyleName("debugcontrolpanel");
    this.authorizationService = authorizationService;
    ToriNavigator.getCurrent().addViewChangeListener(new ViewChangeListener() {
        @Override
        public void afterViewChange(final ViewChangeEvent event) {
            currentView = event.getNewView();
        }

        @Override
        public boolean beforeViewChange(final ViewChangeEvent event) {
            return true;
        }
    });

    final PopupView popupButton = new PopupView("Debug Control Panel", new Panel());
    popupButton.setHideOnMouseOut(false);
    popupButton.addStyleName("v-button");
    popupButton.addPopupVisibilityListener(this);
    setCompositionRoot(popupButton);
    setSizeUndefined();
}