3 Replies Latest reply on Feb 2, 2007 11:22 AM by denis.diggin

    Trinidad Tree + Seam Action Bean

    mikepkp17

      I want to use a Trinidad Tree with a Seam Component and I can not get that stuff to work. I copied the original trinidad example and changed the jsf managed bean to a seam component.

      The result is that I only get the root node rendered without any icon to show the child nodes...

      Can anybody confirm that trinidad tree isn't working with a seam component instead of a jsf managed bean?

        • 1. Re: Trinidad Tree + Seam Action Bean
          mikepkp17

          I forgot: there is no exception at all, so I cannot provide a stacktrace ;-)

          • 2. Re: Trinidad Tree + Seam Action Bean
            pmuir

            I have this working (for a treetable at least). I used a facelets function:

            <tr:treeTable value="#{my:asRootedTree(value)}">...


            public class Utils {
            private static TreeModel asTree(Object tree, boolean createRoot) {
             if (createRoot && tree instanceof Collection) {
             TreeRoot root = new TreeRoot((Collection) tree);
             return new ChildPropertyTreeModel(root, "children");
             } else {
             return new ChildPropertyTreeModel(tree, "children");
             }
            }
            
            public static TreeModel asTree(Object root) {
             return asTree(root, false);
            }
            
            public static TreeModel asRootedTree(Object root) {
             return asTree(root, true);
            }
            
            public static class TreeRoot {
            
             private Collection<?> children;
            
             public TreeRoot(Collection<?> children) {
             this.children = children;
             }
            
             public Collection<?> getChildren() {
             return children;
             }
            
             public String getType() {
             return "root";
             }
            }
            }


            N.B. These method can create a singly rooted tree from a list (with a dummy root) or take a single object as the root node.

            and wired it up using my.taglib.xml. value can now be a Seam outjected list.

            • 3. Re: Trinidad Tree + Seam Action Bean
              denis.diggin