Example usage for com.vaadin.ui Button setPrimaryStyleName

List of usage examples for com.vaadin.ui Button setPrimaryStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Button setPrimaryStyleName.

Prototype

@Override
    public void setPrimaryStyleName(String style) 

Source Link

Usage

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  ww w. ja  v a  2s  .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.quantdatasetsoverview.diseasegroupsfilters.DiseaseGroupsListFilter.java

/**
 *
 * @param Quant_Central_Manager/*from w w  w .  ja v a2  s  .  com*/
 */
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

public GroupSwichBtn(final QuantCentralManager Quant_Central_Manager,
        List<QuantProtein> searchQuantificationProtList) {
    this.Quant_Central_Manager = Quant_Central_Manager;
    this.searchQuantificationProtList = searchQuantificationProtList;
    updatedComparisonList = new ArrayList<QuantDiseaseGroupsComparison>();
    this.setWidth("24px");
    this.setHeight("24px");
    this.setDescription("Switch protein groups");
    this.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override//w w  w  .  j  a  va  2 s. c  o  m
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            updateSelectionList();
            popupWindow.setVisible(true);
        }
    });
    this.setStyleName("switchicon");

    popupBody = new VerticalLayout();

    popupBody.setHeightUndefined();
    popupBody.setStyleName(Reindeer.LAYOUT_WHITE);

    popupWindow = new Window() {

        @Override
        public void close() {

            popupWindow.setVisible(false);
            Quant_Central_Manager.setDiseaseGroupsComparisonSelection(
                    new LinkedHashSet<QuantDiseaseGroupsComparison>(updatedComparisonList));
        }

    };
    popupWindow.setCaption(
            "<font color='gray' style='font-weight: bold;!important'>&nbsp;&nbsp;Switch  disease groups</font>");
    popupWindow.setContent(popupBody);
    popupWindow.setWindowMode(WindowMode.NORMAL);

    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setStyleName(Reindeer.WINDOW_LIGHT);
    popupWindow.setModal(true);
    popupWindow.setDraggable(true);

    UI.getCurrent().addWindow(popupWindow);
    //        popupWindow.center();
    //        popupWindow.setPositionX(popupWindow.getPositionX());
    popupWindow.setPositionY(100);

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

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

    //init table
    table = new GridLayout();
    table.setStyleName("switchtable");
    table.setWidth("100%");
    table.setSpacing(true);
    table.setColumns(3);
    table.setRows(1000);
    table.setHeightUndefined();
    table.setHideEmptyRowsAndColumns(true);
    table.setMargin(new MarginInfo(false, false, true, false));

    headerI = new Label("<center><b>Numerator</b></center>");
    headerI.setWidth("100%");
    headerI.setContentMode(ContentMode.HTML);
    headerII = new Label("<center><b>Denominator</b></center>");
    headerII.setContentMode(ContentMode.HTML);
    headerII.setWidth("100%");

    //        comparisonList = new OptionGroup(null);
    //
    //        comparisonList.setMultiSelect(true);
    //        comparisonList.setNullSelectionAllowed(true);
    //        comparisonList.setHtmlContentAllowed(true);
    //        comparisonList.setImmediate(true);
    //        comparisonList.setWidth("80%");
    //        comparisonList.setHeight("80%");
    popupBody.addComponent(table);

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

    //        popupBody.addComponent(applyFilters);
    //        popupBody.setComponentAlignment(applyFilters, Alignment.TOP_RIGHT);
    applyFilters.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            popupWindow.close();
        }
    });
    btnWrapper = new HorizontalLayout();
    btnWrapper.setWidth("100%");
    btnWrapper.setHeight("50px");
    btnWrapper.addComponent(applyFilters);
    btnWrapper.setComponentAlignment(applyFilters, Alignment.BOTTOM_CENTER);

    table.addLayoutClickListener(GroupSwichBtn.this);

}

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

/**
 *
 * @param Quant_Central_Manager/*from   www  . j a v a 2 s  .c  o  m*/
 * @param handler
 */
