Package com.ponysdk.ui.server.basic

Examples of com.ponysdk.ui.server.basic.PTreeItem


                final String msg = "Selected item : name = " + event.getSelectedItem();
                UIContext.getRootEventBus().fireEvent(new DemoBusinessEvent(msg));
            }
        });

        final PTreeItem firstItem = new PTreeItem("First item");

        final PAnchor anchor = new PAnchor("Second item");
        final PTreeItem secondItem = new PTreeItem(anchor);
        anchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                secondItem.setState(secondItem.getState() ? false : true);
            }
        });

        final PTreeItem thirdItem = new PTreeItem(new PImage("images/pony.png"));

        tree.addItem(firstItem);
        tree.addItem(secondItem);
        tree.addItem(thirdItem);

        final Query query = new Query();
        final FindPonysCommand command = new FindPonysCommand(query);
        final Result<List<Pony>> ponys = command.execute();

        for (final Pony pony : ponys.getData()) {
            firstItem.addItem(pony.getName());
            secondItem.addItem(pony.getName());
            thirdItem.addItem(pony.getName());
        }

        panel.add(tree);

        examplePanel.setWidget(panel);
View Full Code Here


            }
        });
    }

    private PTreeItem createCategoryItemIfNeeded(final String category) {
        PTreeItem categoryItem = categoryByName.get(category);
        if (categoryItem == null) {
            categoryItem = tree.addItem(category);
            categoryByName.put(category, categoryItem);
        }
        return categoryItem;
View Full Code Here

        return categoryItem;
    }

    @Override
    public void addItem(final MenuItem menuItem) {
        final PTreeItem categoryItem = createCategoryItemIfNeeded(menuItem.getCategories().iterator().next());
        if (menuItem.getName() != null) {
            final PTreeItem captionItem = new PTreeItem(menuItem.getName());
            categoryItem.addItem(captionItem);
            itemsByTree.put(captionItem, menuItem);
            treeByMenuItem.put(menuItem, captionItem);
        }
    }
View Full Code Here

        }
    }

    @Override
    public void selectItem(final MenuItem menuItem) {
        final PTreeItem treeItem = treeByMenuItem.get(menuItem);
        tree.setSelectedItem(treeItem);
    }
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.server.basic.PTreeItem

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.