Example usage for com.vaadin.ui VerticalLayout setWidth

List of usage examples for com.vaadin.ui VerticalLayout setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:org.vaadin.tori.view.thread.ReportComponent.java

License:Apache License

private Component newReportLayout() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setWidth("260px");
    layout.setSpacing(true);/*  ww  w . j  a v a 2s .  c o m*/
    layout.setMargin(true);

    layout.addComponent(new Label("What's wrong with this post?"));

    final OptionGroup reason = new OptionGroup();
    reason.addItem(Reason.SPAM);
    reason.setItemCaption(Reason.SPAM, "Spam");
    reason.addItem(Reason.OFFENSIVE);
    reason.setItemCaption(Reason.OFFENSIVE, "Offensive, abusive or hateful.");
    reason.addItem(Reason.WRONG_CATEGORY);
    reason.setItemCaption(Reason.WRONG_CATEGORY, "Doesn't belong in the category.");
    reason.addItem(Reason.MODERATOR_ALERT);
    reason.setItemCaption(Reason.MODERATOR_ALERT, "A moderator should take a look at it.");

    reason.setImmediate(true);
    reason.addValueChangeListener(new OptionGroup.ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent event) {
            explanationLayout.setVisible(reason.getValue() == Reason.MODERATOR_ALERT);
            reportButton.setEnabled(reason.getValue() != null);
        }
    });

    layout.addComponent(reason);

    explanationLayout = new CssLayout();
    explanationLayout.setStyleName("explanationlayout");
    explanationLayout.addComponent(new Label("Here's why:"));
    final TextArea reasonText = createReasonTextArea();
    explanationLayout.addComponent(reasonText);
    explanationLayout.setVisible(false);
    explanationLayout.setWidth("100%");
    layout.addComponent(explanationLayout);

    final HorizontalLayout footer = new HorizontalLayout();
    footer.setSpacing(true);
    layout.addComponent(footer);
    layout.setComponentAlignment(footer, Alignment.BOTTOM_RIGHT);

    reportButton = new Button("Report Post");
    reportButton.addClickListener(new NativeButton.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            final URI l = Page.getCurrent().getLocation();
            final String link = l.getScheme() + "://" + l.getAuthority() + l.getPath() + postPermalink;
            presenter.handlePostReport(post, (Reason) reason.getValue(), reasonText.getValue(), link);
            reportPopup.setPopupVisible(false);
        }
    });
    reportButton.setEnabled(false);
    footer.addComponent(reportButton);

    final Button cancel = ComponentUtil.getSecondaryButton("Cancel", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            reportPopup.setPopupVisible(false);
        }
    });
    footer.addComponent(cancel);

    return layout;
}

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

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  .java 2s.  co 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);/* w w w. j a va 2  s. c o m*/

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

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,
        QuantDiseaseGroupsComparison userCustomizedComparison) {
    this.userCustomizedComparison = userCustomizedComparison;
    userDataCounter = 1;//from  w ww  .j a va2s  .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);

    //end of toplayout
    //init chartlayout
    this.chartLayoutContainer.setVisible(false);
    this.addComponent(chartLayoutContainer);

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

    Quant_Central_Manager.insertNoftfication("Quantitative Datasets",
            "Remeber you can flip the disease group comparisons using (Swich disease groups button)<img src='VAADIN/themes/dario-theme/img/flip-v-updated.png' height='25px' width='25' alt='Reorder and select' Align='center'/> ",
            width, width, "flipnotification");

    //        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(width + "px");
    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);

}

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

/**
 *
 * @param Quant_Central_Manager/* ww  w.j  a v  a  2 s. co m*/
 */
