[jboss-user] [JBoss Seam] - Re: Trinidad Tree + Seam Action Bean
petemuir
do-not-reply at jboss.com
Thu Jan 11 04:40:55 EST 2007
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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000312#4000312
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4000312
More information about the jboss-user
mailing list