Example usage for com.vaadin.ui Button setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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

/**
 *
 * @param Quant_Central_Manager//from   ww w . j  av a2 s.  c om
 */
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 ww.  j  av  a 2s. co  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 ww  w. ja va  2s  .  c  om*/
 * @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();//  www. j a  v  a 2 s.co  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  v a 2 s  .  c  o 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);

        }
    });

}

From source file:rs.pupin.jpo.esta_ld.EstaLdComponent.java

private void refreshDimensions() {
    // clean everything just in case
    dimLayout.removeAllComponents();/*www  .  ja va  2s .  c o  m*/
    geoDimension = null;
    timeDimension = null;
    measures = null;
    btnGeo = null;
    boxGeo = null;
    dimNames = null;
    dimValues = null;

    if (selectDataSet.getValue() == null)
        return;

    //        VerticalLayout lLayout = new VerticalLayout();
    //        lLayout.setSizeUndefined();
    //        lLayout.setSpacing(true);
    //        lLayout.setDebugId("dim-btn-layout");
    //        dimLayout.addComponent(lLayout);
    //        VerticalLayout rLayout = new VerticalLayout();
    //        rLayout.setSizeUndefined();
    //        rLayout.setSpacing(true);
    //        rLayout.setWidth("100%");
    //        dimLayout.addComponent(rLayout);
    //        dimLayout.setExpandRatio(rLayout, 2.0f);

    final DataSet ds = (DataSet) selectDataSet.getValue();
    measures = ds.getStructure().getMeasures();
    StringBuilder builderMeasures = new StringBuilder();
    StringBuilder builderMeasureNames = new StringBuilder();
    for (Measure m : measures) {
        builderMeasures.append(", '");
        builderMeasures.append(m.getUri());
        builderMeasures.append("'");
        if (m.getLabel() != null) {
            builderMeasureNames.append(", '");
            builderMeasureNames.append(m.getLabel());
            builderMeasureNames.append("'");
        } else {
            builderMeasureNames.append(", undefined");
        }
    }
    builderMeasureNames.replace(0, 2, "[").append("]");
    builderMeasures.replace(0, 2, "javaSetMeasures([");
    builderMeasures.append("], ").append(builderMeasureNames.toString()).append(")");
    getWindow().executeJavaScript(builderMeasures.toString());
    measName = new Button("Measure");
    //        measName.setSizeUndefined();
    //        measName.setWidth("100%");
    measName.setHeight(CONTENT_ELEM_HEIGHT);
    measName.setWidth(CONTENT_ELEM_WIDTH);
    measName.addStyleName("dim-name");
    measName.addStyleName("unselectable");
    measValues = new ComboBox(null, measures);
    measValues.setImmediate(true);
    measValues.setSizeUndefined();
    measValues.setWidth("100%");
    measValues.setHeight(CONTENT_ELEM_HEIGHT);
    measValues.addStyleName("dim-value");
    measValues.setNullSelectionAllowed(false);
    measValues.select(measures.iterator().next());
    measValues.addListener(dimListener);
    //        measValues.addListener(new Property.ValueChangeListener() {
    //            public void valueChange(Property.ValueChangeEvent event) {
    //                Measure m = (Measure)event.getProperty().getValue();
    //                // put measure in
    //            }
    //        });
    int rowIndex = 0;
    int columnIndex = 0;
    dimLayout.addComponent(measName, columnIndex, rowIndex);
    columnIndex++;
    //        dimLayout.setExpandRatio(measName, 2.0f);
    dimLayout.addComponent(measValues, columnIndex, rowIndex, columnIndex + 1, rowIndex);
    columnIndex += 2;
    //        dimLayout.setComponentAlignment(measValues, Alignment.BOTTOM_LEFT);
    LinkedList<Dimension> dimsForShow = new LinkedList<Dimension>();
    for (Dimension dim : ds.getStructure().getDimensions()) {
        if (dim.isGeoDimension())
            geoDimension = dim;
        else if (dim.isTimeDimension()) {
            timeDimension = dim;
            dimsForShow.addFirst(dim);
        } else
            dimsForShow.add(dim);
    }
    dimNames = new Button[dimsForShow.size()];
    dimAggregIndicators = new Label[dimsForShow.size()];
    dimValues = new ComboBox[dimsForShow.size()];
    int i = 0;

    StringBuilder builderPossibleValues = new StringBuilder();
    boolean firstPass = true;

    for (Dimension dim : dimsForShow) {
        // add dimension pick
        // first create a button to represent dimension name
        final Button btnName = new Button(dim.toString());
        //            btnName.setSizeUndefined();
        //            btnName.setWidth("100%");
        btnName.setHeight(CONTENT_ELEM_HEIGHT);
        btnName.setWidth(CONTENT_ELEM_WIDTH);
        btnName.setData(dim);
        btnName.addStyleName("dim-name");
        if (firstPass) {
            btnName.addStyleName("selected");
            firstPass = false;
        }
        btnName.addListener(new Button.ClickListener() {
            public void buttonClick(Button.ClickEvent event) {
                if (btnName.getStyleName().contains("selected")) {
                    btnName.removeStyleName("selected");
                } else {
                    btnName.addStyleName("selected");
                }
                freeDimensionsChanged();
            }
        });
        dimNames[i] = btnName;

        final Label btnAggreg = new Label("<span>&Sigma;</span>", Label.CONTENT_XHTML);
        btnAggreg.setWidth("30px");
        btnAggreg.setHeight(CONTENT_ELEM_HEIGHT);
        btnAggreg.setData(dim);
        btnAggreg.addStyleName("dim-name");
        btnAggreg.addStyleName("dim-aggreg");
        // this will have to go to the layout listener
        //            btnAggreg.addListener(new Button.ClickListener() {
        //                public void buttonClick(Button.ClickEvent event) {
        //                    if (btnAggreg.getStyleName().contains("selected")) {
        //                        btnAggreg.removeStyleName("selected");
        //                    } else {
        //                        btnAggreg.addStyleName("selected");
        //                        aggregDimensionsChanged();
        //                    }
        //                }
        //            });
        dimAggregIndicators[i] = btnAggreg;

        // create a combo box for picking dimension value
        Collection<Value> vals = ds.getValuesForDimension(dim);
        Collection<ValueWrapper> valsWrapped = new LinkedList<ValueWrapper>();
        for (Value v : vals)
            valsWrapped.add(new ValueWrapper(v));
        builderPossibleValues.append(",").append(stringifyCollection(vals));
        ComboBox boxValue = new ComboBox(null, valsWrapped);
        boxValue.setImmediate(true);
        boxValue.setNullSelectionAllowed(false);
        if (valsWrapped.iterator().hasNext())
            boxValue.select(valsWrapped.iterator().next());
        else
            boxValue.setEnabled(false);
        boxValue.setSizeUndefined();
        boxValue.setWidth("100%");
        boxValue.setHeight(CONTENT_ELEM_HEIGHT);
        boxValue.addStyleName("dim-value");
        boxValue.addListener(dimListener);
        dimValues[i] = boxValue;

        // put them in a horizontal layout and add to the view
        //            HorizontalLayout layout = new HorizontalLayout();
        //            layout.setSizeUndefined();
        //            layout.setWidth("100%");
        //            layout.setSpacing(true);
        //            dimLayout.addComponent(layout);
        //            dimLayout.setExpandRatio(layout, 2.0f);
        //            layout.addComponent(btnName);
        //            layout.addComponent(boxValue);
        //            layout.setExpandRatio(boxValue, 2.0f);

        //            lLayout.addComponent(btnName);
        //            lLayout.setExpandRatio(btnName, 2.0f);
        //            rLayout.addComponent(boxValue);
        //            rLayout.setComponentAlignment(boxValue, Alignment.BOTTOM_LEFT);
        dimLayout.addComponent(btnName, columnIndex, rowIndex);
        if (++columnIndex == 6) {
            columnIndex = 0;
            rowIndex++;
            dimLayout.setRows(rowIndex + 1);
        }
        dimLayout.addComponent(btnAggreg, columnIndex, rowIndex);
        if (++columnIndex == 6) {
            columnIndex = 0;
            rowIndex++;
            dimLayout.setRows(rowIndex + 1);
        }
        dimLayout.addComponent(boxValue, columnIndex, rowIndex);
        if (++columnIndex == 6) {
            columnIndex = 0;
            rowIndex++;
            dimLayout.setRows(rowIndex + 1);
        }
        i++;
    }

    if (timeDimension != null)
        getWindow().executeJavaScript("javaSetHasTimeDimension(true)");
    else
        getWindow().executeJavaScript("javaSetHasTimeDimension(false)");

    if (geoDimension != null) {
        btnGeo = new Button(geoDimension.toString());
        //            btnGeo.setSizeUndefined();
        //            btnGeo.setWidth("100%");
        btnGeo.setHeight(CONTENT_ELEM_HEIGHT);
        btnGeo.setWidth(CONTENT_ELEM_WIDTH);
        btnGeo.setData(geoDimension);
        btnGeo.addStyleName("dim-name");
        btnGeo.addStyleName("geo-name");
        btnGeo.addListener(new Button.ClickListener() {
            public void buttonClick(Button.ClickEvent event) {
                if (btnGeo.getStyleName().contains("selected")) {
                    btnGeo.removeStyleName("selected");
                } else {
                    btnGeo.addStyleName("selected");
                }
                freeDimensionsChanged();
            }
        });

        btnAggregGeo = new Label("<span>&Sigma;</span>", Label.CONTENT_XHTML);
        btnAggregGeo.setHeight(CONTENT_ELEM_HEIGHT);
        btnAggregGeo.setData(geoDimension);
        btnAggregGeo.addStyleName("dim-name");
        btnAggregGeo.addStyleName("dim-aggreg");

        StringBuilder builder = new StringBuilder();
        Collection<Value> posVals = ds.getValuesForDimension(geoDimension);
        Collection<ValueWrapper> posValsWrapped = new LinkedList<ValueWrapper>();
        for (Value v : posVals)
            posValsWrapped.add(new ValueWrapper(v));
        Value selectedVal = posVals.iterator().next();
        String selectedValString = "";
        if (selectedVal instanceof URI) {
            selectedValString = "<" + selectedVal.stringValue() + ">";
        } else {
            selectedValString = "\"" + selectedVal.stringValue() + "\"";
            URI dataType = ((Literal) selectedVal).getDatatype();
            if (dataType != null && !dataType.stringValue().contains("string")) {
                selectedValString += "^^<" + dataType.stringValue() + ">";
            }
        }
        builder.append("javaSetGeoAll('").append(geoDimension.getUri());
        builder.append("',").append(stringifyCollection(posVals));
        builder.append(",'").append(selectedValString).append("',true)");
        boxGeo = new ComboBox(null, posValsWrapped);
        boxGeo.setData(posVals);
        boxGeo.setImmediate(true);
        boxGeo.setNullSelectionAllowed(false);
        boxGeo.select(posValsWrapped.iterator().next());
        boxGeo.setSizeUndefined();
        boxGeo.setWidth("100%");
        boxGeo.setHeight(CONTENT_ELEM_HEIGHT);
        boxGeo.addStyleName("geo-value");
        boxGeo.addListener(geoListener);
        //            lLayout.addComponent(btnGeo);
        //            lLayout.setExpandRatio(btnGeo, 2.0f);
        //            rLayout.addComponent(boxGeo);
        //            rLayout.setComponentAlignment(boxGeo, Alignment.BOTTOM_LEFT);
        dimLayout.addComponent(btnGeo, columnIndex, rowIndex);
        columnIndex++;
        dimLayout.addComponent(btnAggregGeo, columnIndex, rowIndex);
        columnIndex++;
        dimLayout.addComponent(boxGeo, columnIndex, rowIndex);
        columnIndex++;

        getWindow().executeJavaScript(builder.toString());
    } else {
        getWindow().executeJavaScript("javaSetGeoAll('',[],'',true)");
    }
    // TODO cover the case where there is more than 1 geo dimension

    builderPossibleValues.replace(0, 1, "javaSetPossibleValues([");
    builderPossibleValues.append("])");
    getWindow().executeJavaScript(builderPossibleValues.toString());
    if (dimsForShow.isEmpty()) {
        if (geoDimension != null)
            getWindow().executeJavaScript("javaSetGeoFree(true)");
        else
            getWindow().executeJavaScript("javaSetGeoFree(false)");
        getWindow().executeJavaScript("javaSetFreeDimensions([], true)");
    } else {
        getWindow().executeJavaScript("javaSetGeoFree(false)");
        getWindow().executeJavaScript("javaSetFreeDimensions([0], true)");
    }
    dimListener.valueChange(null);
    getWindow().executeJavaScript("setTimeout(expandDimNameButtons(),200)");
}

