Example usage for com.vaadin.ui Layout setSizeFull

List of usage examples for com.vaadin.ui Layout setSizeFull

Introduction

In this page you can find the example usage for com.vaadin.ui Layout setSizeFull.

Prototype

public void setSizeFull();

Source Link

Document

Sets the size to 100% x 100%.

Usage

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectLinkGroupsBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.addStyleName(SYTLE_LINKGROUPS_INFOBOX);
    layout.setSizeFull();
    LinkGroupsProjectExt ext = project.getExtension(LinkGroupsProjectExt.class);
    if (ext != null && !ext.getLinkGroups().isEmpty()) {
        for (LinkGroup linkGroup : ext.getLinkGroups()) {
            Label linkGroupHeaderLabel = new Label(linkGroup.getCaption());
            linkGroupHeaderLabel.addStyleName(STYLE_LABEL_GROUP);
            layout.addComponent(linkGroupHeaderLabel);

            for (Link link : linkGroup.getItems()) {
                com.vaadin.ui.Link uiLink = new com.vaadin.ui.Link(link.getLabel(),
                        new ExternalResource(link.getUrl()));
                uiLink.setDescription(link.getUrl());
                uiLink.addStyleName(STYLE_LABEL_LINK);
                uiLink.setTargetName("_blank"); //$NON-NLS-1$
                layout.addComponent(uiLink);
            }/*from   w  w w.j a va  2s.  c  o  m*/
        }
    }
    return layout;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectMailingListBox.java

License:Open Source License

@SuppressWarnings("nls")
@Override//ww  w  . j  a va  2s  .  com
public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.addStyleName(STYLE_MAILING_INFOBOX);
    layout.setSizeFull();

    HtmlBuilder html = new HtmlBuilder();
    InfoExtension ext = project.getExtension(InfoExtension.class);
    if (ext != null) {
        Set<String> mailingLists = ext.getMailingLists();
        if (mailingLists.size() > 0) {
            MailingListMapper mapper = new MailingListMapper(LinkMapper.ALL_PURPOSES);
            html.append("<ul>"); //$NON-NLS-1$
            for (String mailingList : ext.getMailingLists()) {
                html.append("<li>");
                html.appendMailToLink(mailingList);
                List<Link> mappedLinks = mapper.getMappedLinks(mailingList, util.getLoggedInUserId(), project,
                        configService);
                if (!mappedLinks.isEmpty()) {
                    html.appendLineBreak();
                    html.appendLinks(mappedLinks);
                }
                html.append("</li>");
            }
            html.append("</ul>");
        }
    }

    if (html.length() > 0) {
        createLabel(layout, html.toString());
    } else {
        createLabel(layout, "This project has no mailing lists."); //$NON-NLS-1$
    }
    return layout;
}

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();

    boolean rendered = false;
    String groupId = null;/*from   w  ww.  java  2  s  .  c  om*/
    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.eclipse.skalli.view.ext.impl.internal.infobox.ProjectScrumBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.addStyleName(STYLE_SCRUM_INFOBOX);
    layout.setSizeFull();

    boolean rendered = false;
    ScrumProjectExt scrumExt = project.getExtension(ScrumProjectExt.class);
    if (scrumExt != null) {
        if (CollectionUtils.isNotBlank(scrumExt.getProductOwners())) {
            createLabel(layout, "Product Owner", STYLE_TEAMLABEL);
            Component peopleComponent = PeopleComponent
                    .getPeopleListComponentForMember(scrumExt.getProductOwners());
            layout.addComponent(peopleComponent);
            rendered = true;/*from w  ww. jav a2s . com*/
        }

        if (CollectionUtils.isNotBlank(scrumExt.getScrumMasters())) {
            createLabel(layout, "Scrum Master", STYLE_TEAMLABEL);
            Component peopleComponent = PeopleComponent
                    .getPeopleListComponentForMember(scrumExt.getScrumMasters());
            layout.addComponent(peopleComponent);
            rendered = true;
        }

        if (StringUtils.isNotBlank(scrumExt.getBacklogUrl())) {
            createLink(layout, "Scrum Backlog", scrumExt.getBacklogUrl(), DEFAULT_TARGET, STYLE_SCRUM_LOG);
            rendered = true;
        }
    }
    if (!rendered) {
        createLabel(layout, "SCRUM extension added but no data maintained.", STYLE_LABEL);
    }
    return layout;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectTeamBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.addStyleName(STYLE_TEAM_INFOBOX);
    layout.setSizeFull();
    PeopleExtension ext = project.getExtension(PeopleExtension.class);
    if (ext != null) {
        if (ext.getLeads().size() > 0) {
            Label projectLeadHeaderLabel = new Label("Project Lead");
            projectLeadHeaderLabel.addStyleName(STYLE_TEAMLABEL);
            layout.addComponent(projectLeadHeaderLabel);
            Component peopleComponent = PeopleComponent.getPeopleListComponentForMember(ext.getLeads());
            peopleComponent.addStyleName(InformationBox.STYLE);
            layout.addComponent(peopleComponent);
        }/*from  w ww  . ja v  a 2s .  com*/

        if (ext.getMembers().size() > 0) {
            Label projectTeamHeaderLabel = new Label("Project Team/Committers");
            projectTeamHeaderLabel.addStyleName(STYLE_TEAMLABEL);
            layout.addComponent(projectTeamHeaderLabel);

            Component peopleComponent = PeopleComponent.getPeopleListComponentForMember(ext.getMembers());
            peopleComponent.addStyleName(InformationBox.STYLE);
            layout.addComponent(peopleComponent);
        }

        String mailToTeamHtml = new MailToTeam(ext).composeMailToTeamLabel();
        createLabel(layout, mailToTeamHtml);
    }
    return layout;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.RelatedProjectsInfoBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.addStyleName(STYLE_RELATEDPROJECTS_INFOBOX);
    layout.setSizeFull();

    RelatedProjectsExt ext = project.getExtension(RelatedProjectsExt.class);
    if (ext != null) {
        createLabel(layout, "The following projects might also be of interest to you:");
        boolean calculated = ext.getCalculated();
        if (calculated) {
            addCalculatedContent(project, layout);
        } else {/*w w  w. ja  va2s .c o  m*/
            UUIDList ids = ext.getRelatedProjects();
            ProjectService projectService = ((ProjectService) EntityServices.getByEntityClass(Project.class));
            for (UUID uuid : ids) {
                Project relatedProject = projectService.getByUUID(uuid);
                if (relatedProject != null) {
                    //project might have deleted meanwhile
                    ExternalResource externalResource = new ExternalResource(
                            "/projects/" + relatedProject.getProjectId());
                    String content = HSPACE + "<a href=\"" + externalResource.getURL() + "\">"
                            + relatedProject.getName() + "</a>";
                    createLabel(layout, content);
                }
            }
        }
    }
    return layout;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.SubprojectsInfoBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.addStyleName(STYLE_SUBPROJECTS_INFOBOX);
    layout.setSizeFull();

    UUID uuid = project.getUuid();

    List<Project> parents = projectService.getParentChain(uuid);
    SortedSet<Project> subprojects = project.getSubProjects(new SubprojectComparator(templateService));
    int indent = 0;
    StringBuilder sb = new StringBuilder();

    // render the parents of the project as links in reverse order and
    // with increasing indentation; finally render the project
    // itself (just as emphasized text, no link)
    for (int i = parents.size() - 1; i >= 0; --i) {
        renderProject(sb, parents.get(i), templateService, indent, i > 0);
        indent += DELTA_INDENT;//from  w ww. j  a  va2 s .  com
    }

    // render the subprojects as links in alphabetical order
    // and with same indentation
    for (Project subproject : subprojects) {
        renderProject(sb, subproject, templateService, indent, true);
    }

    Label content = new Label(sb.toString(), Label.CONTENT_XHTML);
    content.setSizeUndefined();
    layout.addComponent(content);
    return layout;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java

