Example usage for com.vaadin.ui HorizontalLayout setStyleName

List of usage examples for com.vaadin.ui HorizontalLayout setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:org.vaadin.tori.view.thread.newthread.NewThreadViewImpl.java

License:Apache License

private Component buildTopicLayout() {
    VerticalLayout result = new VerticalLayout();

    final HorizontalLayout topicLayout = new HorizontalLayout();
    topicLayout.setWidth(100.0f, Unit.PERCENTAGE);
    topicLayout.setMargin(new MarginInfo(true, true, false, true));
    topicLayout.setStyleName("newthreadtopic");

    topicField = new TextField();

    topicField.setStyleName("topicfield");
    topicField.setInputPrompt("Write your topic title here...");
    topicField.setWidth(100.0f, Unit.PERCENTAGE);
    topicField.setHeight(48.0f, Unit.PIXELS);
    topicLayout.addComponent(topicField);
    topicLayout.setExpandRatio(topicField, 1.0f);

    result.addComponent(topicLayout);//from   www.  j a  v  a  2  s.  c o m

    return result;
}

From source file:pl.exsio.frameset.vaadin.ui.support.component.data.common.DataComponent.java

License:Open Source License

private HorizontalLayout createControls() {
    HorizontalLayout controls = new HorizontalLayout() {
        {/*from  ww  w. j  a va2  s.c  o  m*/
            editButton.setEnabled(false);
            deleteButton.setEnabled(false);
            this.addComponent(addButton);
            this.addComponent(editButton);
            this.addComponent(deleteButton);
        }
    };
    controls.setStyleName("frameset-dc-controls");
    controls.setSpacing(true);
    controls.setMargin(new MarginInfo(true, false, false, false));
    return controls;
}

From source file:pl.exsio.frameset.vaadin.ui.support.component.data.common.DataComponent.java

License:Open Source License

private HorizontalLayout createFormControls(final I item, final F form, final C container,
        final Window formWindow, final int mode) {
    Button save = this.createFormSaveButton(item, form, container, formWindow, mode);
    Button cancel = this.createFormCancelButton(formWindow);
    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);// w  w w. ja  v a  2s  . c om
    controls.setStyleName("frameset-dc-form-controls");
    controls.setMargin(new MarginInfo(false, false, true, true));
    save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE);
    controls.addComponent(save);
    controls.addComponent(cancel);
    return controls;
}

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

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

    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    this.addComponent(resultsLayout);
}

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

