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:org.s23m.cell.editor.semanticdomain.ui.components.MultitabPanel.java

License:Mozilla Public License

public void displaySearchResults() {
    application.getMainWindow().showNotification("Processing results...");
    this.pageIndex = 0;
    final RepositoryClient client = RepositoryClientImpl.getInstance();
    final String inputText = application.getContainmentTreePanel().getSearchText();
    final ArtefactContainer container = ObjectFactoryHolder.getInstance().createArtefactContainer();
    container.setContentType(SerializationType.SEARCH_ARGUMENTS.toString());
    final Content searchContent = ObjectFactoryHolder.getInstance().createArtefactContainerContent();
    searchContent.setContent(inputText);
    container.getContent().add(searchContent);
    final ArtefactContainer resultsContainer = client.get(container);
    searchResults = new ArrayList<SearchResultType>();
    for (final SearchResult sr : resultsContainer.getSearchResult()) {
        searchResults.add(sr);//from  ww w . j a v  a2 s  . c om
    }
    searchResultPanel.removeAllComponents();

    final Panel resultsPanel = new Panel();
    final Label lblTitle = new Label();
    lblTitle.setValue(inputText + "<br/>Returned: " + searchResults.size() + " result(s)");
    lblTitle.setContentMode(Label.CONTENT_XHTML);
    lblTitle.setStyleName("title-label");
    searchResultPanel.addComponent(lblTitle);

    if (searchResults.size() > 0) {
        //display 10 per page and put a navigation toolbar at the bottom
        searchResultPanel.addComponent(resultsPanel);
        final int startIndex = pageIndex * PAGE_SIZE;
        final int endIndex = startIndex + PAGE_SIZE;
        buildResultsPage(resultsPanel, startIndex, endIndex);
    }
}

From source file:org.sensorhub.ui.DefaultModulePanel.java

License:Mozilla Public License

@Override
@SuppressWarnings("serial")
public void build(final MyBeanItem<ModuleConfig> beanItem, final ModuleType module) {
    setSizeUndefined();/*w ww  .  j  a va2 s .co m*/
    setWidth(100.0f, Unit.PERCENTAGE);
    setMargin(false);
    setSpacing(true);

    // label with module name
    String moduleName = getTitle(beanItem.getBean());
    Label title = new Label(moduleName);
    title.setStyleName(STYLE_H2);
    addComponent(title);

    // apply changes button
    Button applyButton = new Button("Apply Changes");
    applyButton.setIcon(APPLY_ICON);
    applyButton.addStyleName("apply-button");
    addComponent(applyButton);

    // config form
    final IModuleConfigForm form = getConfigForm(beanItem, module);
    addComponent(form);

    // apply button action
    applyButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                form.commit();
                if (module != null)
                    ((IModule<ModuleConfig>) module).updateConfig(beanItem.getBean());
            } catch (Exception e) {
                String msg = "Error while updating module configuration";
                Page page = AdminUI.getInstance().getPage();
                new Notification("Error", msg + '\n' + e.getMessage(), Notification.Type.ERROR_MESSAGE)
                        .show(page);
                //Notification.show("Error", msg + '\n' + e.getMessage(), Notification.Type.ERROR_MESSAGE);
                AdminUI.log.error(msg, e);
            }
        }
    });
}

From source file:org.vaadin.mqtt.ui.MqttComponent.java

/**
 * Show a message instead of the content.
 *
 * @param message/*  w  ww. j  a  v a2  s .c  o  m*/
 * @param isSucsess Error messages are formatted differently from success
 * messages.
 */
public final void showUserMessage(final String message, boolean isSucsess) {
    removeAllComponents();
    Label l = new Label(message);
    l.setStyleName(isSucsess ? ValoTheme.LABEL_SUCCESS : ValoTheme.LABEL_FAILURE);
    addComponents(title, l);
}

From source file:pl.exsio.frameset.vaadin.account.menu.presenter.AccountMenuPresenterImpl.java

License:Open Source License

protected Label getUsernameLabel(User user) {
    Label userLabel = new Label(user.toString());
    userLabel.setStyleName("user-name");
    userLabel.setSizeUndefined();/*from  ww w .  j a  v  a 2  s.  co m*/
    return userLabel;
}

From source file:pl.exsio.frameset.vaadin.account.menu.presenter.AccountMenuPresenterImpl.java

License:Open Source License

protected Label getProfileIconLabel() {
    Label profilePic = new Label(FontAwesome.USER.getHtml(), ContentMode.HTML);
    profilePic.setStyleName("user-icon");
    return profilePic;
}

