Example usage for com.vaadin.ui HorizontalLayout getData

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

Introduction

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

Prototype

public Object getData() 

Source Link

Document

Gets the application specific data.

Usage

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

License:Open Source License

@Override
protected void createSetOrUnsetComponent(Component component, HorizontalLayout horizontalLayout,
        Setting setting) {/*from   w w w  . j  a  va  2s. co  m*/
    super.createSetOrUnsetComponent(component, horizontalLayout, setting);
    final Component componentSet = (Component) horizontalLayout.getData();
    horizontalLayout.setComponentAlignment(componentSet, Alignment.MIDDLE_LEFT);
}

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();//from  w  w  w .  ja  v  a2 s .co  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());
    }
}