License:Open Source License

@SuppressWarnings({ "deprecation", "serial" })
private void paintTagView() {
    layout.removeAllComponents();/*ww w .  jav  a 2 s  .  c  o  m*/

    Set<String> tags = TaggingUtils.getTags(project);
    if (tags != null && tags.size() > 0) {
        Layout tagListLayout = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                if (c instanceof Label) {
                    return "float: left; line-height:18px; padding-right: 3px;";
                } else {
                    return "float: left; padding-right: 5px";
                }
            }
        };
        tagListLayout.setSizeFull();
        Label tagLabel = new Label("Tags:");
        tagLabel.setSizeUndefined();
        tagListLayout.addComponent(tagLabel);

        for (String tag : tags) {
            Button tagButton = new Button(tag, new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    String tag = event.getButton().getCaption();
                    util.getNavigator().navigateTagView(tag);
                }
            });
            tagButton.setStyleName(Button.STYLE_LINK);
            tagListLayout.addComponent(tagButton);
        }

        Button editButton = new Button("(edit tags)");
        if (util.getLoggedInUser() != null) {
            editButton.addListener(new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    paintTagEdit();
                }
            });
        } else {
            editButton.setEnabled(false);
            editButton.setDescription("Login to tag this project");
        }
        editButton.setStyleName(Button.STYLE_LINK);
        tagListLayout.addComponent(editButton);

        layout.addComponent(tagListLayout);
    } else {
        if (util.getLoggedInUser() != null) {
            Button addTagButton = new Button("(add tags)", new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    paintTagEdit();
                }
            });
            addTagButton.setStyleName(Button.STYLE_LINK);
            layout.addComponent(addTagButton);
        }
    }

}

From source file:org.eclipse.skalli.view.internal.window.ProjectDetailsPanel.java

License:Open Source License

private Component getInternalErrorContent() {
    Layout errorContent = new CssLayout();
    errorContent.setSizeFull();
    Label label = new Label("Internal Error: The extension content cannot be displayed. "
            + "An internal error occurred. Please notify the administrator.", Label.CONTENT_XHTML);
    label.addStyleName("infobox-internalerror");
    errorContent.addComponent(label);/* ww w  . ja  v  a2 s . c  o m*/
    return errorContent;
}

From source file:org.example.skalli.ext.helloworld.ui.ExtensionServiceProjectHelloWorldBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    HelloWorldProjectExt ext = project.getExtension(HelloWorldProjectExt.class);

    Layout layout = new CssLayout();
    layout.setSizeFull();

    layout.addComponent(new Label(ext.getName() + " greets the following friends: "));

    for (String friend : ext.getFriends()) {
        layout.addComponent(new Label("Hello " + friend + "!"));
    }/*from w  w  w . j  a va 2s  .c om*/

    return layout;
}