public DiseaseGroupsListFilter(final QuantCentralManager Quant_Central_Manager) {
    this.Quant_Central_Manager = Quant_Central_Manager;
    this.setWidth("450px");
    //        this.Quant_Central_Manager.registerFilterListener(DiseaseGroupsListFilter.this);

    //        this.updatePatientGroups(Quant_Central_Manager.getFilteredDatasetsList());
    //        String[] pgArr = merge(patGr1, patGr2);
    this.patientGroupIFilter = new ListSelectDatasetExplorerFilter(1, "Disease Group I",
            Quant_Central_Manager.getSelectedHeatMapRows());
    initGroupsIFilter();

    this.patientGroupIIFilter = new ListSelectDatasetExplorerFilter(2, "Disease Group II",
            Quant_Central_Manager.getSelectedHeatMapColumns());
    initGroupsIIFilter();
    diseaseGroupsSet = new LinkedHashSet<String>();
    diseaseGroupsSet.addAll(Quant_Central_Manager.getSelectedHeatMapRows());

    this.addComponent(patientGroupIIFilter);

    diseaseGroupsFilterBtn = new Button("Disease Groups");
    diseaseGroupsFilterBtn.setStyleName(Reindeer.BUTTON_LINK);
    diseaseGroupsFilterBtn.addClickListener(DiseaseGroupsListFilter.this);

    VerticalLayout popupBody = new VerticalLayout();

    VerticalLayout filtersConatinerLayout = new VerticalLayout();
    filtersConatinerLayout.setSpacing(true);
    filtersConatinerLayout.setWidth("500px");
    filtersConatinerLayout.setHeightUndefined();

    popupBody.addComponent(filtersConatinerLayout);

    HorizontalLayout btnLayout = new HorizontalLayout();
    popupBody.addComponent(btnLayout);
    btnLayout.setSpacing(true);
    btnLayout.setMargin(new MarginInfo(false, false, true, true));

    Button applyFilters = new Button("Apply");
    applyFilters.setDescription("Apply the selected filters");
    applyFilters.setPrimaryStyleName("resetbtn");
    applyFilters.setWidth("50px");
    applyFilters.setHeight("24px");

    btnLayout.addComponent(applyFilters);
    applyFilters.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            popupWindow.close();
        }
    });

    Button resetFiltersBtn = new Button("Reset");
    resetFiltersBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetFiltersBtn);
    resetFiltersBtn.setWidth("50px");
    resetFiltersBtn.setHeight("24px");

    resetFiltersBtn.setDescription("Reset all applied filters");
    resetFiltersBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Quant_Central_Manager.resetFiltersListener();
        }
    });

    popupWindow = new Window() {
        @Override
        public void close() {
            if (updateManager) {
                updateSelectionManager(studiesIndexes);
            }

            popupWindow.setVisible(false);

        }
    };
    popupWindow.setContent(popupBody);
    popupWindow.setWindowMode(WindowMode.NORMAL);
    popupWindow.setWidth((540) + "px");
    popupWindow.setHeight((500) + "px");
    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setClosable(false);
    popupWindow.setStyleName(Reindeer.WINDOW_LIGHT);
    popupWindow.setModal(true);
    popupWindow.setDraggable(false);
    popupWindow.center();
    popupWindow.setCaption(
            "<font color='gray' style='font-weight: bold;!important'>&nbsp;&nbsp;Disease Groups Comparisons</font>");

    UI.getCurrent().addWindow(popupWindow);
    popupWindow.center();

    popupWindow.setCaptionAsHtml(true);
    popupWindow.setClosable(true);

    this.setHeightUndefined();
    filtersConatinerLayout.addComponent(DiseaseGroupsListFilter.this);
    filtersConatinerLayout.setComponentAlignment(DiseaseGroupsListFilter.this, Alignment.BOTTOM_CENTER);
    //        Quant_Central_Manager.setSelectedHeatMapRows(selectedRows);
    //        Quant_Central_Manager.setSelectedHeatMapColumns(selectedColumns);

}

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

private VerticalLayout swichIconGenerator() {

    VerticalLayout switchBtn = new VerticalLayout();
    switchBtn.setStyleName("switchbtn");
    switchBtn.setWidth("50px");
    switchBtn.setHeight("25px");
    return switchBtn;

}

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

