You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sc...@apache.org on 2006/02/20 20:32:05 UTC

svn commit: r379207 - in /myfaces/tomahawk/trunk/core/src: main/java/org/apache/myfaces/custom/tree2/ test/java/org/apache/myfaces/custom/tree2/

Author: schof
Date: Mon Feb 20 11:32:01 2006
New Revision: 379207

URL: http://svn.apache.org/viewcvs?rev=379207&view=rev
Log:
You are now able to supply your own TreeWalker through a custom TreeModel

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java
    myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java?rev=379207&r1=379206&r2=379207&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java Mon Feb 20 11:32:01 2006
@@ -188,7 +188,9 @@
         boolean showRootNode = getBoolean(tree, JSFAttr.SHOW_ROOT_NODE, true);
 
         TreeState state = tree.getDataModel().getTreeState();
-        TreeWalker walker = new TreeWalkerBase(tree);
+        TreeWalker walker = tree.getDataModel().getTreeWalker();
+        walker.setTree(tree);
+
         walker.setCheckState(!clientSideToggle); // walk all nodes in client mode
 
         if (showRootNode)

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java?rev=379207&r1=379206&r2=379207&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java Mon Feb 20 11:32:01 2006
@@ -61,6 +61,12 @@
     public void setTreeState(TreeState state);
     public TreeState getTreeState();
 
-//    public TreeWalker getTreeWalker();
+    /**
+     * Gets the TreeWalker associated with the model.  Allows the user to customize the manner in which nodes
+     * are walked by the renderer.
+     *
+     * @return TreeWalker
+     */
+    public TreeWalker getTreeWalker();
 
 }

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java?rev=379207&r1=379206&r2=379207&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java Mon Feb 20 11:32:01 2006
@@ -15,14 +15,9 @@
  */
 package org.apache.myfaces.custom.tree2;
 
-
-import org.apache.commons.lang.StringUtils;
-//import org.apache.commons.logging.Log;
-//import org.apache.commons.logging.LogFactory;
-
-import java.util.List;
 import java.util.StringTokenizer;
 import java.util.ArrayList;
+
 /**
  * Model class for the tree component.  It provides random access to nodes in a tree
  * made up of instances of the {@link TreeNode} class.
@@ -148,28 +143,9 @@
         return node;
     }
 
-    /*
-    public String getNodeId(TreeNode node) {
-    	List indexList = new ArrayList();
-    	TreeNode parent = node.getParentNode();
-    	while (parent != null) {
-    		int index = parent.getChildren().indexOf(node);
-    		if (index == -1)
-    			return null;
-    		indexList.add(new Integer(index));
-    		node = parent;
-    		parent = parent.getParentNode();
-    	}
-
-    	indexList.add(new Integer(0)); // root node
-
-    	StringBuffer sb = new StringBuffer();
-		for(int i = indexList.size()-1; i > 0; i--) {
-			sb.append(indexList.get(i));
-			if (i > 0)
-				sb.append(TreeModelBase.SEPARATOR);
-		}
-		return sb.toString();
+    // see interface
+    public TreeWalker getTreeWalker()
+    {
+        return new TreeWalkerBase();
     }
-    */
 }

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java?rev=379207&r1=379206&r2=379207&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java Mon Feb 20 11:32:01 2006
@@ -18,11 +18,39 @@
 
 interface TreeWalker
 {
+    /**
+     * Getter for the check state property.  Indicates whether or not the TreeWalker
+     * should navigate over nodes that are not currently expanded.
+     *
+     * @return boolean
+     */
     public boolean isCheckState();
 
+    /**
+     * Setter for the check state property.  Indicates whether or not the TreeWalker
+     * should navigate over nodes that are not currently expanded.
+     *
+     * @param checkState boolean
+     */
     public void setCheckState(boolean checkState);
 
+    /**
+     * Walk the tree and set the current node to the next node.
+     * @return boolean whether or not there was another node to walk
+     */
     public boolean next();
 
+    /**
+     * Returns the id of the root node.
+     * @return String
+     */
     public String getRootNodeId();
+
+    /**
+     * This method allows the renderer to pass a reference to the tree object.  With this
+     * reference the TreeWalker can set the current node as its walking the tree.
+     *
+     * @param treeData UITreeData
+     */
+    public void setTree(UITreeData treeData);
 }

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java?rev=379207&r1=379206&r2=379207&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java Mon Feb 20 11:32:01 2006
@@ -35,22 +35,25 @@
     private boolean checkState = true;
     private boolean startedWalking = false;
 
