Example usage for com.vaadin.ui HorizontalLayout setData

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

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout 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.AbstractVaadinSimpleControlRenderer.java

License:Open Source License

protected void createSetOrUnsetComponent(final Component component, final HorizontalLayout horizontalLayout,
        final Setting setting) {
    final Label unsetLabel = getUnsetComponent();
    final Button setButton = getUnsetButton(component, horizontalLayout, setting);
    setButton.setEnabled(getVElement().isEnabled());
    setButton.setVisible(getVElement().isVisible());
    setButton.setReadOnly(getVElement().isReadonly());
    horizontalLayout.addStyleName("textheight");
    horizontalLayout.removeAllComponents();
    Component addComponent = component;
    if (setting.isSet()) {
        setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Set);
        unsetLabel.setCaption(getUnsetLabel());
        addComponent = unsetLabel;/*from   ww  w . j  a v  a2  s .  c om*/

    } else {
        setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Unset);

    }
    horizontalLayout.setData(addComponent);
    horizontalLayout.addComponent(addComponent);
    horizontalLayout.setExpandRatio(addComponent, 1f);
    horizontalLayout.addComponent(setButton);
    horizontalLayout.setComponentAlignment(setButton, Alignment.BOTTOM_RIGHT);

}

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

License:Open Source License

@Override
protected Component render() {
    final Setting setting = getVElement().getDomainModelReference().getIterator().next();
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    final Component checkBox = createControl();
    horizontalLayout.setData(checkBox);
    createDatabinding(setting, checkBox);
    checkBox.setWidth(100, Unit.PERCENTAGE);
    horizontalLayout.setWidth(100, Unit.PERCENTAGE);
    horizontalLayout.addComponent(checkBox);
    horizontalLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_LEFT);
    // TODO: Fix Size
    horizontalLayout.addStyleName("textheight");
    if (setting.getEStructuralFeature().isUnsettable()) {
        createSetOrUnsetComponent(checkBox, horizontalLayout, setting);
    }//from w  w w.java2s.c  o m
    return horizontalLayout;
}

From source file:org.escidoc.browser.ui.GroupRolesView.java

License:Open Source License

private void showExistingGrants(ComponentContainer grantListLayout) throws EscidocClientException {
    int rowNumber = 0;

    for (Grant grant : repositories.group().getGrantsForGroup(groupId)) {
        /**/*from   ww  w.  j  a  v  a2 s  .c o m*/
         * Some grants have been excluded from output because of performance issues. The list is found at:
         * ViewConstants.roleExcludeList
         */
        if (!ViewConstants.roleExcludeList.contains(grant.getXLinkTitle().toString()
                .substring(0, grant.getXLinkTitle().toString().lastIndexOf(" of")).trim())) {
            HorizontalLayout existingGrantRowLayout = buildEditGrantRowView(rowNumber, grant);
            existingGrantRowLayout.setData(Integer.valueOf(rowNumber));
            rowNumber++;
            bind(existingGrantRowLayout, grant);
            grantListLayout.addComponent(existingGrantRowLayout);
        }
    }

}

From source file:org.escidoc.browser.ui.useraccount.UserRolesView.java

License:Open Source License

private void showExistingGrants(ComponentContainer grantListLayout) throws EscidocClientException {
    int rowNumber = 0;
    for (Grant grant : controller.getGrantsForUser(userProxy.getId())) {
        HorizontalLayout existingGrantRowLayout = buildEditGrantRowView(rowNumber, grant);
        existingGrantRowLayout.setData(Integer.valueOf(rowNumber));
        rowNumber++;//from  w  ww.j  a va  2s. c om
        bind(existingGrantRowLayout, grant);
        grantListLayout.addComponent(existingGrantRowLayout);
    }
}

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

License:Open Source License