From source file:probe.com.view.body.quantcompare.PieChart.java

public PieChart(String title, double full, double found, final String notfound) {

    this.setWidth(200 + "px");
    this.setHeight(200 + "px");
    defaultKeyColorMap.put("Found", new Color(110, 177, 206));
    defaultKeyColorMap.put("Not found", new Color(219, 169, 1));
    otherSymbols.setGroupingSeparator('.');
    this.setStyleName("click");

    labels = new String[] { "Found", "Not found" };

    double foundPercent = ((found / full) * 100.0);
    df = new DecimalFormat("#.##", otherSymbols);
    valuesMap.put("Found", ((int) found) + " (" + df.format(foundPercent) + "%)");
    values = new Double[] { foundPercent, 100.0 - foundPercent };
    valuesMap.put("Not found", ((int) (full - found)) + " (" + df.format(100.0 - foundPercent) + "%)");

    String defaultImgURL = initPieChart(200, 200, title);
    chartImg.setSource(new ExternalResource(defaultImgURL));
    this.addComponent(chartImg);
    this.addLayoutClickListener(PieChart.this);

    popupLayout = new PopupView(null, popupBody);
    popupLayout.setHideOnMouseOut(false);
    popupBody.setWidth("300px");
    popupBody.setStyleName(Reindeer.LAYOUT_WHITE);
    popupBody.setHeightUndefined();/*  ww w. j  a  va2s.  c o m*/
    this.addComponent(popupLayout);
    this.notfound = notfound.replace(" ", "").replace(",", "/n");

    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.setHeight("20px");

    Label header = new Label("<b>Not Found (New Proteins)</b>");
    header.setStyleName(Reindeer.LABEL_SMALL);
    topLayout.addComponent(header);
    header.setContentMode(ContentMode.HTML);

    VerticalLayout closeBtn = new VerticalLayout();
    closeBtn.setWidth("10px");
    closeBtn.setHeight("10px");
    closeBtn.setStyleName("closebtn");
    topLayout.addComponent(closeBtn);
    topLayout.setComponentAlignment(closeBtn, Alignment.TOP_RIGHT);
    closeBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            popupLayout.setPopupVisible(false);
        }
    });
    popupBody.addComponent(topLayout);
    popupBody.addComponent(textArea);
    textArea.setWidth("100%");
    textArea.setHeight("150px");
    textArea.setValue(this.notfound);
    textArea.setReadOnly(true);
    popupBody.setSpacing(true);

    HorizontalLayout bottomLayout = new HorizontalLayout();
    bottomLayout.setWidth("100%");
    bottomLayout.setHeight("40px");
    bottomLayout.setMargin(new MarginInfo(false, true, true, true));
    popupBody.addComponent(bottomLayout);

    Button exportTableBtn = new Button("");
    exportTableBtn.setHeight("24px");
    exportTableBtn.setWidth("24px");
    exportTableBtn.setPrimaryStyleName("exportxslbtn");
    exportTableBtn.setDescription("Export table data");
    exportTableBtn.addClickListener(new Button.ClickListener() {

        private Table table;

        @Override
        public void buttonClick(Button.ClickEvent event) {

            if (table == null) {
                table = new Table();
                table.addContainerProperty("Index", Integer.class, null, "", null, Table.Align.RIGHT);
                table.addContainerProperty("Accession", String.class, Table.Align.CENTER);
                table.setVisible(false);
                addComponent(table);
                int i = 1;
                for (String str : notfound.replace(" ", "").replace(",", "\n").split("\n")) {
                    table.addItem(new Object[] { i, str }, i++);
                }

            }

            ExcelExport csvExport = new ExcelExport(table, "Not found protein accessions (New proteins)");
            //                csvExport.setReportTitle("CSF-PR /  Not found protein accessions (New proteins) ");
            csvExport.setExportFileName("CSF-PR - Not found protein accessions" + ".xls");
            csvExport.setMimeType(CsvExport.EXCEL_MIME_TYPE);
            csvExport.setDisplayTotals(false);
            csvExport.setExcelFormatOfProperty("Index", "#0;[Red] #0");
            csvExport.export();

        }
    });

    bottomLayout.addComponent(exportTableBtn);
    bottomLayout.setComponentAlignment(exportTableBtn, Alignment.MIDDLE_RIGHT);

}

From source file:probe.com.view.body.QuantCompareDataLayout.java

