incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Koprowski" <adam.koprow...@gmail.com>
Subject Problems with tr:tree + Seam + Facelets...
Date Wed, 24 Jan 2007 21:17:33 GMT
  Hello everyone,
 I'm having similar issue as Sonja did: namely my tree contains only roots
but no children (I create tree using ChildPropertyTreeModel but in fact the
method responsible for returning the children is never called and there are
no errors whatsoever). I also have similar setup
(EJB3+Seam+Facelets+myFaces+Trindiad). However I tried to play around a bit
with different ways of deploying but did not manage to resolve this issue.
I'd like to understand what's going wrong - any ideas? Anybody?
  Thanks in advance,
   Adam

---------- Forwarded message ----------
From: Sonja Löhr <sonjaloehr@arcor.de>
To: <adffaces-user@incubator.apache.org>
Date: Sat, 4 Nov 2006 12:21:32 +0100
Subject: RE: tree> no Children inited

For those who might be run into the same problem:
It was kind of classloader issue? I had the TreeModelAdapter inside an
ejb.jar (or, as my first trial ,inited the ChildPropertyModel directly from
a stateful session bean).
After having moved the TreeModelAdapter into the applications .war, the tree
handles (and the child nodes) appear.
I do not really see what happened now and before, perhaps someone else could
clarify?

Regards,
sonja


> -----Original Message-----
> From: Sonja Löhr [mailto:sonjaloehr@arcor.de <//sonjaloehr@arcor.de/>]
> Sent: Freitag, 3. November 2006 11:23
> To: adffaces-user@incubator.apache.org<//adffaces-user@incubator.apache.org/>
> Subject: <tr:tree> no Children inited
>
> Hi!
> Could someone tell me where I am wrong that my <tr:tree>
> always displays just the root elements?
> As the tree inited from the persistence layer (using Seam and
> EJB3) did not work, I stepped back and setup the following
> simple test, but still I do not see any "open" handles, nor
> is the "getChildren" getter on my TestBean ever called,
> therefore  the log message in getModel() also states a tree
> depth of zero. On the adapter I removed some "model = null"
> instructions during debugging.
>
> Here is the <tr:tree>, the classes used and the faces-config.xml part.
>
> Any help would be great!
> Thanks in advance!
>
>
>
>
>    <tr:tree id="grouptree" var="cat" value="#{groupsAdapter.model}">
>            <f:facet name="nodeStamp">
>               <tr:commandLink text="#{cat.name}"
> styleClass="nodeText">
>                  <!--  outcommented actionListener  -->
>                  </tr:commandLink>
>
>            </f:facet>
>    </tr:tree>
>
>
> ==============================================================
> ==============
> =========
>
>  <managed-bean>
>        <managed-bean-name>treeTest</managed-bean-name>
>        <managed-bean-class>japp.jsf.TreeTest</managed-bean-class>
>        <managed-bean-scope>session</managed-bean-scope>
>   </managed-bean>
>
>  <managed-bean>
>        <managed-bean-name>groupsAdapter</managed-bean-name>
>
> <managed-bean-class>japp.jsf.TreeModelAdapter</managed-bean-class>
>        <managed-bean-scope>session</managed-bean-scope>
>        <managed-property>
>             <property-name>instance</property-name>
>             <value>#{treeTest.roots}</value>
>         </managed-property>
>         <managed-property>
>             <property-name>childPropertyName</property-name>
>             <value>children</value>
>         </managed-property>
>  </managed-bean>
>
>
> ==============================================================
> ==============
> ===0
>
>
> public class TreeModelAdapter {
>
>       private String childPropertyName;
>       private Object _instance = null;
>       private transient TreeModel _model = null;
>
>       Log logger = LogFactory.getLog(TreeModelAdapter.class);
>
>       public TreeModelAdapter() {}
>
>
>       public TreeModel getModel() throws IntrospectionException    {
>             if (_model == null)  {
>               _model = new ChildPropertyTreeModel(getInstance(),
> getChildPropertyName());
>             }
>             logger.info("Tree depth: "+_model.getDepth());
>             return _model;
>       }
>
>       public String getChildPropertyName()   {
>            return childPropertyName;
>       }
>
>       public void setChildPropertyName(String propertyName)   {
>               childPropertyName = propertyName;
>       }
>
>        public Object getInstance() {
>            return _instance;
>        }
>
>
>     public void setInstance(Object instance)   {
>       _instance = instance;
>     }
>
>
>       public void setListInstance(List<Object> instance) {
>            setInstance(instance);
>       }
>
>
>       @SuppressWarnings("unchecked")
>       public List<Object> getListInstance()   {
>            return (List<Object>)getInstance();
>       }
>
>
> }
>
>
>
> ==============================================================
> ==============
> ==
>
> public class TreeTest {
>
>       public TreeTest() {
>
>       }
>
>       private List<TestBean> roots;
>
>     public List<TestBean> getRoots() {
>       if(roots != null) return roots;
>       roots = new ArrayList<TestBean>();
>       TestBean r1 = new TestBean("root1");
>       TestBean ch1 = new TestBean("ch1");
>       TestBean enk11 = new TestBean("enk1");
>       ch1.addChild(enk11);
>       r1.addChild(ch1);
>
>       TestBean r2 = new TestBean("root2");
>       TestBean ch2 = new TestBean("ch2");
>       TestBean enk21 = new TestBean("enk21");
>       TestBean enk22 = new TestBean("enk22");
>       ch2.addChild(enk21);
>       ch2.addChild(enk22);
>       r2.addChild(ch2);
>       TestBean ch3 = new TestBean("ch3");
>       TestBean enk23 = new TestBean("enk23");
>       ch3.addChild(enk23);
>       r2.addChild(ch3);
>       roots.add(r1);
>       roots.add(r2);
>       return roots;
>     }
> }
>
>
> ==============================================================
> ==============
> ====
>
> public class TestBean {
>       private List<TestBean> children;
>       private String name;
>
>       public TestBean() {
>               children = new ArrayList<TestBean>();
>       }
>       public TestBean(String name) {
>               this.name = name;
>               children = new ArrayList<TestBean>();
>       }
>       public void addChild(TestBean ch) {
>               children.add(ch);
>       }
>       //never called !!
>       public List<TestBean> getChildren() {
>               System.out.println("getChildren called on "+name);
>               System.out.print("getChildren returns: ");
>               for(TestBean ch : children) {
>                       System.out.print(ch.toString());
>               }
>               System.out.println();
>               return children;
>       }
>
>       public void setChildren(List<TestBean> children) {
>               this.children = children;
>       }
>       public String getName() {
>               return name;
>       }
>       public void setName(String name) {
>               this.name = name;
>       }
>
>       public String toString() {
>               return name+" kids: "+children.size();
>       }
> }

-- 
=====================================================
Adam.Koprowski@gmail.com, ICQ: 3204612
http://www.win.tue.nl/~akoprows
The difference between impossible and possible
lies in determination (Tommy Lasorda)
=====================================================

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message