myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wolfgang.toep...@pta.de
Subject [Trinidad] tree component - how to open a node programmatically on the Java side?
Date Thu, 27 Sep 2007 07:49:38 GMT




Hi,

Naively I followed the instructions on building a tree i.e. sth. like

 * Example: Given the following class:
 * <pre>
 * public class Person
 * {
 *    public Person(String name)
 *    {
 *      _name = name;
 *    }
 *
 *    public String getName()
 *    {
 *      return _name;
 *    }
 *
 *    public List getKids()
 *    {
 *      return _kids;
 *    }
 *
 *    private final String _name;
 *    private final List _kids = new ArrayList();
 * }
 * </pre>
 * You can construct a tree by:
 * <pre>
 * Person john = new Person("John Smith");
 * Person kim = new Person("Kim Smith");
 * Person tom = new Person("Tom Smith");
 * Person ira = new Person("Ira Wickrememsinghe");
 * Person mallika = new Person("Mallika Wickremesinghe");
 *
 * john.getKids().add(kim);
 * john.getKids().add(tom);
 * ira.getKids().add(mallika);
 *
 * // create the list of root nodes:
 * List people = new ArrayList();
 * people.add(john);
 * people.add(ira);
 * </pre>
 * Now you can construct a TreeModel by:
 * <pre>
 * TreeModel model = new ChildPropertyTreeModel(people, "kids");


Now I would like to open a node programmatically on the Java side. However,
when I use the isContainer method before enterContainer I get an
IllegalArgument exception while trying to call
javax.faces.model.ScalarDataModel.getRowData.

Is there another way to open a certain node? Would I use rowKeys?
Regarding the rowKey approach, I have the impression that the rowKey
approach does not seem to be really feasible; as far as I can see in the
debugger, I could only verify one rowKey instance for the root node but I
did not find any other rowKey object for other existing nodes..

Do I need to use the Menu variation of the tree classes for rowKeys to
work?

Further details:
I use a Pojo MenuItem that has a children property which is an
ArrayList<MenuItem>.
I use SEAM 2.0 RC1.
I apply the org.apache.myfaces.trinidad.model.ChildPropertyTreeModel
implementation of org.apache.myfaces.trinidad.model.TreeModel.

Many thanks,Wolfgang.

PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschäftsführer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

**********************************************************************
http://www.pta.de
Mit 1501 Erfahrungsberichten aus 38 Jahren erfolgreicher Projektarbeit!
**********************************************************************
Mime
View raw message