01: package wicket.examples.ajax.builtin.tree;
02:
03: import javax.swing.tree.DefaultMutableTreeNode;
04: import javax.swing.tree.TreeNode;
05:
06: import wicket.extensions.markup.html.tree.AbstractTree;
07: import wicket.extensions.markup.html.tree.Tree;
08:
09: /**
10: * Page that shuws a simple tree (not a table).
11: *
12: * @author Matej
13: *
14: */
15: public class SimpleTreePage extends BaseTreePage {
16: private Tree tree;
17:
18: protected AbstractTree getTree() {
19: return tree;
20: }
21:
22: /**
23: * Page constructor
24: *
25: */
26: public SimpleTreePage() {
27: tree = new Tree("tree", createTreeModel()) {
28: protected String renderNode(TreeNode node) {
29: ModelBean bean = (ModelBean) ((DefaultMutableTreeNode) node)
30: .getUserObject();
31: return bean.getProperty1();
32: }
33: };
34: add(tree);
35: tree.getTreeState().collapseAll();
36: }
37:
38: }
|