private VerticalLayout initDiseaseGroupLabel(String dName, int itemsNumb, boolean row) {
    VerticalLayout diseaseLabelContainer = new VerticalLayout();

    Label label = new Label("<center><font  color='#ffffff'>"
            + dName.replace("_", " ").replace("-", "'").replace("Disease", "") + "</font></center>");
    label.setContentMode(ContentMode.HTML);

    if (row) {// w  w  w .j a v a2s .  c o m
        diseaseLabelContainer.setHeight((itemsNumb * heatmapCellWidth) + "px");
        diseaseLabelContainer.setWidth("20px");
        VerticalLayout rotateContainer = new VerticalLayout();

        rotateContainer.setWidth((itemsNumb * heatmapCellWidth) + "px");
        rotateContainer.setHeight("20px");
        diseaseLabelContainer.addComponent(rotateContainer);

        rotateContainer.setStyleName("row_" + diseaseStyleMap.get(dName));
        rotateContainer.addComponent(label);
    } else {
        diseaseLabelContainer.addComponent(label);
        diseaseLabelContainer.setWidth((itemsNumb * heatmapCellWidth) + "px");
        diseaseLabelContainer.setHeight("20px");
        diseaseLabelContainer.setStyleName(diseaseStyleMap.get(dName));
    }
    diseaseLabelContainer.setDescription(dName.replace("_", " ").replace("-", "'"));

    return diseaseLabelContainer;

}

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

/**
 *
 * @param interactivePieChartFiltersContainerLayout
 *//*w w  w.  j ava 2  s . c  o m*/
public PopupInteractiveDSFiltersLayout(
        final StudiesPieChartFiltersContainerLayout interactivePieChartFiltersContainerLayout) {
    VerticalLayout datasetExplorerFiltersIcon = new VerticalLayout();
    //        datasetExplorerFiltersIcon.setWidth("45px");
    //        datasetExplorerFiltersIcon.setHeight("24px");
    //        Label btnTitle = new Label("Studies");
    //        datasetExplorerFiltersIcon.addComponent(btnTitle);
    datasetExplorerFiltersIcon.setStyleName("studyexplorer");
    datasetExplorerFiltersIcon.setDescription("Dataset expolorer filter");
    this.addComponent(datasetExplorerFiltersIcon);
    this.setComponentAlignment(datasetExplorerFiltersIcon, Alignment.BOTTOM_LEFT);
    datasetExplorerFiltersIcon.addLayoutClickListener(PopupInteractiveDSFiltersLayout.this);
    this.setHeightUndefined();

    int height = Page.getCurrent().getBrowserWindowHeight() - 100;
    int width = Page.getCurrent().getBrowserWindowWidth() - 100;
    VerticalLayout popupBody = new VerticalLayout();
    popupBody.setWidth((width) + "px");
    popupBody.setHeightUndefined();
    popupBody.setStyleName(Reindeer.LAYOUT_WHITE);

    this.interactivePieChartFiltersContainerLayout = interactivePieChartFiltersContainerLayout;
    popupWindow = new Window() {

        @Override
        public void close() {
            interactivePieChartFiltersContainerLayout.updateSelectionManager(true);
            popupWindow.setVisible(false);

        }

    };
    popupWindow.setContent(popupBody);
    popupWindow.setWindowMode(WindowMode.NORMAL);
    popupWindow.setWidth((width + 40) + "px");
    popupWindow.setHeight((height) + "px");
    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setClosable(false);
    popupWindow.setStyleName(Reindeer.WINDOW_LIGHT);
    popupWindow.setModal(true);
    popupWindow.setDraggable(false);
    popupWindow.center();

    popupWindow.setCaption(
            "<font color='gray' style='font-weight: bold;!important'>&nbsp;&nbsp;Dataset Explorer Filters</font>");

    UI.getCurrent().addWindow(popupWindow);
    popupWindow.setPositionX(30);
    popupWindow.setPositionY(40);

    popupWindow.setCaptionAsHtml(true);
    popupWindow.setClosable(true);

    popupBody.setMargin(true);
    popupBody.setSpacing(true);

    popupBody.addComponent(interactivePieChartFiltersContainerLayout);

}