Example usage for com.vaadin.ui VerticalLayout setData

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

Introduction

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

Prototype

public void setData(Object data) 

Source Link

Document

Sets the data object, that can be used for any application specific data.

Usage

From source file:org.eclipse.emf.ecp.controls.vaadin.internal.PrimitiveListVaadinRenderer.java

License:Open Source License

@Override
public void renderList(VerticalLayout layout) {
    final TextField textField = createTextfield();
    final Converter<String, Object> converter = createConverter(getSetting(), getTable(), textField);

    final Button add = createAddButton(getSetting(), textField);
    layout.addComponent(getTable());//  www. j  a  v a2 s .c o m
    layout.setData(getTable());
    layout.addComponent(getToolbar());
    bindControls(textField, converter, add);
}

From source file:org.eclipse.emf.ecp.controls.vaadin.internal.ReferenceListVaadinRenderer.java

License:Open Source License

@Override
public void renderList(VerticalLayout layout) {
    composedAdapterFactory = new ComposedAdapterFactory(
            new AdapterFactory[] { new CustomReflectiveItemProviderAdapterFactory(),
                    new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE) });
    adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(composedAdapterFactory);
    createLinkColumn();/*from   www .j  ava 2  s . c o  m*/
    bindTable();
    layout.addComponent(getToolbar());
    layout.addComponent(getTable());
    layout.setData(getTable());
    layout.setComponentAlignment(getToolbar(), Alignment.TOP_RIGHT);
}

From source file:org.eclipse.emf.ecp.view.table.vaadin.TableRendererVaadin.java

License:Open Source License