/**
 *
 * @param Quant_Central_Manager/*from  ww w .  j a  v  a2 s.  co 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.popupreordergroups.SortableLayoutContainer.java

public SortableLayoutContainer(int w, int subH, final String strTitle, Set<String> labels,
        Map<String, String> diseaseStyleMap) {
    this.diseaseStyleMap = diseaseStyleMap;

    this.setStyleName(Reindeer.LAYOUT_WHITE);
    this.setSpacing(true);
    this.strTitle = strTitle;
    this.groupSelectionMap = new HashMap<String, Boolean>();
    this.selectionSet = new LinkedHashSet<String>();
    //        this.fullSelectionSet = new LinkedHashSet<String>();
    HorizontalLayout headerLayoutI = new HorizontalLayout();
    Label titileI = new Label(strTitle);
    titileI.setStyleName("custLabel");
    headerLayoutI.addComponent(titileI);
    this.addComponent(headerLayoutI);
    int containerWidth = ((w) / 2) - 20;

    this.setWidth(containerWidth + "px");
    int height = subH - 15;
    headerLayoutI.setWidth(containerWidth + "px");

    clearBtn = new Button("Clear");
    clearBtn.setStyleName(Reindeer.BUTTON_LINK);
    clearBtn.setWidth("40px");
    clearBtn.setHeight("18px");
    clearBtn.setEnabled(false);//from  w  w  w .  j  ava  2  s.  c  om
    headerLayoutI.addComponent(clearBtn);
    headerLayoutI.setComponentAlignment(clearBtn, Alignment.TOP_RIGHT);
    clearBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            //                autoClear = true;
            singleSelected = false;
            diseaseGroupSelectOption.setValue(null);

        }
    });

    Panel bodyPanel = new Panel();
    HorizontalLayout bodyLayout = new HorizontalLayout();
    bodyLayout.setStyleName(Reindeer.LAYOUT_WHITE);
    bodyPanel.setContent(bodyLayout);
    this.addComponent(bodyPanel);
    bodyPanel.setHeight(subH + "px");
    bodyPanel.setWidth((containerWidth) + "px");

    counterLayoutContainer = new VerticalLayout();
    bodyLayout.addComponent(counterLayoutContainer);
    counterLayoutContainer.setHeight(height + "px");
    counterLayoutContainer.setWidth("30px");
    counterLayoutContainer.setStyleName(Reindeer.LAYOUT_WHITE);

    counterLayout = new VerticalLayout();
    counterLayoutContainer.addComponent(counterLayout);
    counterLayout.setWidth("30px");
    counterLayout.setSpacing(false);
    counterLayout.setStyleName("countcontainer");

    int sortableItremWidth = containerWidth - 26 - 6 - 15;
    sortableDiseaseGroupLayout = new SortableLayout();
    bodyLayout.addComponent(sortableDiseaseGroupLayout);
    sortableDiseaseGroupLayout.setWidth(sortableItremWidth + "px");

    sortableDiseaseGroupLayout.setData(strTitle);
    sortableDiseaseGroupLayout.addStyleName("no-horizontal-drag-hints");

    checkboxLayout = new VerticalLayout();
    bodyLayout.addComponent(checkboxLayout);

    checkboxLayout.setSpacing(false);
    checkboxLayout.setEnabled(false);
    checkboxLayout.setHeight(height + "px");
    checkboxLayout.setStyleName("countcontainer");
    checkboxLayout.setMargin(new MarginInfo(false, false, false, false));

    diseaseGroupSelectOption = new OptionGroup();
    checkboxLayout.addComponent(diseaseGroupSelectOption);
    checkboxLayout.setComponentAlignment(diseaseGroupSelectOption, Alignment.TOP_LEFT);
    //        diseaseGroupSelectOption.setWidth("20px");
    diseaseGroupSelectOption.setNullSelectionAllowed(true); // user can not 'unselect'
    diseaseGroupSelectOption.setMultiSelect(true);
    diseaseGroupSelectOption.addStyleName("sortablelayoutselect");
    diseaseGroupSelectOption.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (autoClear) {
                autoClear = false;
                return;
            }
            for (String key : groupSelectionMap.keySet()) {
                groupSelectionMap.put(key, Boolean.FALSE);
            }
            getSelectionSet().clear();
            singleSelected = false;
            int counter = 0;
            for (Object key : ((Set) diseaseGroupSelectOption.getValue())) {
                if (((Integer) key) >= groupsIds.size()) {
                    continue;
                }
                groupSelectionMap.put(groupsIds.get((Integer) key), Boolean.TRUE);
                singleSelected = true;
                counter++;
                getSelectionSet().add(groupsIds.get((Integer) key));
            }
            if (counter == groupsIds.size()) {
                singleSelected = false;
            }

        }

    });

    itemWidth = sortableItremWidth - 10;
    initLists(labels);
}

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 www.j av  a2  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);

        }
    });

}

From source file:probe.com.view.body.quantdatasetsoverview.quantproteinstabsheet.peptidescontainer.PeptidesOverviewPanel.java

/**
 *
 * @param width//from  www . j  a  va 2 s .com
 * @param height
 */
public PeptidesOverviewPanel(int width, int height) {
    this.setWidth(width + "px");
    this.setHeight(height + "px");
    this.setStyleName(Reindeer.LAYOUT_BLUE);
    this.setMargin(true);

    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setHeight("20px");
    topLayout.setWidth((width) + "px");
    topLayout.setStyleName(Reindeer.LAYOUT_WHITE);
    topLayout.setMargin(false);
    this.addComponent(topLayout);

    authorLabel = new Label();
    topLayout.addComponent(authorLabel);
    topLayout.setComponentAlignment(authorLabel, Alignment.TOP_LEFT);
    authorLabel.setStyleName("filterShowLabel");

    peptidesChartLayout = new AbsoluteLayout();
    peptidesChartLayout.setWidth(width + "px");
    peptidesChartLayout.setHeight((height - 20) + "px");

}

From source file:uk.co.intec.keyDatesApp.components.HeaderComponent.java

License:Apache License

/**
 * Constructor, passing the Vaadin application page
 *
 * @param ui/*from ww w  . ja  va2 s . c  om*/
 *            MainUI application page
 */
