RootPanel.get().add(new FastTreeDemo().createDemo());
}
protected Widget basicTree() {
FastTree t = new FastTree();
FastTreeItem a = t.addItem("A root tree item");
a.addItem("A child with different style");
a.addItem("regular style");
FastTreeItem aXb = a.addItem("Another child");
aXb.addItem("a grand child");
FastTreeItem widgetBranch = a.addItem(new CheckBox("A checkbox child"));
FastTreeItem textBoxParent = widgetBranch.addItem("A TextBox parent");
textBoxParent.addItem(new TextBox());
textBoxParent.addItem("and another one...");
textBoxParent.addItem(new TextArea());
// Add an item with basic elements inside of it
{
final TextBox textBox = new TextBox();
Hyperlink link = new Hyperlink("change focus", "blah");
link.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
textBox.setFocus(true);
event.getNativeEvent().stopPropagation();
}
});
VerticalPanel vPanel = new VerticalPanel();
vPanel.add(link);
vPanel.add(textBox);
a.addItem(vPanel);
}
// Add a large item
FastTreeItem hugeParent = a.addItem("I contain a huge item");
SimplePanel hugePanel = new SimplePanel();
hugePanel.setPixelSize(1000, 1000);
hugePanel.getElement().getStyle().setProperty("border", "2px solid blue");
hugePanel.getElement().getStyle().setPropertyPx("padding", 50);
Label clickableLabel = new Label("Click Me");
clickableLabel.setWidth("70px");
clickableLabel.getElement().getStyle().setProperty("border",
"1px solid blue");
clickableLabel.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Window.alert("You clicked the label");
}
});
hugePanel.setWidget(clickableLabel);
hugeParent.addItem(hugePanel);
ListBox lb = new ListBox();
for (int i = 0; i < 100; i++) {
lb.addItem(i + "");
}