Package com.vaadin.ui

Examples of com.vaadin.ui.Tree$ExpandListener


        }
        return null;
    }

    private Tree createChartsTree() {
        final Tree tree = new Tree("Chart Type");
        tree.setContainerDataSource(getContainer());
        tree.setImmediate(true);
        tree.setItemCaptionPropertyId(TREE_ITEM_CAPTION_PROP_ID);
        tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);
        tree.setNullSelectionAllowed(false);

        for (Object id : tree.rootItemIds()) {
            tree.expandItemsRecursively(id);
        }

        tree.addListener(new Tree.ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                try {
                    Object selectedId = event.getProperty().getValue();
                    if (tree.getParent(selectedId) != null) {
                        Object parentId = tree.getParent(selectedId);
                        String demoSeriesTypeName = (String) tree
                                .getContainerProperty(parentId,
                                        TREE_ITEM_CAPTION_PROP_ID).getValue();
                        String seriesInstanceName = (String) tree
                                .getContainerProperty(selectedId,
                                        TREE_ITEM_CAPTION_PROP_ID).getValue();

                        System.out.println("parent : " + demoSeriesTypeName
                                + ", selected : " + seriesInstanceName);
                        showChart(demoSeriesTypeName, seriesInstanceName);
                    } else {
                        String demoSeriesTypeName = (String) tree
                                .getContainerProperty(selectedId,
                                        TREE_ITEM_CAPTION_PROP_ID).getValue();
                        System.out.println("Selected " + demoSeriesTypeName);
                        showChartInstancesForSeriesType(demoSeriesTypeName);
                    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Tree$ExpandListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.