@Override
protected VerticalLayout render() {
    final VTableControl control = getVElement();
    final ViewModelContext viewContext = getViewModelContext();
    final Iterator<Setting> iterator = control.getDomainModelReference().getIterator();
    if (!iterator.hasNext()) {
        return null;
    }/*  www  . ja va 2  s. co  m*/
    setting = iterator.next();

    final VerticalLayout layout = new VerticalLayout();
    table = createTable();
    layout.setData(table);

    setVisibleColumns(control, viewContext);

    bindTable(setting, table);

    if (control.isReadonly()) {
        layout.addComponent(table);
        return layout;
    }

    final HorizontalLayout horizontalLayout = createButtonBar();

    layout.addComponent(horizontalLayout);
    layout.setComponentAlignment(horizontalLayout, Alignment.TOP_RIGHT);
    layout.addComponent(table);

    return layout;
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.TableInfoPanel.java

License:Open Source License

protected AbstractLayout create(AbstractMetaDataTableCreator creator) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//from w w  w. j a  v  a2 s.c  o m
    layout.setSizeFull();
    layout.setData(creator);
    return layout;
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.TableInfoPanel.java

License:Open Source License

protected void populate(VerticalLayout layout) {
    AbstractMetaDataTableCreator creator = (AbstractMetaDataTableCreator) layout.getData();
    Table table = creator.create();// w  ww  .j av a  2s . com
    layout.addComponent(table);
    layout.setExpandRatio(table, 1);
    layout.setData(null);
}

From source file:org.metawidget.example.vaadin.addressbook.ContactDialog.java

License:BSD License

public ContactDialog(AddressBook addressBook, final Contact contact) {

    mAddressBook = addressBook;//from w  ww .  j av a  2 s.  c  o m

    setHeight("600px");
    setWidth("800px");
    ((Layout) getContent()).setMargin(false);

    CustomLayout body = new CustomLayout("contact");
    addComponent(body);

    // Bundle

    ResourceBundle bundle = ResourceBundle
            .getBundle("org.metawidget.example.shared.addressbook.resource.Resources");

    // Title

    StringBuilder builder = new StringBuilder(contact.getFullname());

    if (builder.length() > 0) {
        builder.append(" - ");
    }

    // Personal/business icon

    if (contact instanceof PersonalContact) {
        builder.append(bundle.getString("personalContact"));
        body.addComponent(new Embedded(null, new ThemeResource("../addressbook/img/personal.gif")), "icon");
    } else {
        builder.append(bundle.getString("businessContact"));
        body.addComponent(new Embedded(null, new ThemeResource("../addressbook/img/business.gif")), "icon");
    }

    setCaption(builder.toString());

    // Metawidget

    mContactMetawidget = new VaadinMetawidget();
    mContactMetawidget.setWidth("100%");
    mContactMetawidget.setConfig("org/metawidget/example/vaadin/addressbook/metawidget.xml");
    mContactMetawidget.setReadOnly(contact.getId() != 0);
    mContactMetawidget.setToInspect(contact);

    // Communications override

    final TableDataSource<Communication> tableDataSource = new TableDataSource<Communication>(
            Communication.class, contact.getCommunications(), "type", "value");
    mCommunicationsTable = new Table();
    mCommunicationsTable.setWidth("100%");
    mCommunicationsTable.setHeight("170px");

    final Button deleteButton = new Button("Delete");
    deleteButton.setEnabled(false);
    deleteButton.addListener(new ClickListener() {

        @SuppressWarnings("unchecked")
        public void buttonClick(ClickEvent event) {

            Communication communication = tableDataSource.getDataRow(mCommunicationsTable.getValue());
            contact.removeCommunication(communication);

            ((TableDataSource<Communication>) mCommunicationsTable.getContainerDataSource())
                    .importCollection(contact.getCommunications());
        }
    });

    Button addNewButton = new Button("Add");
    addNewButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {

            mCommunicationsTable.setValue(null);
            deleteButton.setEnabled(false);

            CommunicationDialog communicationDialog = new CommunicationDialog(ContactDialog.this,
                    new Communication());
            communicationDialog.setModal(true);
            getParent().addWindow(communicationDialog);
        }
    });

    mCommunicationsTable.setSelectable(false);
    mCommunicationsTable.addListener(new ItemClickListener() {

        public void itemClick(ItemClickEvent event) {

            if (!mCommunicationsTable.isSelectable()) {
                return;
            }

            if (!event.isDoubleClick()) {
                deleteButton.setEnabled(true);
                return;
            }

            deleteButton.setEnabled(false);

            Communication communication = tableDataSource.getDataRow(event.getItemId());
            CommunicationDialog communicationDialog = new CommunicationDialog(ContactDialog.this,
                    communication);
            communicationDialog.setModal(true);
            getParent().addWindow(communicationDialog);
        }
    });

    mCommunicationsButtons = new com.vaadin.ui.HorizontalLayout();
    mCommunicationsButtons.setVisible(!mContactMetawidget.isReadOnly());
    mCommunicationsButtons.setMargin(false);
    mCommunicationsButtons.setSpacing(true);
    mCommunicationsButtons.addComponent(addNewButton);
    mCommunicationsButtons.addComponent(deleteButton);

    VerticalLayout wrapper = new VerticalLayout();
    wrapper.setData("communications");
    wrapper.addComponent(mCommunicationsTable);
    wrapper.addComponent(mCommunicationsButtons);
    wrapper.setComponentAlignment(mCommunicationsButtons, Alignment.MIDDLE_CENTER);
    mContactMetawidget.addComponent(wrapper);

    mCommunicationsTable.setContainerDataSource(tableDataSource);
    body.addComponent(mContactMetawidget, "pagebody");

    // Embedded buttons

    Facet facetButtons = new Facet();
    facetButtons.setData("buttons");
    facetButtons.setWidth("100%");
    mContactMetawidget.addComponent(facetButtons);

    mButtonsMetawidget = new VaadinMetawidget();
    mButtonsMetawidget.setWidth(null);
    mButtonsMetawidget.setConfig("org/metawidget/example/vaadin/addressbook/metawidget.xml");
    mButtonsMetawidget.setLayout(new HorizontalLayout());
    mButtonsMetawidget.setToInspect(this);
    facetButtons.addComponent(mButtonsMetawidget);
    ((com.vaadin.ui.VerticalLayout) facetButtons.getContent()).setComponentAlignment(mButtonsMetawidget,
            Alignment.MIDDLE_CENTER);
}

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

