Example usage for com.vaadin.ui GridLayout setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:org.lunifera.examples.runtime.web.vaadin.databinding.DatabindingDemoUI.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    VaadinObservables.getRealm(getUI());
    dbc = new DataBindingContext();

    GridLayout layout = new GridLayout(3, 4);
    layout.setStyleName(Reindeer.LAYOUT_BLUE);
    layout.setWidth("100%");
    layout.setMargin(true);/*from   ww w . jav a 2s.  com*/
    setContent(layout);

    row1(layout);
    row2(layout);
    row3(layout);
    row4(layout);
}

From source file:probe.com.view.body.quantdatasetsoverview.quantproteinstabsheet.studies.PeptidesComparisonsSequenceLayout.java

/**
 *
 * @param cp//from  w  w w  .  j ava2s. co  m
 * @param width
 * @param Quant_Central_Manager
 */
public PeptidesComparisonsSequenceLayout(QuantCentralManager Quant_Central_Manager,
        final DiseaseGroupsComparisonsProteinLayout cp, int width) {
    this.studiesMap = new LinkedHashMap<String, StudyInfoData>();
    this.setColumns(4);
    this.setRows(3);
    this.setWidthUndefined();
    this.setSpacing(true);
    this.setMargin(new MarginInfo(true, false, false, false));
    comparisonTitle = new Label();
    comparisonTitle.setContentMode(ContentMode.HTML);
    comparisonTitle.setStyleName("custChartLabelHeader");
    comparisonTitle.setWidth((width - 55) + "px");
    this.addComponent(comparisonTitle, 1, 0);
    this.setComponentAlignment(comparisonTitle, Alignment.TOP_LEFT);

    closeBtn = new VerticalLayout();
    closeBtn.setWidth("20px");
    closeBtn.setHeight("20px");
    closeBtn.setStyleName("closebtn");
    this.addComponent(closeBtn, 2, 0);
    this.setComponentAlignment(closeBtn, Alignment.TOP_RIGHT);
    //end of toplayout
    //init comparison study layout

    GridLayout proteinSequenceComparisonsContainer = new GridLayout(2,
            cp.getComparison().getDatasetIndexes().length);
    proteinSequenceComparisonsContainer.setWidthUndefined();
    proteinSequenceComparisonsContainer.setHeightUndefined();
    proteinSequenceComparisonsContainer.setStyleName(Reindeer.LAYOUT_WHITE);
    proteinSequenceComparisonsContainer.setSpacing(true);
    proteinSequenceComparisonsContainer.setMargin(new MarginInfo(true, false, false, false));
    this.addComponent(proteinSequenceComparisonsContainer, 1, 1);
    coverageWidth = (width - 100 - 180);

    Map<Integer, Set<QuantPeptide>> dsQuantPepMap = new HashMap<Integer, Set<QuantPeptide>>();
    for (QuantPeptide quantPep : cp.getQuantPeptidesList()) {
        if (!dsQuantPepMap.containsKey(quantPep.getDsKey())) {
            Set<QuantPeptide> subList = new HashSet<QuantPeptide>();
            dsQuantPepMap.put(quantPep.getDsKey(), subList);
        }
        Set<QuantPeptide> subList = dsQuantPepMap.get(quantPep.getDsKey());
        subList.add(quantPep);
        dsQuantPepMap.put(quantPep.getDsKey(), subList);
    }

    int numb = 0;

    int panelWidth = Page.getCurrent().getBrowserWindowWidth() - 100;
    String groupCompTitle = cp.getComparison().getComparisonHeader();
    String updatedHeader = groupCompTitle.split(" / ")[0].split("\n")[0] + " / "
            + groupCompTitle.split(" / ")[1].split("\n")[0];//+ " ( " + groupCompTitle.split(" / ")[1].split("\n")[1] + " )";
    ;
    final StudyInformationPopupComponent studyInformationPopupPanel = new StudyInformationPopupComponent(
            panelWidth, cp.getProtName(), cp.getUrl(), cp.getComparison().getComparisonFullName());
    studyInformationPopupPanel.setVisible(false);

    LayoutEvents.LayoutClickListener studyListener = new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            Integer dsId;
            if (event.getComponent() instanceof AbsoluteLayout) {
                dsId = (Integer) ((AbsoluteLayout) event.getComponent()).getData();
            } else {
                dsId = (Integer) ((VerticalLayout) event.getComponent()).getData();
            }
            studyInformationPopupPanel.updateContent(dsToStudyLayoutMap.get(dsId));
        }
    };
    TreeSet<QuantProtein> orderSet = new TreeSet<QuantProtein>(cp.getDsQuantProteinsMap().values());
    for (QuantProtein quantProtein : orderSet) {
        StudyInfoData exportData = new StudyInfoData();
        exportData.setCoverageWidth(coverageWidth);
        Label studyTitle = new Label();//"Study " + (numb + 1));
        studyTitle.setStyleName("peptideslayoutlabel");
        studyTitle.setHeightUndefined();
        studyTitle.setWidth("200px");

        Label iconTitle = new Label("#Patients ("
                + (quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()) + ")");
        exportData.setSubTitle(iconTitle.getValue());

        iconTitle.setStyleName("peptideslayoutlabel");
        iconTitle.setHeightUndefined();
        if (quantProtein.getStringPValue().equalsIgnoreCase("Not Significant")
                || quantProtein.getStringFCValue().equalsIgnoreCase("Not regulated")) {
            iconTitle.setStyleName("notregicon");
            exportData.setTrend(0);
        } else if (quantProtein.getStringFCValue().equalsIgnoreCase("Decreased")) {
            iconTitle.setStyleName("downarricon");
            exportData.setTrend(-1);
        } else {
            exportData.setTrend(1);
            iconTitle.setStyleName("uparricon");
        }

        iconTitle.setDescription(cp.getProteinAccssionNumber() + " : #Patients ("
                + (quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()) + ")  "
                + quantProtein.getStringFCValue() + " " + quantProtein.getStringPValue() + "");

        VerticalLayout labelContainer = new VerticalLayout();
        labelContainer.addComponent(studyTitle);
        labelContainer.addComponent(iconTitle);

        proteinSequenceComparisonsContainer.addComponent(labelContainer, 0, numb);
        proteinSequenceComparisonsContainer.setComponentAlignment(labelContainer, Alignment.TOP_CENTER);

        Map<Integer, ComparisonDetailsBean> patientGroupsNumToDsIdMap = new HashMap<Integer, ComparisonDetailsBean>();
        ComparisonDetailsBean pGr = new ComparisonDetailsBean();
        patientGroupsNumToDsIdMap
                .put((quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()), pGr);
        QuantDatasetObject ds;

        ds = Quant_Central_Manager.getFullQuantDatasetMap().get(quantProtein.getDsKey());

        StudyPopupLayout study = new StudyPopupLayout(panelWidth, quantProtein, ds,
                cp.getProteinAccssionNumber(), cp.getUrl(), cp.getProtName(),
                Quant_Central_Manager.getDiseaseHashedColorMap());
        Set<QuantDatasetObject> qdsSet = new HashSet<QuantDatasetObject>();
        qdsSet.add(ds);
        study.setInformationData(qdsSet, cp);
        dsToStudyLayoutMap.put(ds.getDsKey(), study);

        labelContainer.addLayoutClickListener(studyListener);
        labelContainer.setData(ds.getDsKey());
        studyTitle.setValue("[" + (numb + 1) + "] " + ds.getAuthor());
        exportData.setTitle(ds.getAuthor());

        if (dsQuantPepMap.get(quantProtein.getDsKey()) == null) {
            Label noPeptidesInfoLabel = new Label("No Peptide Information Available ");
            noPeptidesInfoLabel.setHeightUndefined();
            noPeptidesInfoLabel.setStyleName("peptideslayoutlabel");
            VerticalLayout labelValueContainer = new VerticalLayout();
            labelValueContainer.addComponent(noPeptidesInfoLabel);
            labelValueContainer.addLayoutClickListener(studyListener);
            labelValueContainer.setData(ds.getDsKey());

            proteinSequenceComparisonsContainer.addComponent(labelValueContainer, 1, numb);
            proteinSequenceComparisonsContainer.setComponentAlignment(labelValueContainer,
                    Alignment.TOP_CENTER);
            numb++;
            studiesMap.put((numb + 1) + ds.getAuthor(), exportData);
            continue;
        }

        String key = "_-_" + quantProtein.getDsKey() + "_-_" + cp.getProteinAccssionNumber() + "_-_";
        PeptidesInformationOverviewLayout peptideInfoLayout = new PeptidesInformationOverviewLayout(
                cp.getSequence(), dsQuantPepMap.get(quantProtein.getDsKey()), coverageWidth, true,
                studyListener, ds.getDsKey());
        exportData.setPeptidesInfoList(peptideInfoLayout.getStackedPeptides());
        exportData.setLevelsNumber(peptideInfoLayout.getLevel());
        hasPTM = peptideInfoLayout.isHasPTM();
        peptidesInfoLayoutDSIndexMap.put(key, peptideInfoLayout);
        proteinSequenceComparisonsContainer.addComponent(peptideInfoLayout, 1, numb);
        numb++;
        studiesMap.put((numb + 1) + ds.getAuthor(), exportData);

    }

    String rgbColor = Quant_Central_Manager
            .getDiseaseHashedColor(groupCompTitle.split(" / ")[1].split("\n")[1]);
    comparisonTitle.setValue("<font color='" + rgbColor + "' style='font-weight: bold;'>" + updatedHeader
            + " (#Datasets " + numb + "/" + cp.getComparison().getDatasetIndexes().length + ")</font>");
    comparisonTitle.setDescription(cp.getComparison().getComparisonFullName());
    VerticalLayout bottomSpacer = new VerticalLayout();
    bottomSpacer.setWidth((width - 100) + "px");
    bottomSpacer.setHeight("10px");
    bottomSpacer.setStyleName("dottedline");
    this.addComponent(bottomSpacer, 1, 2);

}

From source file:VaadinIRC.GUI.channelGUI.java

License:Open Source License

/**
 * Creates the GUI for a channel.//w w w.j ava  2  s.c o  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);
}