public QuantCompareDataLayout(CSFPRHandler CSFPR_Handler) {
    this.setWidth("100%");
    this.setHeightUndefined();
    this.setStyleName(Reindeer.LAYOUT_WHITE);
    this.setSpacing(true);
    topLabelMarker = new VerticalLayout();
    this.addComponent(topLabelMarker);
    this.setExpandRatio(topLabelMarker, 0.01f);
    topLabelMarker.setHeight("10px");
    topLabelMarker.setWidth("20px");
    topLabelMarker.setStyleName(Reindeer.LAYOUT_WHITE);
    this.CSFPR_Handler = CSFPR_Handler;
    Map<String, QuantDatasetInitialInformationObject> quantDatasetInitialInformationObjectMap = CSFPR_Handler
            .getQuantDatasetInitialInformationObject();
    diseaseGroupNames = new TreeSet<String>();
    for (String diseaseCategory : quantDatasetInitialInformationObjectMap.keySet()) {
        QuantDatasetInitialInformationObject quantDatasetInitialInformationObject = quantDatasetInitialInformationObjectMap
                .get(diseaseCategory);//from  www  . j  av  a 2s  . c om
        for (QuantDatasetObject qdsObject : quantDatasetInitialInformationObject.getQuantDatasetsList()
                .values()) {
            diseaseGroupNames.add(qdsObject.getPatientsSubGroup1().split("\n")[0].trim());
            diseaseGroupNames.add(qdsObject.getPatientsSubGroup2().split("\n")[0].trim());
        }

    }

    int width = 400;
    if (Page.getCurrent().getBrowserWindowWidth() < 800) {
        width = Page.getCurrent().getBrowserWindowWidth() / 2;
    }

    HorizontalLayout userDataLayout = new HorizontalLayout();
    userDataLayout.setSpacing(true);

    HorizontalLayout miniSelectDiseaseGroupsLayout = new HorizontalLayout();
    miniSelectDiseaseGroupsLayout.setStyleName("diseasegroupselectionresult");
    miniSelectDiseaseGroupsLayout.setSpacing(true);
    miniSelectDiseaseGroupsLayout.setWidthUndefined();
    miniselectionResultsLabel = new Label();
    //        miniselectionResultsLabel.setWidth("300px");
    miniSelectDiseaseGroupsLayout.addComponent(miniselectionResultsLabel);

    selectionResultsOverview = new Label();
    //        selectionResultsOverview.setWidth("300px");
    miniSelectDiseaseGroupsLayout.addComponent(selectionResultsOverview);
    selectionResultsOverview.setContentMode(ContentMode.HTML);

    userDataLayoutContainer = new HideOnClickLayout("User Data", userDataLayout, miniSelectDiseaseGroupsLayout,
            Alignment.TOP_LEFT, "info data", null);
    userDataLayoutContainer.setMargin(new MarginInfo(false, false, false, true));
    userDataLayoutContainer.setVisability(true);
    this.addComponent(userDataLayoutContainer);

    VerticalLayout leftUserDataLayout = new VerticalLayout();
    userDataLayout.addComponent(leftUserDataLayout);
    //select or enter new disease groups layout 

    selectionResultsLabel = new Label("Selection:");
    selectDiseaseGroupsContainer = initSelectEnterDatasetDiseaseGroups(width);
    //        selectDiseaseGroupsContainer.setVisability(true);
    selectDiseaseGroupsContainer.setReadOnly(true);
    leftUserDataLayout.addComponent(selectDiseaseGroupsContainer);

    proteinsDataCaptureLayout = initProteinsDataCapture(width);
    leftUserDataLayout.addComponent(proteinsDataCaptureLayout);

    ResultsOverviewLayout.setStyleName("compareresults");
    ResultsOverviewLayout.setWidth("350px");
    ResultsOverviewLayout.setHeightUndefined();
    ResultsOverviewLayout.setSpacing(true);
    ResultsOverviewLayout.setMargin(new MarginInfo(false, false, false, true));

    Label resultsTitleLabel = new Label("Results Overview");
    resultsTitleLabel.setContentMode(ContentMode.HTML);
    resultsTitleLabel.setStyleName("normalheader");
    resultsTitleLabel.setHeight("20px");
    ResultsOverviewLayout.addComponent(resultsTitleLabel);
    ResultsOverviewLayout.setComponentAlignment(resultsTitleLabel, Alignment.TOP_LEFT);

    resultContainer = new GridLayout(3, 5);
    resultContainer.setSpacing(true);
    resultContainer.setMargin(true);
    resultContainer.setHideEmptyRowsAndColumns(true);
    ResultsOverviewLayout.addComponent(resultContainer);
    ResultsOverviewLayout.setComponentAlignment(resultContainer, Alignment.TOP_LEFT);
    resultContainer.setWidth("100%");
    foundPublicationLabel = new Label();
    //        resultContainer.addComponent(foundPublicationLabel, 0, 0);

    foundStudiesLabel = new Label();
    //        resultContainer.addComponent(foundStudiesLabel, 1, 0);

    foundProteinsLabel = new Label();
    resultContainer.addComponent(foundProteinsLabel, 0, 0);

    newProteinsDownloadBtn = new Button();
    newProteinsDownloadBtn.setCaptionAsHtml(true);
    newProteinsDownloadBtn.setStyleName(Reindeer.BUTTON_LINK);
    //        ResultsOverviewLayout.addComponent(newProteinsDownloadBtn);
    newProteinsDownloadBtn.setDescription("Download new proteins (not found in CSF-PR) records");

    //        ResultsOverviewLayout.addComponent(newProteinsTextArea);
    newProteinsTextArea.setWidth("302px");
    newProteinsTextArea.setHeight("200px");
    newProteinsTextArea.setReadOnly(true);

    newProteinsDownloadBtn.addClickListener(QuantCompareDataLayout.this);
    newProteinsDownloadBtn.setId("notfounderrorbtn");
    userDataLayout.addComponent(ResultsOverviewLayout);

    this.addComponent(resultsLayout);
}