protected void refreshData(final org.jumpmind.db.model.Table table, final String user, final IDb db,
        final Settings settings, boolean isInit) {

    if (!isInit) {
        tabSheet.removeTab(tabSheet.getTab(1));
    }/*from   w  ww  .jav  a  2s.co  m*/

    IDatabasePlatform platform = db.getPlatform();
    DmlStatement dml = platform.createDmlStatement(DmlType.SELECT_ALL, table, null);

    final HorizontalLayout executingLayout = new HorizontalLayout();
    executingLayout.setSizeFull();
    final ProgressBar p = new ProgressBar();
    p.setIndeterminate(true);
    final int oldPollInterval = UI.getCurrent().getPollInterval();
    UI.getCurrent().setPollInterval(100);
    executingLayout.addComponent(p);
    executingLayout.setData(isInit);
    tabSheet.addTab(executingLayout, "Data", isInit ? null : FontAwesome.SPINNER, 1);
    if (!isInit) {
        tabSheet.setSelectedTab(executingLayout);
    }

    SqlRunner runner = new SqlRunner(dml.getSql(), false, user, db, settings, explorer,
            new ISqlRunnerListener() {

                private static final long serialVersionUID = 1L;

                @Override
                public void writeSql(String sql) {
                    explorer.openQueryWindow(db).appendSql(sql);
                }

                @Override
                public void reExecute(String sql) {
                    refreshData(table, user, db, settings, false);
                }

                @Override
                public void finished(final FontAwesome icon, final List<Component> results,
                        long executionTimeInMs, boolean transactionStarted, boolean transactionEnded) {
                    VaadinSession.getCurrent().access(new Runnable() {

                        @Override
                        public void run() {
                            tabSheet.removeComponent(executingLayout);
                            VerticalLayout layout = new VerticalLayout();
                            layout.setMargin(true);
                            layout.setSizeFull();
                            if (results.size() > 0) {
                                layout.addComponent(results.get(0));
                            }
                            tabSheet.addTab(layout, "Data", null, 1);
                            UI.getCurrent().setPollInterval(oldPollInterval);
                            tabSheet.setSelectedTab(layout);
                        }
                    });
                }
            });
    runner.setShowSqlOnResults(false);
    runner.setLogAtDebug(true);
    if (!isInit) {
        runner.start();
    }

}

From source file:org.s23m.cell.editor.semanticdomain.ui.components.layout.ImpactAnalysisFormLayout.java

License:Mozilla Public License

private void buildResultsPage(final List<Set> dependentInstances, final Panel resultsContentPanel,
        final int startIndex, final int endIndex) {
    resultsContentPanel.removeAllComponents();
    for (int n = startIndex; (n < endIndex && n < dependentInstances.size()); n++) {
        final Set s = dependentInstances.get(n);
        final HorizontalLayout hl1 = new HorizontalLayout();
        hl1.setData(s);
        final HorizontalLayout hl2 = new HorizontalLayout();
        Label lblDescription = null;
        if (analysedSet.isEqualToRepresentation(s.category())) {
            lblDescription = new StyledLabel("Meta Element of", StyledLabel.VALUE_TAG_STYLE);
        } else if (s.properClass().isEqualTo(S23MKernel.coreGraphs.visibility)) {
            lblDescription = new StyledLabel("Part of Visibility", StyledLabel.VALUE_TAG_STYLE);
        } else if (s.properClass().isEqualTo(S23MKernel.coreGraphs.superSetReference)) {
            lblDescription = new StyledLabel("Part of Superset Reference", StyledLabel.VALUE_TAG_STYLE);
        } else if (s.properClass().isEqualTo(S23MKernel.coreGraphs.edge)) {
            lblDescription = new StyledLabel("Part of Edge", StyledLabel.VALUE_TAG_STYLE);
        }/* w ww .jav a  2 s . co m*/
        resultsContentPanel.addComponent(lblDescription);
        final Label lblMeta = new StyledLabel(s.category().identity().name() + " : ",
                StyledLabel.META_ELEMENT_STYLE);
        final Label lblInstance = new StyledLabel(s.identity().name(), StyledLabel.INSTANCE_ELEMENT_STYLE);
        final Label lblArtifact = new StyledLabel("part of: " + s.container().identity().name(),
                StyledLabel.VALUE_TAG_STYLE);
        final Label lblNameTag = new StyledLabel("name:", StyledLabel.NAME_TAG_STYLE);
        final Label lblName = new StyledLabel(s.identity().name(), StyledLabel.VALUE_TAG_STYLE);
        final Label lblPlNameTag = new StyledLabel("plural name:", StyledLabel.NAME_TAG_STYLE);
        final Label lblPlName = new StyledLabel(s.identity().pluralName(), StyledLabel.VALUE_TAG_STYLE);
        hl1.addComponent(lblMeta);
        hl1.addComponent(lblInstance);
        hl2.addComponent(lblArtifact);
        hl2.addComponent(lblNameTag);
        hl2.addComponent(lblName);
        hl2.addComponent(lblPlNameTag);
        hl2.addComponent(lblPlName);

        resultsContentPanel.addComponent(hl1);
        resultsContentPanel.addComponent(hl2);
    }
    if (dependentInstances.size() > PAGE_SIZE) {
        createPagebar(dependentInstances, resultsContentPanel, dependentInstances.size());
    }
}

From source file:org.s23m.cell.editor.semanticdomain.ui.components.MultitabPanel.java

License:Mozilla Public License