public StudiesPieChartFiltersContainerLayout(QuantCentralManager Quant_Central_Manager,
        final CSFPRHandler handler) {

    int layoutHeight = Page.getCurrent().getBrowserWindowHeight() - 200;
    int layoutWidth = Page.getCurrent().getBrowserWindowWidth() - 200;
    this.setWidth(layoutWidth + "px");
    this.setHeight(layoutHeight + "px");
    int filterWidth = layoutWidth / 3;
    this.setSpacing(true);
    boolean[] activeFilters = Quant_Central_Manager.getActiveFilters();
    Map<Integer, QuantDatasetObject> quantDatasetArr = Quant_Central_Manager.getFilteredDatasetsList();

    internalSelectionManager = new PieChartsSelectionManager(Quant_Central_Manager);
    if (quantDatasetArr == null) {
        return;
    }
    this.setRows(4);
    this.setColumns(4);
    int colCounter = 0;
    int rowCounter = 0;
    this.chartSet.clear();
    for (int x = 0; x < activeFilters.length; x++) {
        String filterId = "";
        if (activeFilters[x]) {
            Map<String, List<Integer>> dsIndexesMap = new HashMap<String, List<Integer>>();
            //                List<Object> valueSet = new ArrayList<Object>();
            switch (x) {
            case 0:
                //                        filterId = "identifiedProteinsNumber";
                //                        for (QuantDatasetObject pb : quantDatasetArr) {
                //                            if (pb == null) {
                //                                continue;
                //                            }
                //                            int value = pb.getIdentifiedProteinsNumber();
                //                            valueSet.add(value);
                //                        }
                break;

            case 1:
                //                        filterId = "quantifiedProteinsNumber";
                //                        for (QuantDatasetObject pb : quantDatasetArr) {
                //                            if (pb == null) {
                //                                continue;
                //                            }
                //                            int value = pb.getQuantifiedProteinsNumber();
                //                            valueSet.add(value);
                //
                //                        }
                break;

            case 2:
                //                        filterId = "analyticalMethod";
                //                        for (QuantDatasetObject pb : quantDatasetArr.values()) {
                //                            if (pb == null) {
                //                                continue;
                //                            }
                //                            String value = pb.getAnalyticalMethod();
                //                            valueSet.add(value);
                //
                //                        }
                break;

            case 3:
                //                        filterId = "rawDataUrl";
                //                        for (QuantDatasetObject pb : quantDatasetArr.values()) {
                //
                //                            if (pb == null) {
                //                                continue;
                //                            }
                //                            if (!dsIndexesMap.containsKey(pb.getRawDataUrl())) {
                //                                List<Integer> list = new ArrayList<Integer>();
                //                                dsIndexesMap.put(pb.getRawDataUrl(), list);
                //
                //                            }
                //                            List<Integer> list = dsIndexesMap.get(pb.getRawDataUrl());
                //                            list.add(pb.getUniqId());
                //                            dsIndexesMap.put(pb.getRawDataUrl(), list);
                //                            valueSet.add(pb.getRawDataUrl());
                //
                //                        }
                break;
            case 4:

                filterId = "year";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    if (!dsIndexesMap.containsKey(pb.getYear() + "")) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(pb.getYear() + "", list);

                    }
                    List<Integer> list = dsIndexesMap.get(pb.getYear() + "");
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(pb.getYear() + "", list);
                    int value = pb.getYear();
                    //                            valueSet.add(value);
                }
                break;
            case 5:
                filterId = "typeOfStudy";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    if (!dsIndexesMap.containsKey(pb.getTypeOfStudy())) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(pb.getTypeOfStudy(), list);

                    }
                    if (pb.getTypeOfStudy().trim().equalsIgnoreCase("")) {
                        pb.setTypeOfStudy("Not Available");
                    }
                    List<Integer> list = dsIndexesMap.get(pb.getTypeOfStudy());
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(pb.getTypeOfStudy(), list);
                    String value = pb.getTypeOfStudy();
                    //                            valueSet.add(value);
                }
                break;
            case 6:
                filterId = "sampleType";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    if (pb.getSampleType().trim().equalsIgnoreCase("")) {
                        pb.setSampleType("Not Available");
                    }
                    if (!dsIndexesMap.containsKey(pb.getSampleType())) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(pb.getSampleType(), list);

                    }
                    List<Integer> list = dsIndexesMap.get(pb.getSampleType());
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(pb.getSampleType(), list);
                    String value = pb.getSampleType();
                    //                            valueSet.add(value);
                }
                break;
            case 7:
                filterId = "sampleMatching";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    if (pb.getSampleMatching().trim().equalsIgnoreCase("")) {
                        pb.setSampleMatching("Not Available");
                    }
                    if (!dsIndexesMap.containsKey(pb.getSampleMatching())) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(pb.getSampleMatching(), list);

                    }
                    List<Integer> list = dsIndexesMap.get(pb.getSampleMatching());
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(pb.getSampleMatching(), list);

                    String value = pb.getSampleMatching();
                    //                            valueSet.add(value);
                }
                break;
            case 8:
                filterId = "technology";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    String value = pb.getTechnology();
                    if (value == null || value.equalsIgnoreCase("")) {
                        value = "Not Available";
                    }
                    if (!dsIndexesMap.containsKey(value)) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(value, list);

                    }
                    List<Integer> list = dsIndexesMap.get(value);
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(value, list);
                    //                            valueSet.add(value);
                }
                break;
            case 9:

                filterId = "analyticalApproach";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    String value = pb.getAnalyticalApproach();
                    if (value == null || value.trim().equalsIgnoreCase("")) {
                        pb.setAnalyticalApproach("Not Available");
                        value = "Not Available";
                    }
                    if (!dsIndexesMap.containsKey(value)) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(value, list);

                    }
                    List<Integer> list = dsIndexesMap.get(pb.getAnalyticalApproach());
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(value, list);
                    //                            valueSet.add(value);
                }
                break;
            case 10:
                filterId = "enzyme";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    String value = pb.getEnzyme();
                    if (value == null || value.trim().equalsIgnoreCase("")) {
                        value = "Not Available";
                        pb.setEnzyme(value);
                    }
                    if (!dsIndexesMap.containsKey(value)) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(value, list);

                    }
                    List<Integer> list = dsIndexesMap.get(value);
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(value, list);
                    //                            valueSet.add(value);
                }
                break;
            case 11:
                filterId = "shotgunTargeted";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    String value = pb.getShotgunTargeted();
                    if (value == null || value.trim().equalsIgnoreCase("")) {
                        value = "Not Available";
                        pb.setShotgunTargeted(value);
                    }
                    if (!dsIndexesMap.containsKey(value)) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(value, list);

                    }
                    List<Integer> list = dsIndexesMap.get(value);
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(value, list);
                    //                            valueSet.add(value);
                }
                break;

            case 12:
                //                        filterId = "quantificationBasis";
                //                        for (QuantDatasetObject pb : quantDatasetArr.values()) {
                //                            if (pb == null) {
                //                                continue;
                //                            }
                //                            String value = pb.getQuantificationBasis();
                //                            if (value == null || value.trim().equalsIgnoreCase("")) {
                //                                value = "Not Available";
                //                                pb.setQuantificationBasis(value);
                //                            }
                //                            if (!dsIndexesMap.containsKey(value)) {
                //                                List<Integer> list = new ArrayList<Integer>();
                //                                dsIndexesMap.put(value, list);
                //
                //                            }
                //                            List<Integer> list = dsIndexesMap.get(value);
                //                            list.add(pb.getDsKey());
                //                            dsIndexesMap.put(value, list);
                //                            valueSet.add(value);
                //                        }
                break;
            case 13:
                filterId = "quantBasisComment";
                for (QuantDatasetObject pb : quantDatasetArr.values()) {
                    if (pb == null) {
                        continue;
                    }
                    String value = pb.getQuantBasisComment();
                    if (value == null || value.trim().equalsIgnoreCase("")) {
                        value = "Not Available";
                        pb.setQuantBasisComment(value);
                    }
                    if (!dsIndexesMap.containsKey(value)) {
                        List<Integer> list = new ArrayList<Integer>();
                        dsIndexesMap.put(value, list);

                    }
                    List<Integer> list = dsIndexesMap.get(value);
                    list.add(pb.getDsKey());
                    dsIndexesMap.put(value, list);
                    //                            valueSet.add(value);
                }
                break;
            case 14:
                //                        for (QuantDatasetObject pb : QuantDatasetListObject) {
                //                            int value = pb.getQuantifiedProteinsNumber();
                //                            valueSet.add(value);
                //                        }
                break;
            case 15:
                //                        for (QuantDatasetObject pb : QuantDatasetListObject) {
                //                            int value = pb.getPatientsGroup1Number();
                //                            valueSet.add(value);
                //                        }
                break;
            case 16:
                //                        for (QuantDatasetObject pb : QuantDatasetListObject) {
                //                            int value = pb.getPatientsGroup2Number();
                //                            valueSet.add(value);
                //                        }
                break;
            case 17:
                //                        for (QuantDatasetObject pb : QuantDatasetListObject) {
                //                            String value = pb.getNormalizationStrategy();
                //                            valueSet.add(value);
                //                        }
                break;

            }
            //                if (!valueSet.isEmpty()) {
            //do we need valueSet;;
            JfreeDivaPieChartFilter iFilter = new JfreeDivaPieChartFilter(filterId, x, internalSelectionManager,
                    dsIndexesMap, filterWidth);
            chartSet.add(iFilter.getChart());
            //                    fullFilterList.put(filterId, valueSet);
            this.addComponent(iFilter, colCounter++, rowCounter);
            this.setComponentAlignment(iFilter, Alignment.MIDDLE_CENTER);
            if (colCounter == 3) {
                colCounter = 0;
                rowCounter++;
            }
        }

        //            }
    }
    Quant_Central_Manager.setStudiesOverviewPieChart(chartSet);
    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setHeight("23px");
    btnLayout.setWidthUndefined();
    btnLayout.setSpacing(true);
    btnLayout.setStyleName(Reindeer.LAYOUT_WHITE);
    if (colCounter == 3) {
        this.addComponent(btnLayout, 2, ++rowCounter);
    } else {
        this.addComponent(btnLayout, 2, rowCounter);
    }

    this.setComponentAlignment(btnLayout, Alignment.MIDDLE_CENTER);
    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) {
            pieChartFiltersBtn.closePupupWindow();
        }
    });

    //        Button unselectAllBtn = new Button("Unselect All");
    //        unselectAllBtn.setStyleName(Reindeer.BUTTON_SMALL);
    //        btnLayout.addComponent(unselectAllBtn);
    //        unselectAllBtn.addClickListener(new Button.ClickListener() {
    //
    //            @Override
    //            public void buttonClick(Button.ClickEvent event) {
    //
    //                internalSelectionManager.unselectAll();
    //
    //            }
    //        });
    //        
    Button unselectAllBtn = new Button("Clear");
    unselectAllBtn.setPrimaryStyleName("resetbtn");
    unselectAllBtn.setWidth("50px");
    unselectAllBtn.setHeight("24px");
    btnLayout.addComponent(unselectAllBtn);
    btnLayout.setComponentAlignment(unselectAllBtn, Alignment.TOP_LEFT);
    unselectAllBtn.setDescription("Clear All Selections");
    unselectAllBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            internalSelectionManager.unselectAll();
        }
    });

    Button resetFiltersBtn = new Button("Reset");
    resetFiltersBtn.setPrimaryStyleName("resetbtn");
    resetFiltersBtn.setWidth("50px");
    resetFiltersBtn.setHeight("24px");
    btnLayout.addComponent(resetFiltersBtn);
    resetFiltersBtn.setDescription("Reset all applied filters");
    resetFiltersBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            internalSelectionManager.resetToInitState();
            internalSelectionManager.resetCentralSelectionManager();
        }
    });

    Button exportChartsBtn = new Button("");

    exportChartsBtn.setWidth("24px");
    exportChartsBtn.setHeight("24px");
    exportChartsBtn.setPrimaryStyleName("exportpdfbtn");
    btnLayout.addComponent(exportChartsBtn);
    exportChartsBtn.setDescription("Export all charts filters as pdf file");
    //        exportChartsBtn.addClickListener(new Button.ClickListener() {
    //            @Override
    //            public void buttonClick(Button.ClickEvent event) {
    //               String url = handler.exportImgAsPdf(chartSet, "piechart_filters.pdf");
    //                FileResource res = new FileResource(new File(url));
    //                Page.getCurrent().open(res, "_blank", true);
    //            }
    //        });

    StreamResource myResource = createResource(handler);
    FileDownloader fileDownloader = new FileDownloader(myResource);
    fileDownloader.extend(exportChartsBtn);
    pieChartFiltersBtn = new PopupInteractiveDSFiltersLayout(this);
}

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