public HeaderComponent(MainUI ui) {
    setHeight("50px");
    setStyleName("header");

    final HorizontalLayout bannerArea = new HorizontalLayout();
    bannerArea.setStyleName("menuArea");
    bannerArea.setSizeFull();

    final ThemeResource resource = new ThemeResource("img/intec-logo.gif.png");
    final Image bannerImg = new Image();
    bannerImg.setAlternateText("Intec");
    bannerImg.setHeight("50px");
    bannerImg.setDescription("Intec Logo");
    bannerImg.setSource(resource);
    bannerImg.setWidth(null);
    bannerImg.setStyleName("bannerImg");

    setMenubar(new MenuBar());
    getMenubar().setStyleName(ValoTheme.MENU_SUBTITLE);
    getMenubar().addStyleName("valo-menu-subtitle-indent");
    getMenubar().setWidth(100, Unit.PERCENTAGE);

    if (!"Anonymous".equals(getUserName())) {
        final MenuItem logout = menubar.addItem("Logout", null);
        logout.setStyleName("menuRight");
    }

    final MenuItem userItem = menubar.addItem(getUserName(), null);
    userItem.setStyleName("menuRight");

    bannerArea.addComponents(bannerImg, menubar);
    bannerArea.setExpandRatio(menubar, 1);
    addComponent(bannerArea);
    setExpandRatio(bannerArea, 1);
    setSizeFull();
}

From source file:VaadinIRC.GUI.channelGUI.java

License:Open Source License

/**
 * Creates the GUI for a channel./*from www. j  a v a 2  s.co  m*/
 */
public void createChannelGUI() {
    panel = new Panel();
    panel.setCaption(channelName);
    panel.setSizeFull();
    panel.getContent().setSizeFull();
    AbstractLayout panelLayout = (AbstractLayout) panel.getContent();
    panelLayout.setMargin(false);
    panel.setImmediate(true);
    labelTitle.setValue("<b>" + channelName + "</b>");

    VerticalLayout mainVerticalLayout = new VerticalLayout();
    mainVerticalLayout.setSizeFull();
    // Top bar containing channel title & topright buttons
    GridLayout topGrid = new GridLayout(2, 1);
    topGrid.setStyleName("topBar");
    topGrid.addComponent(labelTitle);
    topGrid.setSizeFull();
    labelTitle.setSizeFull();
    HorizontalLayout hori = new HorizontalLayout();
    hori.setStyleName("rightTopBar");
    hori.setWidth(100, Sizeable.UNITS_PIXELS);
    hori.addComponent(buttonSettings);
    hori.addComponent(buttonChangeNick);
    hori.addComponent(buttonRefreshUsernames);
    topGrid.addComponent(hori);
    topGrid.setComponentAlignment(hori, Alignment.TOP_RIGHT);
    mainVerticalLayout.addComponent(topGrid);
    mainVerticalLayout.setExpandRatio(topGrid, 0.05f);
    // Message area & table of nicknames
    HorizontalLayout horizontal = new HorizontalLayout();
    horizontal.setSpacing(false);
    horizontal.setMargin(false);
    horizontal.setSizeFull();
    horizontal.addComponent(panelMessages);
    mainVerticalLayout.addComponent(horizontal);
    mainVerticalLayout.setExpandRatio(horizontal, 0.90f);
    if (channelName.startsWith("#")) {
        horizontal.addComponent(tableNicknames);
        horizontal.setExpandRatio(panelMessages, 0.8f);
        horizontal.setExpandRatio(tableNicknames, 0.2f);
    }
    // Send message textfield & send button
    HorizontalLayout bottomBar = new HorizontalLayout();
    //bottomBar.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    bottomBar.setSizeFull();
    //bottomBar.setSpacing(true);
    //bottomBar.setMargin(true, false, false, false);
    bottomBar.addComponent(textfieldMessagefield);
    bottomBar.addComponent(buttonSendMessage);
    bottomBar.setExpandRatio(textfieldMessagefield, 1f);
    bottomBar.setExpandRatio(buttonSendMessage, 0f);
    mainVerticalLayout.addComponent(bottomBar);
    mainVerticalLayout.setExpandRatio(bottomBar, 0.05f);

    horizontal.setImmediate(true);
    panelMessages.setImmediate(true);
    tableNicknames.setImmediate(true);
    textfieldMessagefield.setImmediate(true);
    tableNicknames.addContainerProperty("Rights", String.class, null);
    tableNicknames.addContainerProperty("Nicknames", String.class, null);
    tableNicknames.setSelectable(true);

    textfieldMessagefield.focus();

    //mainVerticalLayout.setSizeFull();
    panel.addComponent(mainVerticalLayout);
}