From source file:probe.com.view.body.QuantCompareDataLayout.java

private VerticalLayout initSelectEnterDatasetDiseaseGroups(int width) {
    VerticalLayout selectDiseaseGroupsMainLayout = new VerticalLayout();
    selectDiseaseGroupsMainLayout.setMargin(new MarginInfo(true, false, false, true));
    selectDiseaseGroupsMainLayout.setSpacing(true);

    Label titleLabel = new Label("1. Select/Enter Dataset Disease Groups");
    titleLabel.setContentMode(ContentMode.HTML);
    titleLabel.setStyleName("normalheader");
    titleLabel.setHeight("20px");
    selectDiseaseGroupsMainLayout.addComponent(titleLabel);
    selectDiseaseGroupsMainLayout.setComponentAlignment(titleLabel, Alignment.TOP_LEFT);

    HorizontalLayout selectionResultsContainer = new HorizontalLayout();
    //        selectionResultsContainer.setStyleName("diseasegroupselectionresult");

    String containerWidth = ((width * 2) + 10) + "px";
    selectionResultsContainer.setWidth(containerWidth);
    selectDiseaseGroupsMainLayout.setWidth(containerWidth);

    selectionResultsContainer.addComponent(selectionResultsLabel);
    selectionResultsLabel.setStyleName(Reindeer.LABEL_SMALL);
    //        selectionResultsLabel.setValue("Selection:   Group A / Group B");
    //        miniselectionResultsLabel.setValue("( Group A  / Group B )");

    Property.ValueChangeListener diseaseGroupsListListener = new Property.ValueChangeListener() {

        @Override/*from   w w  w.ja  v a2 s . c  o  m*/
        public void valueChange(Property.ValueChangeEvent event) {
            String value = "Selection:   ";
            if (diseaseGroupsListA.getValue() != null) {
                diseaseGroupsListA.setRequired(false);
                value += diseaseGroupsListA.getValue().toString();
                useRowSorter = diseaseGroupNames.contains(diseaseGroupsListA.getValue().toString().trim());
            }

            if (diseaseGroupsListB.getValue() != null) {
                diseaseGroupsListB.setRequired(false);
                value += " / " + diseaseGroupsListB.getValue().toString();
                useColumnSorter = diseaseGroupNames.contains(diseaseGroupsListB.getValue().toString().trim());
                //                    reset();
            }
            selectionResultsLabel.setValue(value);
            miniselectionResultsLabel.setValue(value);

            if ((diseaseGroupsListA.getValue() != null) && (diseaseGroupsListB.getValue() != null)) {

                if (diseaseGroupsListA.getValue().toString().trim()
                        .equalsIgnoreCase(diseaseGroupsListB.getValue().toString().trim())) {
                    useRowSorter = useColumnSorter = false;
                }
            }
        }
    };

    HorizontalLayout diseaseGroupsListsContainer = new HorizontalLayout();
    selectDiseaseGroupsMainLayout.addComponent(diseaseGroupsListsContainer);
    diseaseGroupsListsContainer.setWidth(containerWidth);

    diseaseGroupsListA.setStyleName("diseasegrouplist");
    diseaseGroupsListA.setNullSelectionAllowed(false);
    diseaseGroupsListA.setImmediate(true);
    diseaseGroupsListA.setNewItemsAllowed(true);
    diseaseGroupsListA.setWidth(width, Unit.PIXELS);
    diseaseGroupsListA.setInputPrompt("Select or enter new disease group name");
    diseaseGroupsListA.setRequiredError("Select or enter new disease group name");

    diseaseGroupsListB.setStyleName("diseasegrouplist");
    diseaseGroupsListB.setNullSelectionAllowed(false);
    diseaseGroupsListB.setRequiredError("Select or enter new disease group name");

    diseaseGroupsListB.setImmediate(true);
    diseaseGroupsListB.setNewItemsAllowed(true);
    diseaseGroupsListB.setWidth(width, Unit.PIXELS);
    diseaseGroupsListB.setInputPrompt("Select or enter new disease group name");

    selectDiseaseGroupsMainLayout.addComponent(selectionResultsContainer);

    diseaseGroupsListsContainer.addComponent(diseaseGroupsListA);
    diseaseGroupsListsContainer.addComponent(diseaseGroupsListB);
    diseaseGroupsListsContainer.setComponentAlignment(diseaseGroupsListB, Alignment.TOP_RIGHT);

    this.resetLists();

    diseaseGroupsListA.addValueChangeListener(diseaseGroupsListListener);
    diseaseGroupsListB.addValueChangeListener(diseaseGroupsListListener);
    diseaseGroupsListA.setNewItemHandler(new AbstractSelect.NewItemHandler() {

        @Override
        public void addNewItem(String newItemCaption) {
            diseaseGroupsListA.addItem(newItemCaption);
            diseaseGroupsListA.select(newItemCaption);
        }
    });

    diseaseGroupsListB.setNewItemHandler(new AbstractSelect.NewItemHandler() {

        @Override
        public void addNewItem(String newItemCaption) {
            diseaseGroupsListB.addItem(newItemCaption);
            diseaseGroupsListB.select(newItemCaption);
        }
    });

    return selectDiseaseGroupsMainLayout;//new HideOnClickLayout("Select/Enter Dataset Disease Groups", proteinsDataCapturingMainLayout, miniSelectDiseaseGroupsLayout, Alignment.TOP_LEFT, null, null);

}

