Example usage for com.vaadin.ui Label setResponsive

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

Introduction

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

Prototype

public void setResponsive(boolean responsive) 

Source Link

Document

Toggles responsiveness of this component.

Usage

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

License:Open Source License

/**
 * /*from w ww .  j  ava 2 s . c o m*/
 * @param statusValues
 * @return
 */
public VerticalLayout createProjectStatusComponentNew(Map<String, Integer> statusValues) {
    VerticalLayout projectStatusContent = new VerticalLayout();
    projectStatusContent.setResponsive(true);
    projectStatusContent.setMargin(true);
    projectStatusContent.setSpacing(true);

    Label planned = new Label();
    Label design = new Label();
    Label raw = new Label();
    Label results = new Label();

    Iterator<Entry<String, Integer>> it = statusValues.entrySet().iterator();

    while (it.hasNext()) {
        Map.Entry<String, Integer> pairs = (Map.Entry<String, Integer>) it.next();

        if ((Integer) pairs.getValue() == 0) {
            Label statusLabel = new Label(pairs.getKey());
            statusLabel.setStyleName(ValoTheme.LABEL_FAILURE);
            statusLabel.setResponsive(true);
            // statusLabel.addStyleName("redicon");
            if (pairs.getKey().equals("Project planned")) {
                planned = statusLabel;
            } else if (pairs.getKey().equals("Experimental design registered")) {
                design = statusLabel;
            } else if (pairs.getKey().equals("Raw data registered")) {
                raw = statusLabel;
            } else if (pairs.getKey().equals("Results registered")) {
                results = statusLabel;
            }
        }

        else {
            Label statusLabel = new Label(pairs.getKey());
            statusLabel.setStyleName(ValoTheme.LABEL_SUCCESS);
            statusLabel.setResponsive(true);

            // statusLabel.addStyleName("greenicon");

            if (pairs.getKey().equals("Project planned")) {
                planned = statusLabel;
            } else if (pairs.getKey().equals("Experimental design registered")) {
                design = statusLabel;
            } else if (pairs.getKey().equals("Raw data registered")) {
                raw = statusLabel;
            } else if (pairs.getKey().equals("Results registered")) {
                results = statusLabel;
            }
        }
    }

    projectStatusContent.addComponent(planned);
    projectStatusContent.addComponent(design);
    projectStatusContent.addComponent(raw);
    projectStatusContent.addComponent(results);

    // ProgressBar progressBar = new ProgressBar();
    // progressBar.setValue((float) finishedExperiments / statusValues.keySet().size());
    // projectStatusContent.addComponent(progressBar);

    return projectStatusContent;
}