private void updateSelectionList() {
    table.removeAllComponents();//from w  ww  . j a v  a2 s . com
    updatedComparisonList.clear();
    selectedComparisonList = this.Quant_Central_Manager
            .getUpdatedSelectedDiseaseGroupsComparisonListProteins(searchQuantificationProtList);//
    int row = 1;
    if (selectedComparisonList != null) {
        table.addComponent(headerI, 0, 0);
        table.setComponentAlignment(headerI, Alignment.MIDDLE_CENTER);
        table.addComponent(headerII, 2, 0);
        table.setComponentAlignment(headerII, Alignment.MIDDLE_CENTER);
        setWindowHight(selectedComparisonList.size());
        for (QuantDiseaseGroupsComparison comparison : selectedComparisonList) {
            updatedComparisonList.add(comparison);

            String header = comparison.getComparisonHeader();
            String updatedHeaderI = header.split(" / ")[0].split("\n")[0];
            String updatedHeaderII = header.split(" / ")[1].split("\n")[0];
            String diseaseColor = this.Quant_Central_Manager
                    .getDiseaseHashedColor(header.split(" / ")[1].split("\n")[1]);
            Label labelI = new Label("<center><font color='" + diseaseColor
                    + "' style='font-weight: bold;!important'>" + updatedHeaderI + "</font></center>");
            Label labelII = new Label("<center><font color='" + diseaseColor
                    + "' style='font-weight: bold;!important'>" + updatedHeaderII + "</font></center>");
            labelI.setContentMode(ContentMode.HTML);
            labelII.setContentMode(ContentMode.HTML);
            labelI.setWidth("100%");
            labelII.setWidth("100%");

            VerticalLayout switchBtn = swichIconGenerator();
            table.addComponent(labelI, 0, row);
            table.setComponentAlignment(labelI, Alignment.MIDDLE_CENTER);
            table.addComponent(switchBtn, 1, row);
            switchBtn.setData(row - 1);
            table.setComponentAlignment(switchBtn, Alignment.MIDDLE_CENTER);
            table.addComponent(labelII, 2, row++);
            table.setComponentAlignment(labelII, Alignment.MIDDLE_CENTER);

        }
        table.addComponent(btnWrapper, 2, row);
        table.setComponentAlignment(btnWrapper, Alignment.MIDDLE_CENTER);
    }
    //        comparisonList.addValueChangeListener(GroupSwichBtn.this);
}

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

/**
 *
 * @param cp/*w  w  w . j a  v a 2 s .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:se.natusoft.osgi.aps.apsadminweb.app.gui.vaadin.TabPanel.java

License:Open Source License

/**
 * Recreates all tabs./*from   w ww.j av a  2  s.  c om*/
 */
public void refreshTabs() {
    List<AdminWebReg> currentAdminWebs = this.adminWebService.getRegisteredAdminWebs();

    // Remove old
    removeAllComponents();

    VerticalLayout aboutTabLayout = new VerticalLayout();
    aboutTabLayout.setStyleName("aps-tabsheet-tab");
    aboutTabLayout.setMargin(true);
    aboutTabLayout.setSizeFull();
    Label aboutText = new HTMLFileLabel("/html/about-admin-web.html", APSTheme.THEME,
            getClass().getClassLoader());
    aboutTabLayout.addComponent(aboutText);
    addTab(aboutTabLayout, "About", null).setDescription("Information about APS Admin Web tool.");

    // Add new
    for (AdminWebReg adminWebReg : currentAdminWebs) {
        VerticalLayout tabLayout = new VerticalLayout();
        tabLayout.setStyleName("aps-tabsheet-tab");
        tabLayout.setSizeFull();
        tabLayout.setMargin(false);
        tabLayout.setSpacing(false);
        Embedded adminWeb = new Embedded("", new ExternalResource(adminWebReg.getUrl() + "?adminRefresh"));
        adminWeb.setType(Embedded.TYPE_BROWSER);
        adminWeb.setSizeFull();
        tabLayout.addComponent(adminWeb);
        tabLayout.setData(adminWebReg);

        Tab tab = addTab(tabLayout, adminWebReg.getName(), null);
        tab.setDescription(adminWebReg.getDescription() + "<br/>[" + adminWebReg.getName() + ":"
                + adminWebReg.getVersion() + "]");
    }
}