private Widget zoomingTree() {
VerticalPanel p = new VerticalPanel();
final TextBox b = new TextBox();
p.add(b);
final FastTree tree = new FastTree();
final HashMap<String, FastTreeItem> treeItems = new HashMap<String, FastTreeItem>();
b.addKeyboardListener(new KeyboardListener() {
public void onKeyDown(Widget sender, char keyCode, int modifiers) {
if (keyCode == KEY_ENTER) {
String value = b.getText().trim();
FastTreeItem chosen = treeItems.get(value);
if (chosen == null) {
Window.alert("No such tree item exists");
}
tree.setSelectedItem(chosen);
tree.ensureSelectedItemVisible();
}
}
public void onKeyPress(Widget sender, char keyCode, int modifiers) {
}
public void onKeyUp(Widget sender, char keyCode, int modifiers) {
}
});
ScrollPanel scroller = new ScrollPanel();
for (int i = 0; i < 10; i++) {
FastTreeItem item = tree.addItem("" + i);
treeItems.put("" + i, item);
for (int j = 0; j < 5; j++) {
String value = "" + i + "." + j;
FastTreeItem subItem = item.addItem(value);
treeItems.put(value, subItem);