private void buildResultsPage(final Panel resultsPanel, final int startIndex, final int endIndex) {
    resultsPanel.removeAllComponents();// w  w  w.  j a v a  2 s. c o m
    for (int n = startIndex; (n < endIndex && n < searchResults.size()); n++) {
        final SearchResultType r = searchResults.get(n);
        final Tree cTree = application.getContainmentTreePanel().getContainmentTree();
        final HorizontalLayout hl1 = new HorizontalLayout();
        hl1.setData(r.getInstanceIdentity());
        hl1.addListener(new LayoutClickListener() {
            private void expandAllAncestors(final TreeNode rootNode, final TreeNode node2Select) {
                if (!rootNode.equals(node2Select)) {
                    final TreeNode parentNode = (TreeNode) cTree.getParent(node2Select);
                    cTree.expandItem(parentNode);
                    expandAllAncestors(rootNode, parentNode);
                }
            }

            public void layoutClick(final LayoutClickEvent event) {
                if (event.getSource() instanceof HorizontalLayout) {
                    final HorizontalLayout layout = (HorizontalLayout) event.getSource();
                    final InstanceIdentityType id = (InstanceIdentityType) layout.getData();
                    //Fetch and deserialize outershell instances if they are not available in memory
                    application.getContainmentTreePanel().recreateOutshellInstances();
                    application.getContainmentTreePanel().update();
                    if (cTree.rootItemIds().size() > 0) {
                        final TreeNode rootNode = (TreeNode) cTree.rootItemIds().iterator().next();
                        cTree.collapseItemsRecursively(rootNode);
                        //select a corresponding tree node
                        final Set set = Reconstitution.getSetFromLocalMemory(
                                Reconstitution.reconstituteIdentity(id.getName(), id.getPluralName(),
                                        UUID.fromString(id.getUuid()), UUID.fromString(id.getUuid())));
                        // TODO name based equivalence test needs to be replaced by isEqualToRepresentation()
                        if (!set.identity().name()
                                .equals((S23MSemanticDomains.semanticErr_ThisSetIsNotAvailableInMemory
                                        .identity().name()))) {

                            TreeNode node2Select = null;
                            if (set.properClass().isEqualTo(S23MKernel.coreGraphs.edge)) {
                                node2Select = new TreeNode(
                                        set.container().identity().uniqueRepresentationReference().toString(),
                                        TreeNode.NO_SET);
                            } else {
                                node2Select = new TreeNode(id.getUuid(), TreeNode.NO_SET);
                            }
                            expandAllAncestors(rootNode, node2Select);
                            cTree.setValue(node2Select);
                        }
                    }
                }
            }//
        });

        final HorizontalLayout hl2 = new HorizontalLayout();

        final Label lblMeta = new Label();
        lblMeta.setStyleName("meta-element");
        final Label lblInstance = new Label();
        lblInstance.setStyleName("instance-element");

        final Label lblArtifact = new StyledLabel("part of: " + r.getContainerIdentity().getName(),
                StyledLabel.VALUE_TAG_STYLE);
        final Label lblNameTag = new StyledLabel("name:", StyledLabel.NAME_TAG_STYLE);
        final Label lblName = new StyledLabel(r.getInstanceIdentity().getName(), StyledLabel.VALUE_TAG_STYLE);
        final Label lblPlNameTag = new StyledLabel("plural name:", StyledLabel.NAME_TAG_STYLE);
        final Label lblPlName = new StyledLabel(r.getInstanceIdentity().getPluralName(),
                StyledLabel.VALUE_TAG_STYLE);
        if (r.getMetaInstanceIdentity().getName() != null) {
            lblMeta.setValue(r.getMetaInstanceIdentity().getName() + " : ");
        } else {
            final Set metaSet = Reconstitution.getSetFromLocalMemory(Reconstitution.reconstituteIdentity("", "",
                    UUID.fromString(r.getMetaInstanceIdentity().getUuid()),
                    UUID.fromString(r.getMetaInstanceIdentity().getUuid())));
            // TODO name based equivalence test needs to be replaced by isEqualToRepresentation()
            if (!metaSet.identity().name().equals(
                    (S23MSemanticDomains.semanticErr_ThisSetIsNotAvailableInMemory.identity().name()))) {

                lblMeta.setValue(metaSet.identity().name() + " : ");
            } else {
                lblMeta.setValue(" : ");
            }
        }
        lblInstance.setValue(r.getInstanceIdentity().getName());

        hl1.addComponent(lblMeta);
        hl1.addComponent(lblInstance);
        hl2.addComponent(lblArtifact);
        hl2.addComponent(lblNameTag);
        hl2.addComponent(lblName);
        hl2.addComponent(lblPlNameTag);
        hl2.addComponent(lblPlName);

        resultsPanel.addComponent(hl1);
        resultsPanel.addComponent(hl2);
    }
    if (searchResults.size() > PAGE_SIZE) {
        createPagebar(resultsPanel, searchResults.size());
    }
}