-    public TreeWalkerBase(UITreeData tree)
+    // see interface
+    public void setTree(UITreeData tree)
     {
         this.tree = tree;
-
     }
 
+    // see interface
     public boolean isCheckState()
     {
         return checkState;
     }
 
+    // see interface
     public void setCheckState(boolean checkState)
     {
         this.checkState = checkState;
     }
 
+    // see interface
     public boolean next()
     {
         if (!startedWalking)
@@ -139,6 +142,7 @@
         }
     }
 
+    // see interface
     public String getRootNodeId()
     {
         return ROOT_NODE_ID;

Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java?rev=379207&r1=379206&r2=379207&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java Mon Feb 20 11:32:01 2006
@@ -48,7 +48,7 @@
     private static final String DEFAULT_NODE_TYPE = "default";
 
     UITreeData treeData = new UITreeData();
-    TreeWalkerBase treeWalker;
+    TreeWalker treeWalker;
 
     protected void setUp() throws Exception
     {
@@ -83,7 +83,8 @@
         treeState.toggleExpanded("0:0");
 
         // setup the tree walker
-        treeWalker = new TreeWalkerBase(treeData);
+        treeWalker = treeData.getDataModel().getTreeWalker();
+        treeWalker.setTree(treeData);
     }
 
     public void testGetRootNodeId() throws Exception



Re: svn commit: r379207 - in /myfaces/tomahawk/trunk/core/src: main/java/org/apache/myfaces/custom/tree2/ test/java/org/apache/myfaces/custom/tree2/

Posted by Sean Schofield <se...@gmail.com>.
Hmmm.  I thought I had checked everything in.  My mistake.  Everything
should compile now but there are still a few issues when actually
using tree2.

Sean

On 2/20/06, Volker Weber <us...@weber-oldenburg.de> wrote:
> Sean,
>
> you removed a constructor from TreeWalkerBase, but it is still used in
> UITreeData. I can't build, even after a clean checkout.
>
> Did i miss something?
>
> Regards,
>   Volker
>
> schof@apache.org wrote:
> > Author: schof
> > Date: Mon Feb 20 11:32:01 2006
> > New Revision: 379207
> >
> > URL: http://svn.apache.org/viewcvs?rev=379207&view=rev
> > Log:
> > You are now able to supply your own TreeWalker through a custom TreeModel
> >
> > Modified:
> >     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
> >     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java
> >     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java
> >     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java
> >     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java
> >     myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java
> >
> > Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
> > URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java?rev=379207&r1=379206&r2=379207&view=diff
> > ==============================================================================
> > --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java (original)
> > +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java Mon Feb 20 11:32:01 2006
> > @@ -188,7 +188,9 @@
> >          boolean showRootNode = getBoolean(tree, JSFAttr.SHOW_ROOT_NODE, true);
> >
> >          TreeState state = tree.getDataModel().getTreeState();
> > -        TreeWalker walker = new TreeWalkerBase(tree);
> > +        TreeWalker walker = tree.getDataModel().getTreeWalker();
> > +        walker.setTree(tree);
> > +
> >          walker.setCheckState(!clientSideToggle); // walk all nodes in client mode
> >
> >          if (showRootNode)
> >
> > Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java
> > URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java?rev=379207&r1=379206&r2=379207&view=diff
> > ==============================================================================
> > --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java (original)
> > +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java Mon Feb 20 11:32:01 2006
> > @@ -61,6 +61,12 @@
> >      public void setTreeState(TreeState state);
> >      public TreeState getTreeState();
> >
> > -//    public TreeWalker getTreeWalker();
> > +    /**
> > +     * Gets the TreeWalker associated with the model.  Allows the user to customize the manner in which nodes
> > +     * are walked by the renderer.
> > +     *
> > +     * @return TreeWalker
> > +     */
> > +    public TreeWalker getTreeWalker();
> >
> >  }
> >
> > Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java
> > URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java?rev=379207&r1=379206&r2=379207&view=diff
> > ==============================================================================
> > --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java (original)
> > +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java Mon Feb 20 11:32:01 2006
> > @@ -15,14 +15,9 @@
> >   */
> >  package org.apache.myfaces.custom.tree2;
> >
> > -
> > -import org.apache.commons.lang.StringUtils;
> > -//import org.apache.commons.logging.Log;
> > -//import org.apache.commons.logging.LogFactory;
> > -
> > -import java.util.List;
> >  import java.util.StringTokenizer;
> >  import java.util.ArrayList;
> > +
> >  /**
> >   * Model class for the tree component.  It provides random access to nodes in a tree
> >   * made up of instances of the {@link TreeNode} class.
> > @@ -148,28 +143,9 @@
> >          return node;
> >      }
> >
> > -    /*
> > -    public String getNodeId(TreeNode node) {
> > -     List indexList = new ArrayList();
> > -     TreeNode parent = node.getParentNode();
> > -     while (parent != null) {
> > -             int index = parent.getChildren().indexOf(node);
> > -             if (index == -1)
> > -                     return null;
> > -             indexList.add(new Integer(index));
> > -             node = parent;
> > -             parent = parent.getParentNode();
> > -     }
> > -
> > -     indexList.add(new Integer(0)); // root node
> > -
> > -     StringBuffer sb = new StringBuffer();
> > -             for(int i = indexList.size()-1; i > 0; i--) {
> > -                     sb.append(indexList.get(i));
> > -                     if (i > 0)
> > -                             sb.append(TreeModelBase.SEPARATOR);
> > -             }
> > -             return sb.toString();
> > +    // see interface
> > +    public TreeWalker getTreeWalker()
> > +    {
> > +        return new TreeWalkerBase();
> >      }
> > -    */
> >  }
> >
> > Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java
> > URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java?rev=379207&r1=379206&r2=379207&view=diff
> > ==============================================================================
> > --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java (original)
> > +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java Mon Feb 20 11:32:01 2006
> > @@ -18,11 +18,39 @@
> >
> >  interface TreeWalker
> >  {
> > +    /**
> > +     * Getter for the check state property.  Indicates whether or not the TreeWalker
> > +     * should navigate over nodes that are not currently expanded.
> > +     *
> > +     * @return boolean
> > +     */
> >      public boolean isCheckState();
> >
> > +    /**
> > +     * Setter for the check state property.  Indicates whether or not the TreeWalker
> > +     * should navigate over nodes that are not currently expanded.
> > +     *
> > +     * @param checkState boolean
> > +     */
> >      public void setCheckState(boolean checkState);
> >
> > +    /**
> > +     * Walk the tree and set the current node to the next node.
> > +     * @return boolean whether or not there was another node to walk
> > +     */
> >      public boolean next();
> >
> > +    /**
> > +     * Returns the id of the root node.
> > +     * @return String
> > +     */
> >      public String getRootNodeId();
> > +
> > +    /**
> > +     * This method allows the renderer to pass a reference to the tree object.  With this
> > +     * reference the TreeWalker can set the current node as its walking the tree.
> > +     *
> > +     * @param treeData UITreeData
> > +     */
> > +    public void setTree(UITreeData treeData);
> >  }
> >
> > Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java
> > URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java?rev=379207&r1=379206&r2=379207&view=diff
> > ==============================================================================
> > --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java (original)
> > +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java Mon Feb 20 11:32:01 2006
> > @@ -35,22 +35,25 @@
> >      private boolean checkState = true;
> >      private boolean startedWalking = false;
> >
> > -    public TreeWalkerBase(UITreeData tree)
> > +    // see interface
> > +    public void setTree(UITreeData tree)
> >      {
> >          this.tree = tree;
> > -
> >      }
> >
> > +    // see interface
> >      public boolean isCheckState()
> >      {
> >          return checkState;
> >      }
> >
> > +    // see interface
> >      public void setCheckState(boolean checkState)
> >      {
> >          this.checkState = checkState;
> >      }
> >
> > +    // see interface
> >      public boolean next()
> >      {
> >          if (!startedWalking)
> > @@ -139,6 +142,7 @@
> >          }
> >      }
> >
> > +    // see interface
> >      public String getRootNodeId()
> >      {
> >          return ROOT_NODE_ID;
> >
> > Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java
> > URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java?rev=379207&r1=379206&r2=379207&view=diff
> > ==============================================================================
> > --- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java (original)
> > +++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java Mon Feb 20 11:32:01 2006
> > @@ -48,7 +48,7 @@
> >      private static final String DEFAULT_NODE_TYPE = "default";
> >
> >      UITreeData treeData = new UITreeData();
> > -    TreeWalkerBase treeWalker;
> > +    TreeWalker treeWalker;
> >
> >      protected void setUp() throws Exception
> >      {
> > @@ -83,7 +83,8 @@
> >          treeState.toggleExpanded("0:0");
> >
> >          // setup the tree walker
> > -        treeWalker = new TreeWalkerBase(treeData);
> > +        treeWalker = treeData.getDataModel().getTreeWalker();
> > +        treeWalker.setTree(treeData);
> >      }
> >
> >      public void testGetRootNodeId() throws Exception
> >
> >
>
> --
> Don't answer to From: address!
> Mail to this account are droped if not recieved via mailinglist.
> To contact me direct create the mail address by
> concatenating my forename to my senders domain.
>

Re: svn commit: r379207 - in /myfaces/tomahawk/trunk/core/src: main/java/org/apache/myfaces/custom/tree2/ test/java/org/apache/myfaces/custom/tree2/

Posted by Volker Weber <us...@weber-oldenburg.de>.
Sean,

you removed a constructor from TreeWalkerBase, but it is still used in
UITreeData. I can't build, even after a clean checkout.

Did i miss something?

Regards,
  Volker

schof@apache.org wrote:
> Author: schof
> Date: Mon Feb 20 11:32:01 2006
> New Revision: 379207
> 
> URL: http://svn.apache.org/viewcvs?rev=379207&view=rev
> Log:
> You are now able to supply your own TreeWalker through a custom TreeModel
> 
> Modified:
>     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
>     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java
>     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java
>     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java
>     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java
>     myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java
> 
> Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
> URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java?rev=379207&r1=379206&r2=379207&view=diff
> ==============================================================================
> --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java (original)
> +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java Mon Feb 20 11:32:01 2006
> @@ -188,7 +188,9 @@
>          boolean showRootNode = getBoolean(tree, JSFAttr.SHOW_ROOT_NODE, true);
>  
>          TreeState state = tree.getDataModel().getTreeState();
> -        TreeWalker walker = new TreeWalkerBase(tree);
> +        TreeWalker walker = tree.getDataModel().getTreeWalker();
> +        walker.setTree(tree);
> +
>          walker.setCheckState(!clientSideToggle); // walk all nodes in client mode
>  
>          if (showRootNode)
> 
> Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java
> URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java?rev=379207&r1=379206&r2=379207&view=diff
> ==============================================================================
> --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java (original)
> +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModel.java Mon Feb 20 11:32:01 2006
> @@ -61,6 +61,12 @@
>      public void setTreeState(TreeState state);
>      public TreeState getTreeState();
>  
> -//    public TreeWalker getTreeWalker();
> +    /**
> +     * Gets the TreeWalker associated with the model.  Allows the user to customize the manner in which nodes
> +     * are walked by the renderer.
> +     *
> +     * @return TreeWalker
> +     */
> +    public TreeWalker getTreeWalker();
>  
>  }
> 
> Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java
> URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java?rev=379207&r1=379206&r2=379207&view=diff
> ==============================================================================
> --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java (original)
> +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java Mon Feb 20 11:32:01 2006
> @@ -15,14 +15,9 @@
>   */
>  package org.apache.myfaces.custom.tree2;
>  
> -
> -import org.apache.commons.lang.StringUtils;
> -//import org.apache.commons.logging.Log;
> -//import org.apache.commons.logging.LogFactory;
> -
> -import java.util.List;
>  import java.util.StringTokenizer;
>  import java.util.ArrayList;
> +
>  /**
>   * Model class for the tree component.  It provides random access to nodes in a tree
>   * made up of instances of the {@link TreeNode} class.
> @@ -148,28 +143,9 @@
>          return node;
>      }
>  
> -    /*
> -    public String getNodeId(TreeNode node) {
> -    	List indexList = new ArrayList();
> -    	TreeNode parent = node.getParentNode();
> -    	while (parent != null) {
> -    		int index = parent.getChildren().indexOf(node);
> -    		if (index == -1)
> -    			return null;
> -    		indexList.add(new Integer(index));
> -    		node = parent;
> -    		parent = parent.getParentNode();
> -    	}
> -
> -    	indexList.add(new Integer(0)); // root node
> -
> -    	StringBuffer sb = new StringBuffer();
> -		for(int i = indexList.size()-1; i > 0; i--) {
> -			sb.append(indexList.get(i));
> -			if (i > 0)
> -				sb.append(TreeModelBase.SEPARATOR);
> -		}
> -		return sb.toString();
> +    // see interface
> +    public TreeWalker getTreeWalker()
> +    {
> +        return new TreeWalkerBase();
>      }
> -    */
>  }
> 
> Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java
> URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java?rev=379207&r1=379206&r2=379207&view=diff
> ==============================================================================
> --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java (original)
> +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java Mon Feb 20 11:32:01 2006
> @@ -18,11 +18,39 @@
>  
>  interface TreeWalker
>  {
> +    /**
> +     * Getter for the check state property.  Indicates whether or not the TreeWalker
> +     * should navigate over nodes that are not currently expanded.
> +     *
> +     * @return boolean
> +     */
>      public boolean isCheckState();
>  
> +    /**
> +     * Setter for the check state property.  Indicates whether or not the TreeWalker
> +     * should navigate over nodes that are not currently expanded.
> +     *
> +     * @param checkState boolean
> +     */
>      public void setCheckState(boolean checkState);
>  
> +    /**
> +     * Walk the tree and set the current node to the next node.
> +     * @return boolean whether or not there was another node to walk
> +     */
>      public boolean next();
>  
> +    /**
> +     * Returns the id of the root node.
> +     * @return String
> +     */
>      public String getRootNodeId();
> +
> +    /**
> +     * This method allows the renderer to pass a reference to the tree object.  With this
> +     * reference the TreeWalker can set the current node as its walking the tree.
> +     *
> +     * @param treeData UITreeData
> +     */
> +    public void setTree(UITreeData treeData);
>  }
> 
> Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java
> URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java?rev=379207&r1=379206&r2=379207&view=diff
> ==============================================================================
> --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java (original)
> +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java Mon Feb 20 11:32:01 2006
> @@ -35,22 +35,25 @@
>      private boolean checkState = true;
>      private boolean startedWalking = false;
>  
> -    public TreeWalkerBase(UITreeData tree)
> +    // see interface
> +    public void setTree(UITreeData tree)
>      {
>          this.tree = tree;
> -
>      }
>  
> +    // see interface
>      public boolean isCheckState()
>      {
>          return checkState;
>      }
>  
> +    // see interface
>      public void setCheckState(boolean checkState)
>      {
>          this.checkState = checkState;
>      }
>  
> +    // see interface
>      public boolean next()
>      {
>          if (!startedWalking)
> @@ -139,6 +142,7 @@
>          }
>      }
>  
> +    // see interface
>      public String getRootNodeId()
>      {
>          return ROOT_NODE_ID;
> 
> Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java
> URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java?rev=379207&r1=379206&r2=379207&view=diff
> ==============================================================================
> --- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java (original)
> +++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java Mon Feb 20 11:32:01 2006
> @@ -48,7 +48,7 @@
>      private static final String DEFAULT_NODE_TYPE = "default";
>  
>      UITreeData treeData = new UITreeData();
> -    TreeWalkerBase treeWalker;
> +    TreeWalker treeWalker;
>  
>      protected void setUp() throws Exception
>      {
> @@ -83,7 +83,8 @@
>          treeState.toggleExpanded("0:0");
>  
>          // setup the tree walker
> -        treeWalker = new TreeWalkerBase(treeData);
> +        treeWalker = treeData.getDataModel().getTreeWalker();
> +        treeWalker.setTree(treeData);
>      }
>  
>      public void testGetRootNodeId() throws Exception
> 
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.