private void initPopupLayout() {

    int h = 0;//(default_DiseaseCat_DiseaseGroupMap.size() * 33) + 300;
    for (Map<String, String> m : default_DiseaseCat_DiseaseGroupMap.values()) {
        if (h < m.size()) {
            h = m.size();//from www  .java 2s.  c o m
        }
    }
    h = (h * 26) + 200;
    int w = 700;
    if (Page.getCurrent().getBrowserWindowHeight() - 280 < h) {
        h = Page.getCurrent().getBrowserWindowHeight() - 280;
    }
    if (Page.getCurrent().getBrowserWindowWidth() < w) {
        w = Page.getCurrent().getBrowserWindowWidth();
    }

    popupWindow.setWidth(w + "px");
    popupWindow.setHeight(h + "px");

    popupBodyLayout.setWidth((w - 50) + "px");

    Set<String> diseaseSet = Quant_Central_Manager.getDiseaseCategorySet();

    diseaseTypeSelectionList.setDescription("Select disease category");

    for (String disease : diseaseSet) {
        diseaseTypeSelectionList.addItem(disease);
        diseaseTypeSelectionList.setItemCaption(disease, (disease));

    }

    HorizontalLayout diseaseCategorySelectLayout = new HorizontalLayout();
    diseaseCategorySelectLayout.setWidthUndefined();
    diseaseCategorySelectLayout.setHeight("50px");
    diseaseCategorySelectLayout.setSpacing(true);
    diseaseCategorySelectLayout.setMargin(true);

    popupBodyLayout.addComponent(diseaseCategorySelectLayout);
    popupBodyLayout.setComponentAlignment(diseaseCategorySelectLayout, Alignment.TOP_LEFT);

    Label title = new Label("Disease Category");
    title.setStyleName(Reindeer.LABEL_SMALL);
    diseaseCategorySelectLayout.addComponent(title);

    diseaseCategorySelectLayout.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    diseaseTypeSelectionList.setWidth("200px");
    diseaseTypeSelectionList.setNullSelectionAllowed(false);
    diseaseTypeSelectionList.setValue("All");
    diseaseTypeSelectionList.setImmediate(true);
    diseaseCategorySelectLayout.addComponent(diseaseTypeSelectionList);
    diseaseCategorySelectLayout.setComponentAlignment(diseaseTypeSelectionList, Alignment.TOP_LEFT);
    diseaseTypeSelectionList.setStyleName("diseaseselectionlist");
    diseaseTypeSelectionList.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            boolean showAll = false;
            String value = event.getProperty().getValue().toString();
            if (value.equalsIgnoreCase("All")) {
                showAll = true;
            }
            for (String dName : diseaseGroupsGridLayoutMap.keySet()) {
                if (dName.equalsIgnoreCase(value) || showAll) {
                    diseaseGroupsGridLayoutMap.get(dName).setVisible(true);
                } else {
                    diseaseGroupsGridLayoutMap.get(dName).setVisible(false);
                }
            }

        }
    });

    VerticalLayout diseaseGroupsNamesContainer = new VerticalLayout();
    diseaseGroupsNamesContainer.setWidth("100%");
    diseaseGroupsNamesContainer.setHeightUndefined();
    popupBodyLayout.addComponent(diseaseGroupsNamesContainer);
    diseaseGroupsNamesContainer.setStyleName(Reindeer.LAYOUT_WHITE);
    GridLayout diseaseNamesHeader = new GridLayout(2, 1);
    diseaseNamesHeader.setWidth("100%");
    diseaseNamesHeader.setHeightUndefined();
    diseaseNamesHeader.setSpacing(true);
    diseaseNamesHeader.setMargin(new MarginInfo(true, false, true, false));
    diseaseGroupsNamesContainer.addComponent(diseaseNamesHeader);
    Label col1Label = new Label("Group Name");
    diseaseNamesHeader.addComponent(col1Label, 0, 0);
    col1Label.setStyleName(Reindeer.LABEL_SMALL);

    Label col2Label = new Label("Suggested Name");
    diseaseNamesHeader.addComponent(col2Label, 1, 0);
    col2Label.setStyleName(Reindeer.LABEL_SMALL);

    Panel diseaseGroupsNamesFrame = new Panel();
    diseaseGroupsNamesFrame.setWidth("100%");
    diseaseGroupsNamesFrame.setHeight((h - 200) + "px");
    diseaseGroupsNamesContainer.addComponent(diseaseGroupsNamesFrame);
    diseaseGroupsNamesFrame.setStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout diseaseNamesUpdateContainerLayout = new VerticalLayout();
    for (String diseaseCategory : diseaseSet) {
        if (diseaseCategory.equalsIgnoreCase("All")) {
            continue;
        }

        HorizontalLayout diseaseNamesUpdateContainer = initDiseaseNamesUpdateContainer(diseaseCategory);
        diseaseNamesUpdateContainerLayout.addComponent(diseaseNamesUpdateContainer);
        diseaseGroupsGridLayoutMap.put(diseaseCategory, diseaseNamesUpdateContainer);
    }
    diseaseGroupsNamesFrame.setContent(diseaseNamesUpdateContainerLayout);

    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setMargin(true);
    btnLayout.setSpacing(true);

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

    resetFiltersBtn.setDescription("Reset group names to default");
    resetFiltersBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            resetToDefault();
        }
    });
    Button resetToOriginalBtn = new Button("Publications Names");
    resetToOriginalBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetToOriginalBtn);
    resetToOriginalBtn.setWidth("150px");
    resetToOriginalBtn.setHeight("24px");

    resetToOriginalBtn.setDescription("Reset group names to original publication names");
    resetToOriginalBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            resetToPublicationsNames();
        }
    });

    Button applyFilters = new Button("Update");
    applyFilters.setDescription("Update disease groups with the selected names");
    applyFilters.setPrimaryStyleName("resetbtn");
    applyFilters.setWidth("50px");
    applyFilters.setHeight("24px");

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

        }
    });

    popupBodyLayout.addComponent(btnLayout);
    popupBodyLayout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT);
    resetToDefault();

}

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