From source file:probe.com.view.body.QuantCompareDataLayout.java

private VerticalLayout initProteinsDataCapture(int width) {
    VerticalLayout proteinsDataCapturingMainLayout = new VerticalLayout();
    proteinsDataCapturingMainLayout.setSpacing(true);
    proteinsDataCapturingMainLayout.setMargin(true);
    String containerWidth = ((width * 2) + 10) + "px";
    proteinsDataCapturingMainLayout.setWidth(containerWidth);
    proteinsDataCapturingMainLayout.setSpacing(true);

    Label titleLabel = new Label("2. Insert UniProt Proteins Accessions");
    titleLabel.setContentMode(ContentMode.HTML);
    titleLabel.setStyleName("normalheader");
    titleLabel.setHeight("20px");
    proteinsDataCapturingMainLayout.addComponent(titleLabel);
    proteinsDataCapturingMainLayout.setComponentAlignment(titleLabel, Alignment.TOP_LEFT);

    GridLayout insertProteinsLayout = new GridLayout(3, 3);
    proteinsDataCapturingMainLayout.addComponent(insertProteinsLayout);
    insertProteinsLayout.setSpacing(true);
    insertProteinsLayout.setMargin(new MarginInfo(false, false, false, false));
    insertProteinsLayout.setWidth(containerWidth);

    HorizontalLayout hlo1 = new HorizontalLayout();
    hlo1.setWidth("100%");
    hlo1.setMargin(new MarginInfo(false, true, false, false));
    Label highLabel = new Label("<font color='#cc0000'>&nbsp;High</font>");
    highLabel.setWidth("40px");
    highLabel.setContentMode(ContentMode.HTML);
    hlo1.addComponent(highLabel);/*from w ww. ja va2s.c om*/

    HorizontalLayout hlo2 = new HorizontalLayout();
    hlo2.setWidth("100%");
    hlo2.setMargin(new MarginInfo(false, true, false, false));
    Label stableLabel = new Label("<font color='#018df4'>&nbsp;Stable</font>");
    stableLabel.setWidth("50px");
    stableLabel.setContentMode(ContentMode.HTML);
    hlo2.addComponent(stableLabel);

    HorizontalLayout hlo3 = new HorizontalLayout();
    hlo3.setWidth("100%");
    hlo3.setMargin(new MarginInfo(false, true, false, false));
    Label lowLabel = new Label("<font color='#009900'>&nbsp;Low</font>");
    lowLabel.setWidth("40px");
    lowLabel.setContentMode(ContentMode.HTML);
    hlo3.addComponent(lowLabel);
    insertProteinsLayout.addComponent(hlo1, 0, 0);
    insertProteinsLayout.setComponentAlignment(hlo1, Alignment.MIDDLE_CENTER);
    insertProteinsLayout.addComponent(hlo2, 1, 0);
    insertProteinsLayout.setComponentAlignment(hlo2, Alignment.MIDDLE_CENTER);
    insertProteinsLayout.addComponent(hlo3, 2, 0);
    insertProteinsLayout.setComponentAlignment(hlo3, Alignment.MIDDLE_CENTER);

    highTextArea.setWidth("100%");
    highTextArea.setHeight("200px");
    insertProteinsLayout.addComponent(highTextArea, 0, 1);
    insertProteinsLayout.setComponentAlignment(highTextArea, Alignment.MIDDLE_CENTER);

    stableTextArea.setWidth("100%");
    stableTextArea.setHeight("200px");
    insertProteinsLayout.addComponent(stableTextArea, 1, 1);
    insertProteinsLayout.setComponentAlignment(stableTextArea, Alignment.MIDDLE_CENTER);

    lowTextArea.setWidth("100%");
    lowTextArea.setHeight("200px");
    insertProteinsLayout.addComponent(lowTextArea, 2, 1);
    insertProteinsLayout.setComponentAlignment(lowTextArea, Alignment.MIDDLE_CENTER);

    VerticalLayout clear1 = new VerticalLayout();
    hlo1.addComponent(clear1);
    clear1.setDescription("Clear field");
    clear1.setStyleName("clearfieldbtn");
    clear1.setWidth("20px");
    clear1.setHeight("20px");
    //        insertProteinsLayout.addComponent(clear1, 0, 2);
    hlo1.setComponentAlignment(clear1, Alignment.MIDDLE_RIGHT);
    clear1.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            highTextArea.clear();
        }
    });

    VerticalLayout clear2 = new VerticalLayout();
    hlo2.addComponent(clear2);
    clear2.setDescription("Clear field");
    clear2.setStyleName("clearfieldbtn");
    clear2.setWidth("20px");
    clear2.setHeight("20px");

    clear2.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            stableTextArea.clear();
        }
    });

    hlo2.setComponentAlignment(clear2, Alignment.MIDDLE_RIGHT);
    VerticalLayout clear3 = new VerticalLayout();
    hlo3.addComponent(clear3);
    clear3.setDescription("Clear field");
    clear3.setStyleName("clearfieldbtn");
    clear3.setWidth("20px");
    clear3.setHeight("20px");

    clear3.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            lowTextArea.clear();
        }
    });
    hlo3.setComponentAlignment(clear3, Alignment.MIDDLE_RIGHT);
    Label errorLabel = new Label();
    proteinsDataCapturingMainLayout.addComponent(errorLabel);
    HorizontalLayout btnsLayout = new HorizontalLayout();
    btnsLayout.setSpacing(true);
    btnsLayout.setMargin(new MarginInfo(true, false, false, false));

    proteinsDataCapturingMainLayout.addComponent(btnsLayout);
    proteinsDataCapturingMainLayout.setComponentAlignment(btnsLayout, Alignment.MIDDLE_RIGHT);

    Button sampleBtn = new Button("Sample");
    sampleBtn.setStyleName(Reindeer.BUTTON_SMALL);
    btnsLayout.addComponent(sampleBtn);
    sampleBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            reset();
            highTextArea.setValue(highAcc);
            lowTextArea.setValue(lowAcc);
            stableTextArea.setValue(stableAcc);
            diseaseGroupsListA.select("Group A");
            diseaseGroupsListB.select("Group B");
            compareBtn.focus();
        }
    });

    Button resetBtn = new Button("Reset");
    resetBtn.setStyleName(Reindeer.BUTTON_SMALL);
    btnsLayout.addComponent(resetBtn);
    resetBtn.setId("resetBtn");
    resetBtn.addClickListener(this);

    compareBtn = new Button("Compare");
    compareBtn.setStyleName(Reindeer.BUTTON_SMALL);
    btnsLayout.addComponent(compareBtn);
    compareBtn.setId("compareBtn");
    compareBtn.addClickListener(this);

    //        highTextArea.setValue(highAcc);
    //        lowTextArea.setValue(lowAcc);
    //        stableTextArea.setValue(stableAcc);

    return proteinsDataCapturingMainLayout;
}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java

