Example usage for com.vaadin.ui Layout addStyleName

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

Introduction

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

Prototype

public void addStyleName(String style);

Source Link

Document

Adds one or more style names to this component.

Usage

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();/* w  ww.  j  a v  a 2s. c o m*/
    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);
        }

        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();//from w w  w  .j  a  va  2 s .c om

    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 {
            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();/*from  ww w .j  a va  2  s  . co m*/

    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;
    }

    // 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.jpos.qi.QIEntityView.java

License:Open Source License

protected void cancelClick(Button.ClickEvent event, Layout formLayout) {
    binder.readBean(bean); //this discards the changes
    binder.setReadOnly(true);//from   w  w w.  ja v  a2s  .  com
    event.getButton().setVisible(false);
    saveBtn.setVisible(false);
    editBtn.setVisible(true);
    removeBtn.setVisible(true);
    errorLabel.setVisible(false);
    errorLabel.setValue(null);
    formLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
}

From source file:org.jpos.qi.QIEntityView.java

License:Open Source License

protected boolean saveClick(Button.ClickEvent event, Layout formLayout) {
    if (binder.validate().isOk()) {
        if (getEntity(bean) == null) {
            try {
                saveEntity();/* w ww.ja va 2  s.c om*/
            } catch (BLException e) {
                getApp().getLog().error(e);
                getApp().displayNotification(e.getDetailedMessage());
                return false;
            }
        } else {
            try {
                updateEntity();
            } catch (BLException e) {
                getApp().getLog().error(e);
                getApp().displayNotification(e.getDetailedMessage());
                return false;
            }
        }
        binder.setReadOnly(true);
        formLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
        event.getButton().setVisible(false);
        cancelBtn.setVisible(false);
        editBtn.setVisible(true);
        removeBtn.setVisible(true);
        errorLabel.setValue(null);
        errorLabel.setVisible(false);
        if (revisionsPanel != null && revisionsPanel.getParent() != null) {
            Layout parent = (Layout) revisionsPanel.getParent();
            parent.removeComponent(revisionsPanel);
            loadRevisionHistory(parent, revisionsPanel.getRef());
        }
        return true;
    } else {
        BindingValidationStatus<?> result = binder.validate().getFieldValidationErrors().get(0);
        getApp().displayNotification(result.getResult().get().getErrorMessage());
        return false;
    }
}

From source file:org.vaadin.spring.sidebar.components.ValoSideBar.java

License:Apache License

/**
 * Adds a header to the top of the side bar, below the logo. The {@link ValoTheme#MENU_TITLE} style
 * will automatically be added to the layout.
 *
 * @param headerLayout the layout containing the header, or {@code null} to remove.
 *///from   ww  w .j av  a  2 s . c  o m
public void setHeader(Layout headerLayout) {
    if (getCompositionRoot() != null && this.headerLayout != null) {
        getCompositionRoot().removeComponent(this.headerLayout);
    }
    this.headerLayout = headerLayout;
    if (headerLayout != null) {
        headerLayout.addStyleName(ValoTheme.MENU_TITLE);
        if (getCompositionRoot() != null) {
            if (this.logo != null) {
                getCompositionRoot().addComponent(headerLayout, 1);
            } else {
                getCompositionRoot().addComponentAsFirst(headerLayout);
            }
        }
    }
}