private void initPopupBody(int w) {
    HorizontalLayout mainContainer = new HorizontalLayout();
    mainContainer.setStyleName(Reindeer.LAYOUT_WHITE);
    mainContainer.setSpacing(true);//from   w  ww.  j a va  2  s  .co m
    mainContainer.setWidth(w + "px");

    mainContainer.setHeightUndefined();
    mainContainer.setMargin(new MarginInfo(true, false, false, false));

    mainContainer.addComponent(sortableDiseaseGroupI);
    mainContainer.setComponentAlignment(sortableDiseaseGroupI, Alignment.TOP_LEFT);

    mainContainer.addComponent(sortableDiseaseGroupII);
    mainContainer.setComponentAlignment(sortableDiseaseGroupII, Alignment.TOP_RIGHT);

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

        @Override
        public void valueChange(Property.ValueChangeEvent event) {

            if (sortableDiseaseGroupI.isSingleSelected()) {
                sortableDiseaseGroupII.setEnableSelection(true);
            } else {
                sortableDiseaseGroupII.selectAndHideUnselected(null, false);
                //                    sortableDiseaseGroupII.setEnableSelection(false);
                return;
            }

            Set<String> updatedGroupIISet = filterPatGroup2List(sortableDiseaseGroupI.getSelectionSet());
            sortableDiseaseGroupII.selectAndHideUnselected(updatedGroupIISet, false);

        }
    };
    sortableDiseaseGroupI.addSelectionValueChangeListener(selectionChangeListenet);

    popupBodyLayout.addComponent(mainContainer);
    popupBodyLayout.setComponentAlignment(mainContainer, Alignment.TOP_LEFT);

    HorizontalLayout bottomLayout = new HorizontalLayout();
    bottomLayout.setWidth("100%");
    bottomLayout.setMargin(new MarginInfo(true, false, false, false));

    popupBodyLayout.addComponent(bottomLayout);
    int width = w - 200;
    ToggleBtn sortSelectToggleBtn = new ToggleBtn("Sort Groups ", "Select Groups ", "Sort  drag & drop",
            "*Select to filter datasets", width);
    bottomLayout.addComponent(sortSelectToggleBtn);//commentLabel
    bottomLayout.setComponentAlignment(sortSelectToggleBtn, Alignment.MIDDLE_LEFT);//commentLabel
    bottomLayout.setExpandRatio(sortSelectToggleBtn, w);
    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setSpacing(true);
    LayoutEvents.LayoutClickListener toggleListener = new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (event.getComponent().getStyleName().equalsIgnoreCase("toggleleft")) {
                sortableDiseaseGroupI.setLayoutMode("sort");
                sortableDiseaseGroupII.setEnabled(true);
                sortableDiseaseGroupII.setLayoutMode("sort");

            } else {
                sortableDiseaseGroupI.setLayoutMode("select");
                sortableDiseaseGroupII.setEnableSelection(false);
                sortableDiseaseGroupII.setLayoutMode("select");
                if (sortableDiseaseGroupI.isSingleSelected()) {
                    sortableDiseaseGroupII.setEnableSelection(true);
                }

            }

        }
    };
    sortSelectToggleBtn.addLayoutClickListener(toggleListener);

    btnLayout.setWidthUndefined();
    bottomLayout.addComponent(btnLayout);
    bottomLayout.setComponentAlignment(btnLayout, Alignment.TOP_RIGHT);
    bottomLayout.setExpandRatio(btnLayout, 250);
    Button applyFilters = new Button("Apply");
    applyFilters.setDescription("Apply the updates");
    applyFilters.setPrimaryStyleName("resetbtn");
    applyFilters.setWidth("50px");
    applyFilters.setHeight("24px");

    btnLayout.addComponent(applyFilters);
    applyFilters.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            rowHeaders = sortableDiseaseGroupI.getSortedSet();
            colHeaders = sortableDiseaseGroupII.getSortedSet();
            updateSelectionManager(studiesIndexes);
            popupWindow.close();
        }
    });

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

    cancelFiltersBtn.setDescription("Reset all applied filters");
    cancelFiltersBtn.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 groups");
    resetFiltersBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Quant_Central_Manager.resetFiltersListener();
            rowHeaders = Quant_Central_Manager.getSelectedHeatMapRows();
            colHeaders = Quant_Central_Manager.getSelectedHeatMapColumns();
            sortableDiseaseGroupI.initLists(rowHeaders);
            sortableDiseaseGroupII.initLists(colHeaders);

        }
    });

}