public ComparisonsSelectionOverviewBubbleChart(final QuantCentralManager Quant_Central_Manager,
        final CSFPRHandler CSFPR_Handler, int chartWidth, int chartHeight,
        Set<QuantDiseaseGroupsComparison> selectedComparisonList,
        List<QuantProtein> searchQuantificationProtList) {

    userDataCounter = 0;/*w  w w . jav  a 2 s . co m*/
    this.searchQuantificationProtList = searchQuantificationProtList;
    Map<String, String> diseaseHashedColorMap = Quant_Central_Manager.getDiseaseHashedColorMap();
    for (String str : diseaseHashedColorMap.keySet()) {
        diseaseColorMap.put(str, Color.decode(diseaseHashedColorMap.get(str)));
    }
    this.width = chartWidth;
    this.height = 600;
    this.CSFPR_Handler = CSFPR_Handler;
    this.setWidth(width + "px");
    this.setHeightUndefined();
    this.Quant_Central_Manager = Quant_Central_Manager;
    this.Quant_Central_Manager.registerStudySelectionListener(ComparisonsSelectionOverviewBubbleChart.this);
    this.setSpacing(true);

    //init toplayout
    topLayout.setHeight(30 + "px");
    topLayout.setSpacing(true);
    topLayout.setMargin(new MarginInfo(false, false, true, false));
    this.addComponent(topLayout);

    Label overviewLabel = new Label("<font style='margin-left :50px;'>Overview</font> ");
    overviewLabel.setContentMode(ContentMode.HTML);
    topLayout.addComponent(overviewLabel);
    overviewLabel.setStyleName("subtitle");
    overviewLabel.setWidth("120px");

    InfoPopupBtn info = new InfoPopupBtn(
            "The bubble chart give an overview for the proteins existed in the selected comparisons.<br/>The diameter of the bubble represents the number of the proteins in the selected comparison and the color represents the trend<br/>");
    info.setWidth("16px");
    info.setHeight("16px");
    topLayout.addComponent(info);
    this.topLayout.setVisible(false);

    //end of toplayout
    //init chartlayout
    this.chartLayoutContainer.setVisible(false);
    this.addComponent(chartLayoutContainer);
    chartLayoutContainer.setWidth(width + "px");
    chartLayoutContainer.setHeight(height + "px");

    chartLayoutContainer.addComponent(chartImage, "left: " + 0 + "px; top: " + 0 + "px;");
    chartLayoutContainer.addComponent(chartLayout, "left: " + 0 + "px; top: " + 0 + "px;");
    chartLayout.setWidth(width + "px");
    chartLayout.setHeight(height + "px");
    chartLayout.addLayoutClickListener(ComparisonsSelectionOverviewBubbleChart.this);

    //end of chartlayout
    //init bottomlayout 
    bottomLayout.setWidth("100%");
    this.addComponent(bottomLayout);
    this.setComponentAlignment(bottomLayout, Alignment.BOTTOM_RIGHT);
    bottomLayout.setVisible(false);
    HorizontalLayout btnContainerLayout = new HorizontalLayout();
    btnContainerLayout.setSpacing(true);
    //        btnContainerLayout.setMargin(new MarginInfo(false, false, false, false));
    btnContainerLayout.setWidthUndefined();
    btnContainerLayout.setHeightUndefined();
    //        btnContainerLayout.addStyleName("leftspacer");
    bottomLayout.addComponent(btnContainerLayout);
    bottomLayout.setComponentAlignment(btnContainerLayout, Alignment.TOP_RIGHT);

    TrendLegend legendLayout = new TrendLegend("bubblechart");
    legendLayout.setWidthUndefined();
    legendLayout.setHeight("24px");
    btnContainerLayout.addComponent(legendLayout);
    btnContainerLayout.setComponentAlignment(legendLayout, Alignment.TOP_RIGHT);
    //        btnContainerLayout.setExpandRatio(legendLayout, 600);
    //        btnContainerLayout.setExpandRatio(btnContainerLayout, 210);

    //         VerticalLayout stableBtnWrapper = new VerticalLayout();
    ////        stableBtnWrapper.setWidth("64px");
    //        HorizontalLayout stableBtn = new HorizontalLayout();
    //        stableBtnWrapper.addComponent(stableBtn);
    //        stableBtnWrapper.setComponentAlignment(stableBtn, Alignment.TOP_LEFT);
    //        btnContainerLayout.addComponent(stableBtnWrapper);
    groupSwichBtn = new GroupSwichBtn(Quant_Central_Manager, searchQuantificationProtList);
    btnContainerLayout.addComponent(groupSwichBtn);

    final VerticalLayout appliedIcon = new VerticalLayout();
    appliedIcon.setStyleName("appliedicon");
    appliedIcon.setWidth("24px");
    appliedIcon.setHeight("24px");
    appliedIcon.setDescription("Hide stable proteins");
    btnContainerLayout.addComponent(appliedIcon);
    //        stableBtn.setStyleName("stablebtn");
    //        stableBtn.setHeight("24px");
    //        Label stableLabel = new Label("Equal");
    //        stableLabel.setWidth("44px");
    //        stableBtn.addComponent(stableLabel);

    appliedIcon.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {
        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (appliedIcon.getStyleName().equalsIgnoreCase("appliedicon")) {
                appliedIcon.setStyleName("unappliedicon");
                Quant_Central_Manager.updateSignificantOnlySelection(true);
                appliedIcon.setDescription("Show stable proteins");
            } else {
                appliedIcon.setStyleName("appliedicon");
                Quant_Central_Manager.updateSignificantOnlySelection(false);
                appliedIcon.setDescription("Hide stable proteins");
            }
        }
    });

    exportPdfBtn = new Button("");
    exportPdfBtn.setWidth("24px");
    exportPdfBtn.setHeight("24px");
    exportPdfBtn.setPrimaryStyleName("exportpdfbtn");
    exportPdfBtn.setDescription("Export chart image");
    StreamResource myResource = createResource();
    FileDownloader fileDownloader = new FileDownloader(myResource);
    fileDownloader.extend(exportPdfBtn);
    btnContainerLayout.addComponent(exportPdfBtn);

    VerticalLayout unselectAllBtn = new VerticalLayout();
    unselectAllBtn.setStyleName("unselectallbtn");
    btnContainerLayout.addComponent(unselectAllBtn);
    btnContainerLayout.setComponentAlignment(unselectAllBtn, Alignment.TOP_LEFT);
    unselectAllBtn.setDescription("Clear selection");
    unselectAllBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            Quant_Central_Manager.setBubbleChartQuantProteinsSelection(new HashSet<String>(), "");
            resetChart();

        }
    });

    final VerticalLayout selectMultiBtn = new VerticalLayout();
    selectMultiBtn.setStyleName("selectmultiselectedbtn");
    btnContainerLayout.addComponent(selectMultiBtn);
    btnContainerLayout.setComponentAlignment(selectMultiBtn, Alignment.TOP_LEFT);
    selectMultiBtn.setDescription("Multiple selection");
    activeMultiSelect = true;
    selectMultiBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (selectMultiBtn.getStyleName().equalsIgnoreCase("selectmultiselectedbtn")) {
                selectMultiBtn.setStyleName("selectmultibtn");
                activeMultiSelect = false;

            } else {
                selectMultiBtn.setStyleName("selectmultiselectedbtn");
                activeMultiSelect = true;

            }
        }
    });

    //end of btns layout
    //init empty layout
    emptySelectionLayout = new VerticalLayout();
    this.addComponent(emptySelectionLayout);
    emptySelectionLayout.setWidth(100 + "%");
    emptySelectionLayout.setHeightUndefined();

    VerticalLayout spacer = new VerticalLayout();
    spacer.setHeight("100px");
    spacer.setWidth("10px");
    spacer.setStyleName(Reindeer.LAYOUT_WHITE);
    emptySelectionLayout.addComponent(spacer);
    emptySelectionLayout.setComponentAlignment(spacer, Alignment.BOTTOM_RIGHT);

    Label startLabel = new Label(
            "<center><h2 style='color:gray;'><b>Select comparison from the table</b></h2></center>");
    startLabel.setContentMode(ContentMode.HTML);

    emptySelectionLayout.addComponent(startLabel);
    emptySelectionLayout.setComponentAlignment(startLabel, Alignment.MIDDLE_CENTER);

    Image handleft = new Image();
    handleft.setSource(new ThemeResource("img/handleft.png"));
    emptySelectionLayout.addComponent(handleft);
    emptySelectionLayout.setComponentAlignment(handleft, Alignment.MIDDLE_CENTER);

    //init bubble chart
}