Example usage for com.vaadin.ui Label setStyleName

List of usage examples for com.vaadin.ui Label setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Label setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjectView.java

License:Open Source License

/**
 * // w  w  w .  j av  a  2s .c  o m
 */
public void loadGraph() {
    if (graphSectionContent.getComponentCount() == 0
            || !(graphSectionContent.getComponent(0) instanceof Image)) {
        ProgressBar progress = new ProgressBar();
        progress.setIndeterminate(true);
        Label info = new Label(
                "Computing the project graph can take several seconds on big projects. Please be patient.");
        info.setStyleName(ValoTheme.LABEL_SUCCESS);
        graphSectionContent.removeAllComponents();
        graphSectionContent.addComponent(progress);
        graphSectionContent.setComponentAlignment(progress, Alignment.MIDDLE_CENTER);
        Worker worker = new Worker(getCurrent());
        worker.start();
        UI.getCurrent().setPollInterval(500);
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjectView.java

License:Open Source License

/**
 * /* w w  w  .j  av  a  2  s  .c  o  m*/
 */
void updateContentGraph() {
    Resource resource = getGraphResourceAndParseNewGraph();

    if (resource != null) {
        graphSectionContent.removeAllComponents();
        Image graphImage = new Image("", resource);

        graphSectionContent.addComponent(graphImage);
        graphSectionContent.setComponentAlignment(graphImage, Alignment.MIDDLE_CENTER);
    } else {
        Label error = new Label("Project Graph can not be computed at that time for this project");
        error.setStyleName(ValoTheme.LABEL_FAILURE);
        graphSectionContent.removeAllComponents();
        graphSectionContent.addComponent(error);
        graphSectionContent.setComponentAlignment(error, Alignment.MIDDLE_CENTER);

        LOGGER.error(String.format("%s: %s", error.getValue(), currentBean.getId()));
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjectView.java

License:Open Source License

/**
 * /*from  ww w.  j a  v  a 2  s . c  o  m*/
 * @param list
 * @return
 */
private Component getMembersComponent() {
    membersLayout = new HorizontalLayout();
    membersLayout.setWidth("100%");

    ProgressBar progress = new ProgressBar();
    progress.setIndeterminate(true);
    Label info = new Label(
            "Searching for members. Can take several seconds on big projects. Please be patient.");
    info.setStyleName(ValoTheme.LABEL_SUCCESS);
    membersLayout.addComponent(progress);
    MemberWorker worker = new MemberWorker();
    worker.start();
    UI.getCurrent().setPollInterval(500);

    return membersLayout;
}

From source file:dhbw.clippinggorilla.userinterface.views.AboutUsView.java

public AboutUsView() {
    setMargin(true);/*from  w w w  . j a v  a 2s .c  om*/
    setWidth("55%");

    Label aboutUsHeader = new Label();
    Language.set(Word.ABOUT_US, aboutUsHeader);
    aboutUsHeader.setStyleName(ValoTheme.LABEL_H1);
    addComponent(aboutUsHeader);

    Label aboutUsGroupHeadline = new Label();
    Language.set(Word.GROUP_PROJECT_OF_GROUP_4, aboutUsGroupHeadline);
    aboutUsGroupHeadline.setStyleName(ValoTheme.LABEL_H2);
    addComponent(aboutUsGroupHeadline);

    Label aboutUsText = new Label();
    Language.set(Word.GROUP_PROJECT_BODY, aboutUsText);
    aboutUsText.setWidth("100%");
    aboutUsText.setContentMode(com.vaadin.shared.ui.ContentMode.HTML);
    addComponent(aboutUsText);

    Label theTeamHeader = new Label();
    Language.set(Word.OUR_TEAM, theTeamHeader);
    theTeamHeader.setStyleName(ValoTheme.LABEL_H2);
    addComponent(theTeamHeader);

    Grid<Person> theTeamGrid = new Grid<>();
    List<Person> persons = Arrays.asList(new Person("Dan-Pierre", "Drehlich", Person.Function.TEAMLEADER),
            new Person("Stefan", "Schmid", Person.Function.RESPONSIBLE_FOR_RESEARCH),
            new Person("Jan", "Striegel", Person.Function.TECHNICAL_ASSISTANT),
            new Person("Lisa", "Hartung",
                    Person.Function.RESPONSIBLE_FOR_MODELING_QUALITY_ASSURANCE_AND_DOCUMENTATION),
            new Person("Tim", "Heinzelmann", Person.Function.RESPONSIBLE_FOR_TESTS),
            new Person("Josua", "Frank", Person.Function.RESPONSIBLE_FOR_IMPLEMENTATION));
    Grid.Column c1 = theTeamGrid.addColumn(p -> p.getFirstName());
    Language.setCustom(Word.FIRST_NAME, s -> c1.setCaption(s));
    Grid.Column c2 = theTeamGrid.addColumn(p -> p.getLastName());
    Language.setCustom(Word.LAST_NAME, s -> c2.setCaption(s));
    Grid.Column c3 = theTeamGrid.addColumn(p -> p.getResposibility());
    Language.setCustom(Word.RESPONSIBILITY, s -> {
        c3.setCaption(s);
        theTeamGrid.getDataProvider().refreshAll();
    });
    theTeamGrid.setItems(persons);
    theTeamGrid.setWidth("100%");
    theTeamGrid.setHeightByRows(6);
    addComponent(theTeamGrid);
    SESSIONS.put(VaadinSession.getCurrent(), this);
}

From source file:dhbw.clippinggorilla.userinterface.views.ImpressumView.java

public ImpressumView() {
    setMargin(true);/*from  w  w w.  j av  a 2  s.co m*/
    setWidth("55%");

    Label impressumHeader = new Label();
    Language.set(Word.IMPRESSUM, impressumHeader);
    impressumHeader.setStyleName(ValoTheme.LABEL_H1);
    addComponent(impressumHeader);

    Label impressumText = new Label();
    Language.set(Word.IMPRESSUM_BODY, impressumText);
    impressumText.setWidth("100%");
    impressumText.setContentMode(com.vaadin.shared.ui.ContentMode.HTML);
    addComponent(impressumText);

    Grid<Person> studentsGrid = new Grid<>();
    List<Person> persons = Arrays.asList(new Person("Dan-Pierre", "Drehlich", Person.Function.TEAMLEADER),
            new Person("Stefan", "Schmid", Person.Function.RESPONSIBLE_FOR_RESEARCH),
            new Person("Jan", "Striegel", Person.Function.TECHNICAL_ASSISTANT),
            new Person("Lisa", "Hartung",
                    Person.Function.RESPONSIBLE_FOR_MODELING_QUALITY_ASSURANCE_AND_DOCUMENTATION),
            new Person("Tim", "Heinzelmann", Person.Function.RESPONSIBLE_FOR_TESTS),
            new Person("Josua", "Frank", Person.Function.RESPONSIBLE_FOR_IMPLEMENTATION));
    Column c1 = studentsGrid.addColumn(p -> p.getFirstName());
    Language.setCustom(Word.FIRST_NAME, s -> c1.setCaption(s));
    Column c2 = studentsGrid.addColumn(p -> p.getLastName());
    Language.setCustom(Word.LAST_NAME, s -> c2.setCaption(s));
    Column c3 = studentsGrid.addColumn(p -> p.getResposibility());
    Language.setCustom(Word.RESPONSIBILITY, s -> {
        c3.setCaption(s);
        studentsGrid.getDataProvider().refreshAll();
    });

    studentsGrid.setItems(persons);
    studentsGrid.setWidth("100%");
    studentsGrid.setHeightByRows(6);
    addComponent(studentsGrid);

    Label liabilityHeadline = new Label();
    Language.set(Word.LIABILITY, liabilityHeadline);
    liabilityHeadline.setStyleName(ValoTheme.LABEL_H1);
    addComponent(liabilityHeadline);

    Label liabilityContentHeadline = new Label();
    Language.set(Word.LIABILITY_CONTENT, liabilityContentHeadline);
    liabilityContentHeadline.setStyleName(ValoTheme.LABEL_H2);
    addComponent(liabilityContentHeadline);

    Label liabilityContentText = new Label();
    Language.set(Word.LIABILITY_CONTENT_BODY, liabilityContentText);
    liabilityContentText.setWidth("100%");
    addComponent(liabilityContentText);

    Label liabilityLinksHeadline = new Label();
    Language.set(Word.LIABILITY_LINKS, liabilityLinksHeadline);
    liabilityLinksHeadline.setStyleName(ValoTheme.LABEL_H2);
    addComponent(liabilityLinksHeadline);

    Label liabilityLinksText = new Label();
    Language.set(Word.LIABILITY_LINKS_BODY, liabilityLinksText);
    liabilityLinksText.setWidth("100%");
    addComponent(liabilityLinksText);

    Label copyrightHeadline = new Label();
    Language.set(Word.COPYRIGHT, copyrightHeadline);
    copyrightHeadline.setStyleName(ValoTheme.LABEL_H2);
    addComponent(copyrightHeadline);

    Label copyrightText = new Label();
    Language.set(Word.COPYRIGHT_BODY, copyrightText);
    copyrightText.setWidth("100%");
    addComponent(copyrightText);

    Label dataProtectionHeadline = new Label();
    Language.set(Word.DATAPROTECTION, dataProtectionHeadline);
    dataProtectionHeadline.setStyleName(ValoTheme.LABEL_H2);
    addComponent(dataProtectionHeadline);

    Label dataProtectionText = new Label();
    Language.set(Word.DATAPROTECTION_BODY, dataProtectionText);
    dataProtectionText.setWidth("100%");
    addComponent(dataProtectionText);
    SESSIONS.put(VaadinSession.getCurrent(), this);
}

From source file:dhbw.clippinggorilla.userinterface.windows.ConfirmationDialog.java

public ConfirmationDialog(String confirmationText, Runnable onOk, Runnable onCancel) {
    addCloseListener(ce -> onCancel.run());
    setCaption(Language.get(Word.CONFIRMATION));

    VerticalLayout root = new VerticalLayout();
    root.setSpacing(false);//from w w w. j av a  2s.  c o  m
    root.setMargin(false);
    root.setSizeFull();

    Label text = new Label(confirmationText);
    text.setStyleName(ValoTheme.LABEL_H3);
    text.setWidth("100%");
    VerticalLayout layoutText = new VerticalLayout(text);
    layoutText.setSizeFull();
    layoutText.addStyleName("tags");
    layoutText.setSpacing(false);

    root.addComponent(layoutText);

    Label ignoreMe = new Label();

    Button ok = new Button(Language.get(Word.OK));
    ok.addClickListener(c -> {
        close();
        onOk.run();
    });
    ok.addStyleName(ValoTheme.BUTTON_DANGER);

    Button cancel = new Button(Language.get(Word.CANCEL));
    cancel.addClickListener(c -> {
        close();
        onCancel.run();
    });
    cancel.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.setSizeUndefined();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth("100%");
    footer.addStyleName("menubar");
    footer.addComponents(ignoreMe, ok, cancel);
    footer.setColumnExpandRatio(0, 5);
    footer.setComponentAlignment(ok, Alignment.MIDDLE_CENTER);
    footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER);
    root.setExpandRatio(layoutText, 5);
    root.addComponent(footer);

    setContent(root);
    setModal(true);
    center();
    setDraggable(false);
    setResizable(false);
    setWidth("350px");
    setHeight("200px");
    UI.getCurrent().addWindow(this);

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.InitialScreenViewImpl.java

License:Open Source License

public void createImportButton() {
    importButton = new VerticalLayout();
    importButton.setWidth(150, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    importButton.setHeight(80, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    importButton.setStyleName("topBarButtonContainer");
    UploadReceiver receiver = new UploadReceiver(eventBus);
    Upload upload = new Upload(null, receiver);
    upload.setButtonCaption("");
    upload.setImmediate(true);/*w w w  .  ja v  a 2s.  co  m*/
    upload.addListener(receiver);
    upload.setStyleName("importButton");
    upload.setWidth(30, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    upload.setHeight(30, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    Label gap = new Label();
    gap.setHeight("5px");
    Label label = new Label("Projekte");
    label.setStyleName("topBarButtonLabel");
    label.setSizeUndefined();
    Label label2 = new Label("importieren");
    label2.setStyleName("topBarButtonLabel");
    label2.setSizeUndefined();
    VerticalLayout labelLayout = new VerticalLayout();
    labelLayout.setHeight(45, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    labelLayout.setWidth(100, UNITS_PERCENTAGE);
    importButton.addComponent(upload);
    labelLayout.addComponent(label);
    labelLayout.addComponent(label2);
    importButton.addComponent(gap);
    importButton.addComponent(labelLayout);
    importButton.setComponentAlignment(upload, Alignment.TOP_CENTER);
    labelLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
    labelLayout.setComponentAlignment(label2, Alignment.MIDDLE_CENTER);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.InitialScreenViewImpl.java

License:Open Source License

public void setPageDescription(String source, String page, String[] description) {
    int labelCount = descriptionLayout.getComponentCount();
    Label oldLabel;// w  w w.  ja  v a  2  s . c o m
    int i;
    homeIcon.setSource(new ThemeResource(source));
    seitenLabel.setValue(page);
    for (i = 0; i < labelCount && i < description.length; i++) {
        oldLabel = (Label) descriptionLayout.getComponent(i);
        oldLabel.setValue(description[i]);
        if (i == 0) {
            descriptionLayout.setComponentAlignment(oldLabel, Alignment.BOTTOM_CENTER);
        } else {
            descriptionLayout.setComponentAlignment(oldLabel, Alignment.TOP_CENTER);
        }
    }
    //      descriptionLabel.setValue(description[0]);
    for (int a = i; a < description.length; a++) {
        Label newLabel = new Label(description[a]);
        newLabel.setStyleName("descriptionLabel");
        newLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
        descriptionLayout.addComponent(newLabel);
        descriptionLayout.setComponentAlignment(newLabel, Alignment.TOP_CENTER);
    }
    for (int b = i; b < labelCount; b++) {
        descriptionLayout.removeComponent(descriptionLayout.getComponent(b));
    }
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java

License:Open Source License

/**
 * Konkrete Ausprogrammierung der Darstellung eines einzelnen Projekts.
 * Ein Projekt wird durch ein VerticalLayout dargestellt, das ein Label
 * mit dem Projektname enthlt. Auerdem bekommt es einen ClickListener,
 * um ein Projekt als selektiert zu kennzeichnen und die Details zum Projekt
 * anzuzeigen./*from  w  w  w .j a  va 2s  . c  om*/
 * 
 * @author Christian Scherer, Mirko Gpfrich, Marco Glaser
 * @param project
 *            das darzustellende Projekt und der aktuelle Index der Liste
 * @param i
 *            der Index der zu erstellenden Komponente (besonders fuer den
 *            Loeschbutton relevant)
 * @return ein VerticalLayout Objekt, das zur Eingliederung in das UI dient
 */
private VerticalLayout generateSingleProjectUI(Project project, int i) {

    final Project proj = project;
    final int a = i;
    //erzeugt eine Panel fr ein Projekt
    singleProject = new VerticalLayout();
    HorizontalLayout container = new HorizontalLayout();
    container.setSizeFull();
    if (i == 0) {
        singleProject.setStyleName("singleProjectSelected");
        presenter.projectSelected(project);
    } else {
        singleProject.setStyleName("singleProject");
    }
    Embedded icon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418828714_editor_open_folder-128.png"));
    icon.setHeight(40, UNITS_PIXELS);
    icon.setWidth(40, UNITS_PIXELS);
    Label gap1 = new Label();
    Label gap2 = new Label();
    Label gap3 = new Label();
    gap1.setWidth("15px");
    gap2.setWidth("15px");
    gap3.setSizeFull();
    Label projectName = new Label(project.getName());
    projectName.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    projectName.setHeight(Sizeable.SIZE_UNDEFINED, 0);
    projectName.setStyleName("projectName");

    //Legt ein Layout fr das Projekt-Panel fest
    //panelContent.setSizeFull();
    container.addComponent(gap1);
    container.addComponent(icon);
    container.addComponent(gap2);
    container.addComponent(projectName);
    container.addComponent(gap3);
    container.setExpandRatio(gap3, 1.0f);

    singleProject.addComponent(container);
    singleProject.setWidth(100, UNITS_PERCENTAGE);
    singleProject.setHeight(70, UNITS_PIXELS);
    container.setComponentAlignment(icon, Alignment.MIDDLE_CENTER);
    container.setComponentAlignment(projectName, Alignment.MIDDLE_CENTER);

    singleProject.addListener(new LayoutClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            presenter.projectSelected(proj);
            switchProjectsStyle(a);

            eventBus.fireEvent(new SelectProjectEvent());
        }

    });

    //      singleProject.addListener(this);
    //      projectListPanel.addComponent(singleProject);
    logger.debug("Einzelnes Projektelement erzeugt");

    return singleProject;
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.process.navigation.NavigationViewImpl.java

License:Open Source License

private void addProjectName() {
    Label projectName = new Label("Sie bearbeiten derzeit das Projekt: " + presenter.getProjectName());
    projectName.setStyleName("projectname");
    this.full.addComponent(projectName);
    this.full.setComponentAlignment(projectName, Alignment.MIDDLE_CENTER);

}