From source file:rs.superb.apps.inventory.components.UI.clients.mol.AccordionMenu.java

private void createTabs(String[] mainMenuItems) {
    for (String mainMenuItem : mainMenuItems) {
        VerticalLayout vl = new VerticalLayout();
        vl.setMargin(true);//from  w ww.  j  a v a 2s.c  o  m
        vl.setSpacing(true);
        vl.setCaption(mainMenuItem);
        addComponent(vl);

        for (Button subMenuButton : mainMenu.get(mainMenuItem)) {
            subMenuButton.setStyleName(BUTTON_STYLE1);
            subMenuButton.setWidth("80%");
            subMenuButton.setHeight("90px");

            vl.addComponent(subMenuButton);
            vl.setComponentAlignment(subMenuButton, Alignment.MIDDLE_CENTER);
        }

        subMenuButtons0.get(0).addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                Window w = new Window("Click" + subMenuButtons0.get(0).getCaption());
                w.setWidth(66, Unit.PERCENTAGE);
                w.setHeight(66, Unit.PERCENTAGE);
                w.center();
                UI.getCurrent().addWindow(w);
            }
        });
        subMenuButtons0.get(1).addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                UI.getCurrent().getNavigator().navigateTo(GodPopis_View.VIEW_ID);
            }
        });
    }
}