You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by fh...@s-und-n.de on 2006/08/02 10:57:55 UTC

expanded tree onpageload

Hi,

i'm trying to implement an treeview which is still expanded when the page
is loaded but i can't get it.

At the moment, the tree is closed and via Ajax the nodes expand or
collapse. That works fine.
But i want the tree to be expanded completly.

Is this possible in some way?

model.xml:
<fd:tree id="testtree" root-visible="true" selection="multiple">
      <fd:tree-model type="java" class="test.TestTree"/>

class TestTree:
public class TestTree extends Tree implements TreeModel,Contextualizable {

      private TreeData treemodel = null;         //TreeData extends
DefaultTreeModel
      private TestSession testSession = null;
      private TestBean testBean = null;
      private Map objectModel;
      private DefaultTreeNode root = null;

      public void contextualize(Context context) throws ContextException {
            objectModel = (Map)ContextHelper.getObjectModel(context);
            testSession =
(TestSession)ObjectModelHelper.getRequest(objectModel).getSession().getAttribute("TestSessionContext");
            testBean = testSession.getTestBean();  //includes all the data
which are needed
            treemodel = new TreeData(testBean);
            root = (DefaultTreeNode)treemodel.getRoot();
            builtTree();
      }

      public void builtTree(){
            this.setModel(treemodel);

            //how to expand all the nodes?
      }

      ...
}

class TreeData:
public class TreeData extends DefaultTreeModel

//Builds the DefaultTreeNodes getting the needed data from the testBean.
This works fine!

Any ideas?


With kind regards
Fabian Hagen


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org