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);