Search in sources :

Example 1 with DefaultTableTree

use of org.apache.wicket.extensions.markup.html.repeater.tree.DefaultTableTree in project wicket by apache.

the class EnhancedPageView method newTree.

private AbstractTree<TreeNode> newTree() {
    TreeProvider provider = new TreeProvider();
    IModel<Set<TreeNode>> expandStateModel = new LoadableDetachableModel<Set<TreeNode>>() {

        private static final long serialVersionUID = 1L;

        @Override
        protected Set<TreeNode> load() {
            return expandState;
        }
    };
    AbstractTree<TreeNode> tree = new DefaultTableTree<TreeNode, Void>("tree", visibleColumns, provider, Integer.MAX_VALUE, expandStateModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected Item<TreeNode> newRowItem(String id, int index, IModel<TreeNode> model) {
            return new OddEvenItem<>(id, index, model);
        }
    };
    tree.setOutputMarkupId(true);
    return tree;
}
Also used : IModel(org.apache.wicket.model.IModel) HashSet(java.util.HashSet) Set(java.util.Set) OddEvenItem(org.apache.wicket.markup.repeater.OddEvenItem) SortableTreeProvider(org.apache.wicket.extensions.markup.html.repeater.util.SortableTreeProvider) LoadableDetachableModel(org.apache.wicket.model.LoadableDetachableModel) DefaultTableTree(org.apache.wicket.extensions.markup.html.repeater.tree.DefaultTableTree)

Aggregations

HashSet (java.util.HashSet)1 Set (java.util.Set)1 DefaultTableTree (org.apache.wicket.extensions.markup.html.repeater.tree.DefaultTableTree)1 SortableTreeProvider (org.apache.wicket.extensions.markup.html.repeater.util.SortableTreeProvider)1 OddEvenItem (org.apache.wicket.markup.repeater.OddEvenItem)1 IModel (org.apache.wicket.model.IModel)1 LoadableDetachableModel (org.apache.wicket.model.LoadableDetachableModel)1