You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/08/12 16:36:58 UTC

svn commit: r984805 [1/3] - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ta...

Author: lofwyr
Date: Thu Aug 12 14:36:56 2010
New Revision: 984805

URL: http://svn.apache.org/viewvc?rev=984805&view=rev
Log:
TOBAGO-377: new tree
 - next steps in implementing the new tree
 - splitting tc:treeNode into tc:treeNode and tc:treeIndent and tc:treeIcon and (tc:treeCommand or tc:treeLabel)

Added:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIIndent.java
      - copied, changed from r984305, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeMenuNode.java
      - copied, changed from r953990, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java
      - copied, changed from r953990, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIconTagDeclaration.java   (contents, props changed)
      - copied, changed from r980058, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIndentTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeLabelTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxNodeTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuCommandTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuLabelTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuNodeTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/TreeUtils.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeSelectable.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-listbox.jsp
      - copied, changed from r979655, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-normal-2.xhtml
      - copied, changed from r980058, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-normal.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-normal-3.xhtml
      - copied, changed from r984305, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-normal.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-simple.jsp
      - copied, changed from r979655, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-select.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeCommandRenderer.java
      - copied, changed from r953990, myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeLabelRenderer.java
      - copied, changed from r953990, myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxNodeRenderer.java
      - copied, changed from r979655, myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuCommandRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuLabelRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java
      - copied, changed from r954522, myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/CommandRendererBase.java   (contents, props changed)
      - copied, changed from r953990, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/CommandRendererBase.java
Removed:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/CommandRendererBase.java
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeData.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeNodeTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/tree.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-normal.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
    myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/style.css

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java Thu Aug 12 14:36:56 2010
@@ -73,8 +73,16 @@ public final class RendererTypes {
   public static final String TOOL_BAR = "ToolBar";
   public static final String TREE = "Tree";
   public static final String TREE_DATA = "TreeData";
+  public static final String TREE_COMMAND = "TreeCommand";
+  public static final String TREE_ICON = "TreeIcon";
+  public static final String TREE_INDENT = "TreeIndent";
+  public static final String TREE_LABEL = "TreeLabel";
   public static final String TREE_LISTBOX = "TreeListbox";
+  public static final String TREE_LISTBOX_NODE = "TreeListboxNode";
   public static final String TREE_MENU = "TreeMenu";
+  public static final String TREE_MENU_COMMAND = "TreeMenuCommand";
+  public static final String TREE_MENU_LABEL = "TreeMenuLabel";
+  public static final String TREE_MENU_NODE = "TreeMenuNode";
   public static final String TREE_NODE = "TreeNode";
   public static final String SHEET = "Sheet";
   public static final String WIZARD = "Wizard";

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java Thu Aug 12 14:36:56 2010
@@ -23,4 +23,6 @@ import org.apache.myfaces.tobago.layout.
 import javax.faces.component.UIGraphic;
 
 public abstract class AbstractUIImage extends UIGraphic implements LayoutComponent, DeprecatedDimension {
+
+  public abstract boolean isDisabled();
 }

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIIndent.java (from r984305, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIIndent.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIIndent.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java&r1=984305&r2=984805&rev=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIImage.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIIndent.java Thu Aug 12 14:36:56 2010
@@ -17,10 +17,9 @@ package org.apache.myfaces.tobago.intern
  * limitations under the License.
  */
 
-import org.apache.myfaces.tobago.component.DeprecatedDimension;
-import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.config.Configurable;
 
 import javax.faces.component.UIGraphic;
 
-public abstract class AbstractUIImage extends UIGraphic implements LayoutComponent, DeprecatedDimension {
+public abstract class AbstractUIIndent extends UIGraphic implements Configurable {
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java Thu Aug 12 14:36:56 2010
@@ -21,6 +21,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.TreeModelBuilder;
 import org.apache.myfaces.tobago.layout.LayoutComponent;
 import org.apache.myfaces.tobago.model.MixedTreeModel;
+import org.apache.myfaces.tobago.model.TreeSelectable;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 
 import javax.faces.application.FacesMessage;
@@ -40,7 +41,7 @@ public abstract class AbstractUITree ext
   public static final String SEP = "-";
 
   public static final String SELECT_STATE = SEP + "selectState";
-  public static final String MARKER = SEP + "marker";
+  public static final String MARKED = SEP + "marked";
 
   private MixedTreeModel model;
 
@@ -83,13 +84,11 @@ public abstract class AbstractUITree ext
     return true;
   }
 
-  public boolean isSelectableTree() {
-    final Object selectable
-        = ComponentUtils.getAttribute(this, Attributes.SELECTABLE);
-    return selectable != null
-        && (selectable.equals("multi") || selectable.equals("multiLeafOnly")
-        || selectable.equals("single") || selectable.equals("singleLeafOnly")
-        || selectable.equals("sibling") || selectable.equals("siblingLeafOnly"));
+  /**
+   * Will be obsolete later when selectable has the type TreeSelectable.
+   */
+  public TreeSelectable getSelectableAsEnum() {
+    return TreeSelectable.parse(ComponentUtils.getStringAttribute(this, Attributes.SELECTABLE));
   }
 
   @Override
@@ -167,7 +166,4 @@ public abstract class AbstractUITree ext
 
   public abstract Object getState();
 
-  public boolean isShowRoot() {
-    return false;
-  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeData.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeData.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeData.java Thu Aug 12 14:36:56 2010
@@ -18,12 +18,12 @@ package org.apache.myfaces.tobago.intern
  */
 
 import org.apache.commons.lang.ObjectUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.component.TreeModelBuilder;
 import org.apache.myfaces.tobago.model.MixedTreeModel;
 import org.apache.myfaces.tobago.model.Node;
 import org.apache.myfaces.tobago.model.TreePath;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
@@ -34,8 +34,11 @@ import javax.faces.event.FacesListener;
 import javax.faces.event.PhaseId;
 import javax.swing.tree.DefaultMutableTreeNode;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 public abstract class AbstractUITreeData extends javax.faces.component.UIInput
@@ -52,7 +55,7 @@ public abstract class AbstractUITreeData
   private TreePath rowIndex;
 
   // XXX hack: fix this if there is a Listener
-  private Object marker;
+  private Object marked;
 
   // Holds for each node the states of the child components of this UITreeData.
   private Map<TreePath, Object> pathStates = new HashMap<TreePath, Object>();
@@ -73,7 +76,7 @@ public abstract class AbstractUITreeData
 
     // XXX hack: fix this if there is a Listener
     if (templateComponent.isMarked()) {
-      marker = templateComponent.getValue();
+      marked = templateComponent.getValue();
     }
 
     int index = 0;
@@ -100,14 +103,11 @@ public abstract class AbstractUITreeData
     }
 
     AbstractUITreeNode template = getTemplateComponent();
-    pathStates.put(this.rowIndex, template.saveState(facesContext));
+    pathStates.put(this.rowIndex, saveStateDeep(facesContext, template));
     if (LOG.isDebugEnabled()) {
       LOG.debug("save   " + this.rowIndex + " ex=" + template.isExpanded());
     }
 
-    // reset the client id (see spec 3.1.6)
-    template.setId(template.getId());
-
     this.rowIndex = rowIndex;
     if (rowIndex != null) {
       DefaultMutableTreeNode model = (DefaultMutableTreeNode) getValue();
@@ -120,12 +120,45 @@ public abstract class AbstractUITreeData
 
     Object state = pathStates.get(this.rowIndex);
     if (state != null) {
-      template.restoreState(facesContext, state);
+      restoreStateDeep(facesContext, template, state);
       if (LOG.isDebugEnabled()) {
         LOG.debug("restore " + this.rowIndex + " ex=" + template.isExpanded());
       }
     }
   }
+
+  /**
+   * Restores the state of the component and the state of all facets and children from the state object.
+   */
+  private void restoreStateDeep(FacesContext facesContext, UIComponent template, Object stateObject) {
+    final List<Object> state = (List<Object>) stateObject;
+    int i = 0;
+    template.restoreState(facesContext, state.get(i++));
+
+    // reset the client id (see spec 3.1.6)
+    template.setId(template.getId());
+    
+    final Iterator<UIComponent> facetsAndChildren = template.getFacetsAndChildren();
+    while (facetsAndChildren.hasNext()) {
+      UIComponent component = (UIComponent) facetsAndChildren.next();
+      restoreStateDeep(facesContext, component, state.get(i++));
+    }
+  }
+
+  /**
+   * Put the state of the component and the state of all facets and children into a object.
+   */
+  private Object saveStateDeep(FacesContext facesContext, UIComponent template) {
+    final List<Object> state = new ArrayList<Object>();
+    state.add(template.saveState(facesContext));
+
+    final Iterator<UIComponent> facetsAndChildren = template.getFacetsAndChildren();
+    while (facetsAndChildren.hasNext()) {
+      UIComponent component = (UIComponent) facetsAndChildren.next();
+      state.add(saveStateDeep(facesContext, component));
+    }
+    return state;
+  }
 /*
   public void buildTreeModel(MixedTreeModel model) {
     model.beginBuildNodeData(this);
@@ -226,8 +259,8 @@ public abstract class AbstractUITreeData
 
   @Override
   public void updateModel(FacesContext facesContext) {
-    // nothig to update for tree's
-    // TODO: updateing the model here and *NOT* in the decode phase
+    // nothing to update for tree's
+    // TODO: updating the model here and *NOT* in the decode phase
   }
 
   public AbstractUITreeNode getTemplateComponent() {
@@ -366,6 +399,6 @@ public abstract class AbstractUITreeData
 
   // XXX hack: fix this if there is a Listener
   public Object getMarker() {
-    return marker;
+    return marked;
   }
 }

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeMenuNode.java (from r953990, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeMenuNode.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeMenuNode.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java&r1=953990&r2=984805&rev=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeMenuNode.java Thu Aug 12 14:36:56 2010
@@ -17,292 +17,6 @@ package org.apache.myfaces.tobago.intern
  * limitations under the License.
  */
 
-import org.apache.myfaces.tobago.component.SupportsMarkup;
-import org.apache.myfaces.tobago.component.TreeModelBuilder;
-import org.apache.myfaces.tobago.event.TreeExpansionEvent;
-import org.apache.myfaces.tobago.event.TreeExpansionListener;
-import org.apache.myfaces.tobago.model.MixedTreeModel;
-import org.apache.myfaces.tobago.model.TreePath;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+public abstract class AbstractUITreeMenuNode extends AbstractUITreeNode {
 
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.EvaluationException;
-import javax.faces.el.MethodBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.swing.tree.DefaultMutableTreeNode;
-import java.io.IOException;
-import java.util.List;
-
-public abstract class AbstractUITreeNode extends UICommandBase implements SupportsMarkup, TreeModelBuilder {
-
-  private static final Logger LOG = LoggerFactory.getLogger(AbstractUITreeNode.class);
-
-  private int depth;
-  private boolean folder;
-  private TreePath path;
-  private List<Boolean> junctions;
-  private boolean hasNextSibling;
-
-  public void buildTreeModelBegin(FacesContext facesContext, MixedTreeModel model) {
-    model.beginBuildNode(this);
-    setDepth(computeDepth(this));
-    setFolder(computeFolder());
-  }
-
-  public void buildTreeModelChildren(FacesContext facesContext, MixedTreeModel model) {
-    for (Object child : getChildren()) {
-      if (child instanceof TreeModelBuilder) {
-        TreeModelBuilder builder = (TreeModelBuilder) child;
-        builder.buildTreeModelBegin(facesContext, model);
-        builder.buildTreeModelChildren(facesContext, model);
-        builder.buildTreeModelEnd(facesContext, model);
-      }
-    }
-  }
-
-  public void buildTreeModelEnd(FacesContext facesContext, MixedTreeModel model) {
-    model.endBuildNode(this);
-  }
-
-  @Override
-  public void encodeBegin(FacesContext context) throws IOException {
-    AbstractUITree tree = findTree();
-    MixedTreeModel mixedModel = tree.getModel();
-    mixedModel.onEncodeBegin();
-    setPath(mixedModel.getPath());
-    setHasNextSibling(computeHasNextSibling());
-    setJunctions(mixedModel.getJunctions());
-    super.encodeBegin(context);
-  }
-
-  @Override
-  public void encodeEnd(FacesContext context) throws IOException {
-    super.encodeEnd(context);
-    AbstractUITree tree = findTree();
-    MixedTreeModel mixedModel = tree.getModel();
-    mixedModel.onEncodeEnd();
-  }
-
-  private int computeDepth(UIComponent component) {
-    int depth = 0;
-    while (component != null) {
-      depth++;
-      if (component instanceof AbstractUITree) {
-        return depth;
-      }
-      if (component instanceof AbstractUITreeData) {
-        Object dataTree = ((AbstractUITreeData) component).getValue();
-        // todo: make independent from impl.
-        if (dataTree instanceof DefaultMutableTreeNode) {
-          return ((DefaultMutableTreeNode) dataTree).getDepth(); // XXX expensive
-        }
-        LOG.warn("Tree type not supported");
-      }
-      component = component.getParent();
-    }
-    throw new RuntimeException("Not inside of a UITree");
-  }
-
-  private boolean computeFolder() {
-    DefaultMutableTreeNode node = getDataNode();
-    if (node != null) {
-      return !node.isLeaf();
-    } else {
-      for (UIComponent child : getChildren()) {
-        if ((child instanceof AbstractUITreeNode || child instanceof AbstractUITreeData) && child.isRendered()) {
-          return true;
-        }
-      }
-      return false;
-    }
-  }
-
-  private boolean computeHasNextSibling() {
-    DefaultMutableTreeNode node = getDataNode();
-    if (node != null) {
-      if (node.isRoot()) {
-        return hasSiblingAfter(getParent().getParent(), getParent());
-      } else {
-        return node.getNextSibling() != null;
-      }
-    } else {
-      return hasSiblingAfter(getParent(), this);
-    }
-  }
-
-  private boolean hasSiblingAfter(UIComponent parent, UIComponent child) {
-    boolean found = false;
-    for (Object sibling : parent.getChildren()) {
-      if (child.equals(sibling)) {
-        found = true;
-        continue;
-      }
-      if (found) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Finds the value of the current node via the var attribute of the tree data.
-   * Returns null if it will be called not inside of {@link AbstractUITreeData}
-   */
-  // todo: make independent from impl.: DefaultMutableTreeNode
-  private DefaultMutableTreeNode getDataNode() {
-    UIComponent component = this;
-    while (component != null) {
-      if (component instanceof AbstractUITreeData) {
-        final AbstractUITreeData data = (AbstractUITreeData) component;
-        final Object currentNode
-            = FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(data.getVar());
-        return (DefaultMutableTreeNode) currentNode;
-      } else if (component instanceof AbstractUITree) {
-        return null;
-      }
-      component = component.getParent();
-    }
-    return null;
-  }
-
-  @Override
-  public Object getValue() {
-    LOG.error("XXXXXXXXXXX should not be called!!!!!!!!!!!!");
-    return super.getValue();
-  }
-
-  /**
-   * Returns the level of the tree node inside of the virtual tree. The root node has level 0.
-   * The children of the root note have level 1, and so on. 
-   */
-  public int getLevel() {
-    return path.getLength() - 1;
-  }
-
-  public String nodeStateId(FacesContext facesContext) {
-    String clientId = getClientId(facesContext);
-    AbstractUITree tree = findTree(this);
-    String treeId = tree.getClientId(facesContext);
-    return clientId.substring(treeId.length() + 1);
-  }
-
-  public AbstractUITree findTree() {
-    return findTree(this);
-  }
-
-  private AbstractUITree findTree(UIComponent component) {
-    while (component != null) {
-      if (component instanceof AbstractUITree) {
-        return (AbstractUITree) component;
-      }
-      component = component.getParent();
-    }
-    return null;
-  }
-
-  @Override
-  public void broadcast(FacesEvent event) throws AbortProcessingException {
-    super.broadcast(event);
-    if (event instanceof TreeExpansionEvent) {
-      invokeMethodBinding(getTreeExpansionListener(), event);
-    }
-  }
-
-  private void invokeMethodBinding(MethodBinding methodBinding, FacesEvent event) {
-    if (methodBinding != null && event != null) {
-      try {
-        methodBinding.invoke(getFacesContext(), new Object[]{event});
-      } catch (EvaluationException e) {
-        Throwable cause = e.getCause();
-        if (cause instanceof AbortProcessingException) {
-          throw (AbortProcessingException) cause;
-        } else {
-          throw e;
-        }
-      }
-    }
-  }
-
-  public void restoreState(FacesContext context, Object componentState) {
-    Object[] values = (Object[]) componentState;
-    super.restoreState(context, values[0]);
-    path = (TreePath) values[1];
-    folder = (Boolean) values[2];
-  }
-
-  public Object saveState(FacesContext context) {
-    Object[] values = new Object[3];
-    values[0] = super.saveState(context);
-    values[1] = path;
-    values[2] = folder;
-    return values;
-  }
-
-  public int getDepth() {
-    return depth;
-  }
-
-  public void setDepth(int depth) {
-    this.depth = depth;
-  }
-
-  public boolean isFolder() {
-    return folder;
-  }
-
-  public void setFolder(boolean folder) {
-    this.folder = folder;
-  }
-
-  public TreePath getPath() {
-    return path;
-  }
-
-  public void setPath(TreePath path) {
-    this.path = path;
-  }
-
-  public List<Boolean> getJunctions() {
-    return junctions;
-  }
-
-  public void setJunctions(List<Boolean> junctions) {
-    this.junctions = junctions;
-  }
-
-  public boolean isHasNextSibling() {
-    return hasNextSibling;
-  }
-
-  public void setHasNextSibling(boolean hasNextSibling) {
-    this.hasNextSibling = hasNextSibling;
-  }
-
-  public abstract MethodBinding getTreeExpansionListener();
-
-  public abstract void setTreeExpansionListener(MethodBinding treeExpansionListener);
-
-  public void addTreeExpansionListener(TreeExpansionListener listener) {
-    addFacesListener(listener);
-  }
-
-  public TreeExpansionListener[] getTreeExpansionListeners() {
-    return (TreeExpansionListener[]) getFacesListeners(TreeExpansionListener.class);
-  }
-
-  public void removeStateChangeListener(TreeExpansionListener listener) {
-    removeFacesListener(listener);
-  }
-
-
-  public abstract void setExpanded(boolean expanded);
-
-  public abstract void setMarked(boolean b);
-
-  public abstract boolean isMarked();
-
-  public abstract boolean isExpanded();
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java Thu Aug 12 14:36:56 2010
@@ -19,6 +19,7 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.myfaces.tobago.component.SupportsMarkup;
 import org.apache.myfaces.tobago.component.TreeModelBuilder;
+import org.apache.myfaces.tobago.config.Configurable;
 import org.apache.myfaces.tobago.event.TreeExpansionEvent;
 import org.apache.myfaces.tobago.event.TreeExpansionListener;
 import org.apache.myfaces.tobago.model.MixedTreeModel;
@@ -27,6 +28,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
 import javax.faces.context.FacesContext;
 import javax.faces.el.EvaluationException;
 import javax.faces.el.MethodBinding;
@@ -36,7 +38,8 @@ import javax.swing.tree.DefaultMutableTr
 import java.io.IOException;
 import java.util.List;
 
-public abstract class AbstractUITreeNode extends UICommandBase implements SupportsMarkup, TreeModelBuilder {
+public abstract class AbstractUITreeNode
+    extends UIOutput implements SupportsMarkup, TreeModelBuilder, Configurable {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUITreeNode.class);
 
@@ -297,12 +300,15 @@ public abstract class AbstractUITreeNode
     removeFacesListener(listener);
   }
 
-
-  public abstract void setExpanded(boolean expanded);
+  public abstract boolean isMarked();
 
   public abstract void setMarked(boolean b);
 
-  public abstract boolean isMarked();
-
   public abstract boolean isExpanded();
+
+  public abstract void setExpanded(boolean expanded);
+
+  public abstract boolean isSelected();
+
+  public abstract void setSelected(boolean selected);
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -32,7 +32,7 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutContainer;
 
 /**
- * Renders a Image.
+ * Renders an image.
  */
 @Tag(name = "image", bodyContent = BodyContent.JSP)
 @UIComponentTag(

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java (from r953990, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java&r1=953990&r2=984805&rev=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -25,10 +25,8 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.internal.taglib.declaration.AbstractCommandTagDeclaration;
-import org.apache.myfaces.tobago.internal.taglib.declaration.HasCommandType;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
-import org.apache.myfaces.tobago.internal.taglib.declaration.HasImage;
-import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabelAndAccessKey;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabel;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasTabIndex;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
@@ -37,15 +35,15 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsInline;
 
 /**
- * Renders a link element.
+ * Renders a command inside of a tree.
  */
-@Tag(name = "link", tagExtraInfoClassName = "org.apache.myfaces.tobago.internal.taglib.component.CommandTagExtraInfo")
+@Tag(
+    name = "treeCommand",
+    tagExtraInfoClassName = "org.apache.myfaces.tobago.internal.taglib.component.CommandTagExtraInfo")
 @BodyContentDescription(anyTagOf = "facestag")
 @UIComponentTag(
-    uiComponent = "org.apache.myfaces.tobago.component.UILink",
-    uiComponentBaseClass = "org.apache.myfaces.tobago.component.UICommand",
-    interfaces = "org.apache.myfaces.tobago.component.UILinkCommand",
-    rendererType = RendererTypes.LINK,
+    uiComponent = "org.apache.myfaces.tobago.component.UITreeCommand",
+    uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUICommand",
     allowedChildComponenents = "NONE",
     facets = {
         @Facet(
@@ -55,8 +53,9 @@ import org.apache.myfaces.tobago.interna
         @Facet(
             name = Facets.POPUP,
             description = "Contains a UIPopup instance.",
-            allowedChildComponenents = "org.apache.myfaces.tobago.Popup")})
-public interface LinkTagDeclaration extends AbstractCommandTagDeclaration,
-    HasIdBindingAndRendered, HasLabelAndAccessKey, IsDisabled, IsInline,
-    HasCommandType, HasTip, HasImage, HasMarkup, HasTabIndex, IsGridLayoutComponent {
+            allowedChildComponenents = "org.apache.myfaces.tobago.Popup")},
+    rendererType = RendererTypes.TREE_COMMAND)
+public interface TreeCommandTagDeclaration
+    extends AbstractCommandTagDeclaration, HasIdBindingAndRendered, IsDisabled, IsInline,
+    HasLabel, HasTip, HasMarkup, HasTabIndex, IsGridLayoutComponent {
 }

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIconTagDeclaration.java (from r980058, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIconTagDeclaration.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIconTagDeclaration.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java&r1=980058&r2=984805&rev=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ImageTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIconTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -17,45 +17,33 @@ package org.apache.myfaces.tobago.intern
  * limitations under the License.
  */
 
-import org.apache.myfaces.tobago.apt.annotation.BodyContent;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.internal.taglib.declaration.HasBorder;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsDisabled;
-import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponentWithDeprecatedDimension;
-import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutContainer;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
 
 /**
- * Renders a Image.
+ * Renders an image beside a tree node.
  */
-@Tag(name = "image", bodyContent = BodyContent.JSP)
+@Tag(name = "treeIcon")
 @UIComponentTag(
-    uiComponent = "org.apache.myfaces.tobago.component.UIImage",
+    uiComponent = "org.apache.myfaces.tobago.component.UITreeIcon",
     uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIImage",
-    rendererType = RendererTypes.IMAGE,
+    rendererType = RendererTypes.TREE_ICON,
     allowedChildComponenents = "NONE")
-public interface ImageTagDeclaration
-    extends HasIdBindingAndRendered, HasBorder, HasTip, IsDisabled, HasMarkup,
-    IsGridLayoutComponentWithDeprecatedDimension, IsGridLayoutContainer {
+public interface TreeIconTagDeclaration
+    extends HasIdBindingAndRendered, HasTip, IsDisabled, HasMarkup, IsGridLayoutComponent {
 
   /**
    * Absolute url to an image or image name to lookup in tobago resource path
    */
-  @TagAttribute(required = true)
-  @UIComponentTagAttribute()
-  void setValue(String value);
-
-  /**
-   * Alternate textual description of the image rendered by this component.
-   */
   @TagAttribute
-  @UIComponentTagAttribute()
-  void setAlt(String alt);
-
+  @UIComponentTagAttribute
+  void setValue(String value);
 }

Propchange: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIconTagDeclaration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIconTagDeclaration.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIndentTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIndentTagDeclaration.java?rev=984805&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIndentTagDeclaration.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeIndentTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -0,0 +1,47 @@
+package org.apache.myfaces.tobago.internal.taglib.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.component.RendererTypes;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
+
+/**
+ * Renders an indent beside a tree node.
+ */
+@Tag(name = "treeIndent")
+@UIComponentTag(
+    uiComponent = "org.apache.myfaces.tobago.component.UITreeIndent",
+    uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIIndent",
+    rendererType = RendererTypes.TREE_INDENT,
+    allowedChildComponenents = "NONE")
+public interface TreeIndentTagDeclaration
+    extends HasIdBindingAndRendered, HasTip, HasMarkup {
+
+  /**
+   * Show the lines and icons which are defining the tree structure.
+   */
+  @TagAttribute
+  @UIComponentTagAttribute(type = "boolean", defaultValue = "true")
+  void setShowJunctions(String showJunctions);
+}

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeLabelTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeLabelTagDeclaration.java?rev=984805&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeLabelTagDeclaration.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeLabelTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -0,0 +1,49 @@
+package org.apache.myfaces.tobago.internal.taglib.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.component.RendererTypes;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
+
+/**
+ * Renders a label inside of a tree.
+ */
+@Tag(name = "treeLabel")
+@UIComponentTag(
+    uiComponent = "org.apache.myfaces.tobago.component.UITreeLabel",
+    uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUILabel",
+    rendererType = RendererTypes.TREE_LABEL,
+    allowedChildComponenents = "NONE"
+)
+public interface TreeLabelTagDeclaration
+    extends HasIdBindingAndRendered, HasTip, HasMarkup, IsGridLayoutComponent {
+
+  /**
+   * Text value to display as label.
+   */
+  @TagAttribute
+  @UIComponentTagAttribute()
+  void setValue(String value);
+}

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxNodeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxNodeTagDeclaration.java?rev=984805&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxNodeTagDeclaration.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxNodeTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -0,0 +1,31 @@
+package org.apache.myfaces.tobago.internal.taglib.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.RendererTypes;
+
+/**
+ * Render a node for a tree as listbox.
+ */
+@UIComponentTag(
+    uiComponent = "org.apache.myfaces.tobago.component.UITreeNode",
+    generate = false,
+    rendererType = RendererTypes.TREE_LISTBOX_NODE)
+public interface TreeListboxNodeTagDeclaration extends TreeNodeTagDeclaration {
+}

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuCommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuCommandTagDeclaration.java?rev=984805&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuCommandTagDeclaration.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuCommandTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -0,0 +1,31 @@
+package org.apache.myfaces.tobago.internal.taglib.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.RendererTypes;
+
+/**
+ * Render for tree command inside of a tree menu.
+ */
+@UIComponentTag(
+    uiComponent = "org.apache.myfaces.tobago.component.UITreeCommand",
+    generate = false,
+    rendererType = RendererTypes.TREE_MENU_COMMAND)
+public interface TreeMenuCommandTagDeclaration extends TreeCommandTagDeclaration {
+}

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuLabelTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuLabelTagDeclaration.java?rev=984805&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuLabelTagDeclaration.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuLabelTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -0,0 +1,31 @@
+package org.apache.myfaces.tobago.internal.taglib.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.RendererTypes;
+
+/**
+ * Render for tree label inside of a tree menu.
+ */
+@UIComponentTag(
+    uiComponent = "org.apache.myfaces.tobago.component.UITreeLabel",
+    generate = false,
+    rendererType = RendererTypes.TREE_MENU_LABEL)
+public interface TreeMenuLabelTagDeclaration extends TreeLabelTagDeclaration {
+}

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuNodeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuNodeTagDeclaration.java?rev=984805&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuNodeTagDeclaration.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuNodeTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -0,0 +1,31 @@
+package org.apache.myfaces.tobago.internal.taglib.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.RendererTypes;
+
+/**
+ * Render for tree command inside of a tree menu.
+ */
+@UIComponentTag(
+    uiComponent = "org.apache.myfaces.tobago.component.UITreeNode",
+    generate = false,
+    rendererType = RendererTypes.TREE_MENU_NODE)
+public interface TreeMenuNodeTagDeclaration extends TreeNodeTagDeclaration {
+}

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -26,9 +26,7 @@ import org.apache.myfaces.tobago.apt.ann
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
-import org.apache.myfaces.tobago.internal.taglib.declaration.HasTreeNodeValue;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
-import org.apache.myfaces.tobago.internal.taglib.declaration.IsRequired;
 
 /**
  * A tree which will be displayed like a flat menu.
@@ -45,12 +43,8 @@ import org.apache.myfaces.tobago.interna
         "org.apache.myfaces.tobago.TreeData"
         })
 public interface TreeMenuTagDeclaration
-    extends HasIdBindingAndRendered, HasTreeNodeValue, IsRequired, IsGridLayoutComponent, HasMarkup {
+    extends HasIdBindingAndRendered, IsGridLayoutComponent, HasMarkup {
 
-  @TagAttribute
-  @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
-  void setShowRoot(String showRoot);
-  
   /**
    *
    * <strong>ValueBindingExpression</strong> pointing to a object to save the

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeNodeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeNodeTagDeclaration.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeNodeTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeNodeTagDeclaration.java Thu Aug 12 14:36:56 2010
@@ -26,10 +26,7 @@ import org.apache.myfaces.tobago.apt.ann
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.internal.taglib.declaration.AbstractCommandTagDeclaration;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
-import org.apache.myfaces.tobago.internal.taglib.declaration.HasImage;
-import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabel;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsDisabled;
@@ -52,8 +49,7 @@ import org.apache.myfaces.tobago.interna
     facets = {
         @Facet(name = Facets.ADDENDUM, description = "Displays an additional component to a node.")})
 public interface TreeNodeTagDeclaration
-    extends HasIdBindingAndRendered, HasLabel, HasMarkup, HasTip, HasImage, IsDisabled,
-    AbstractCommandTagDeclaration {
+    extends HasIdBindingAndRendered, HasMarkup, HasTip, IsDisabled {
 
   /**
    * Flag indicating if the subnodes are to be displayed.
@@ -70,6 +66,13 @@ public interface TreeNodeTagDeclaration
   void setMarked(String marked);
 
   /**
+   * Flag indicating if the node is selected (only possible, when the tree component allows it).
+   */
+  @TagAttribute()
+  @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
+  void setSelected(String selected);
+
+  /**
    * Method binding representing a expansionListener method that ....
    */
   @TagAttribute
@@ -77,4 +80,15 @@ public interface TreeNodeTagDeclaration
       expression = DynamicExpression.METHOD_BINDING_REQUIRED,
       methodSignature = "org.apache.myfaces.tobago.event.TreeExpansionEvent")
   void setTreeExpansionListener(String treeExpansionListener);
+
+  /**
+   * Method binding representing a expansionListener method that ....
+   */
+/*
+  @TagAttribute
+  @UIComponentTagAttribute(type = {},
+      expression = DynamicExpression.METHOD_BINDING_REQUIRED,
+      methodSignature = "org.apache.myfaces.tobago.event.TreeSelectionEvent")
+  void setTreeSelectionListener(String treeSelectionListener);
+*/
 }

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/TreeUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/TreeUtils.java?rev=984805&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/TreeUtils.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/TreeUtils.java Thu Aug 12 14:36:56 2010
@@ -0,0 +1,83 @@
+package org.apache.myfaces.tobago.internal.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.event.TreeExpansionEvent;
+import org.apache.myfaces.tobago.internal.component.AbstractUITree;
+import org.apache.myfaces.tobago.internal.component.AbstractUITreeNode;
+import org.apache.myfaces.tobago.model.TreeState;
+
+public final class TreeUtils {
+
+  private TreeUtils() {
+    // utils class
+  }
+
+  public static boolean isExpanded(AbstractUITree tree, AbstractUITreeNode node) {
+    TreeState state = (TreeState) tree.getState();
+    if (state != null) {
+      return state.getExpanded().contains(node.getPath());
+    } else {
+      return node.isExpanded();
+    }
+  }
+
+  public static void setExpanded(AbstractUITree tree, AbstractUITreeNode node, boolean expanded) {
+    boolean oldExpanded = isExpanded(tree, node);
+
+    if (tree.getState() != null) {
+      if (expanded) {
+        ((TreeState) tree.getState()).getExpanded().add(node.getPath());
+      } else {
+        ((TreeState) tree.getState()).getExpanded().remove(node.getPath());
+      }
+    } else {
+      node.setExpanded(expanded);
+    }
+    if (oldExpanded != expanded) {
+      new TreeExpansionEvent(node, node.isExpanded(), expanded).queue();
+    }
+  }
+
+  public static boolean isSelected(AbstractUITree tree, AbstractUITreeNode node) {
+    TreeState state = (TreeState) tree.getState();
+    if (state != null) {
+      return state.getSelected().contains(node.getPath());
+    } else {
+      return node.isSelected();
+    }
+  }
+
+  public static void setSelected(AbstractUITree tree, AbstractUITreeNode node, boolean selected) {
+    boolean oldSelected = isSelected(tree, node);
+
+    if (tree.getState() != null) {
+      if (selected) {
+        ((TreeState) tree.getState()).getSelected().add(node.getPath());
+      } else {
+        ((TreeState) tree.getState()).getSelected().remove(node.getPath());
+      }
+    } else {
+      node.setSelected(selected);
+    }
+    if (oldSelected != selected) {
+//      new TreeSelectionEvent(node, node.isSelected(), selected).queue();
+    }
+  }
+
+}

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeSelectable.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeSelectable.java?rev=984805&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeSelectable.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeSelectable.java Thu Aug 12 14:36:56 2010
@@ -0,0 +1,95 @@
+package org.apache.myfaces.tobago.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+public enum TreeSelectable {
+
+  OFF("off"),
+  MULTI("multi"),
+  SINGLE("single"),
+  MULTI_LEAF_ONLY("multiLeafOnly"),
+  SINGLE_LEAF_ONLY("singleLeafOnly"),
+  SIBLING("sibling"),
+  SIBLING_LEAF_ONLY("siblingLeafOnly"),
+  MULTI_SUB_TREE("multiSubTree"),
+  SINGLE_SUB_TREE("singleSubTree");
+
+  private String value;
+
+  TreeSelectable(String value) {
+    this.value = value;
+  }
+
+  public String getValue() {
+   return value;
+  }
+
+  private static final Map<String, TreeSelectable> MAPPING;
+
+  static {
+    MAPPING = new HashMap<String, TreeSelectable>();
+
+    for (TreeSelectable action : TreeSelectable.values()) {
+      MAPPING.put(action.getValue(), action);
+    }
+  }
+
+  /**
+   * @param name Name of the TreeSelectable
+   * @return The matching tree selection (can't be null).
+   * @throws IllegalArgumentException When the name doesn't match any TreeSelectable.
+   */
+  public static TreeSelectable parse(String name) throws IllegalArgumentException {
+    TreeSelectable value = MAPPING.get(name);
+    if (value != null) {
+      return value;
+    } else {
+      throw new IllegalArgumentException("Unknown name for TreeSelectable: '" + name + "'");
+    }
+  }
+
+  public boolean isSupportedByTree() {
+    return TREE_VALUES.contains(this);
+  }
+
+  private static final Set<TreeSelectable> TREE_VALUES = EnumSet.noneOf(TreeSelectable.class);
+
+  static {
+    TREE_VALUES.add(MULTI);
+    TREE_VALUES.add(SINGLE);
+    TREE_VALUES.add(MULTI_LEAF_ONLY);
+    TREE_VALUES.add(SINGLE_LEAF_ONLY);
+  }
+
+  public boolean isSupportedByTreeListbox() {
+    return TREE_LISTBOX_VALUES.contains(this);
+  }
+
+  private static final Set<TreeSelectable> TREE_LISTBOX_VALUES = EnumSet.noneOf(TreeSelectable.class);
+
+  static {
+    TREE_LISTBOX_VALUES.add(SINGLE);
+    TREE_LISTBOX_VALUES.add(MULTI_LEAF_ONLY);
+    TREE_LISTBOX_VALUES.add(SINGLE_LEAF_ONLY);
+  }
+}

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java Thu Aug 12 14:36:56 2010
@@ -28,13 +28,13 @@ import java.util.Set;
  * Manages the state on a Tree:<br />
  * 1. selection: selected tree-nodes<br />
  * 2. expandState: open/close folder state<br />
- * 3. marker: last used action object<br />
+ * 3. marked: last used action object<br />
  */
 public class TreeState {
 
   private Set<TreePath> expanded;
   private Set<TreePath> selected;
-  private Set<TreePath> marked;
+  private Set<TreePath> marked; // XXX Wy a set and not only a TreePath?
 
   @Deprecated
   private Set<DefaultMutableTreeNode> selection;
@@ -46,6 +46,7 @@ public class TreeState {
   private DefaultMutableTreeNode lastMarker;
   @Deprecated
   private String lastCommand;
+  // XXX ???
   private Integer[] scrollPosition;
 
   public TreeState() {
@@ -222,4 +223,3 @@ public class TreeState {
   }
 
 }
-

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java Thu Aug 12 14:36:56 2010
@@ -84,5 +84,13 @@ public final class HtmlAttributes {
    * Alternate to the src attribute, to implement a hover effect.
    */
   public static final String SRCDEFAULT = "srcdefault";
+  /**
+   * Alternate to the src attribute, icon open and close.
+   */
+  public static final String SRCCLOSE = "srcclose";
+  /**
+   * Alternate to the src attribute, icon open and close.
+   */
+  public static final String SRCOPEN = "srcopen";
 }
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Thu Aug 12 14:36:56 2010
@@ -197,6 +197,17 @@ public class ComponentUtils {
     return null;
   }
 
+  public static <T> T findAncestor(UIComponent component, Class<T> type) {
+
+    while (component != null) {
+      if (component.getClass().equals(type)) {
+        return (T) component;
+      }
+      component = component.getParent();
+    }
+    return null;
+  }
+
   /**
    * Find all sub forms of a component, and collects it.
    * It does not find sub forms of sub forms.

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp Thu Aug 12 14:36:56 2010
@@ -25,10 +25,12 @@
 
     <tc:treeMenu id="nav" state="#{navigation.state}">
       <tc:treeData value="#{navigation.tree}" var="node" id="data">
-        <tc:treeNode label="#{node.userObject.title}"
-                     action="#{node.userObject.action}"
-                     immediate="true"
-                     expanded="true"/>
+        <tc:treeNode rendered="#{not node.root}">
+          <tc:treeCommand
+              label="#{node.userObject.title}"
+              action="#{node.userObject.action}"
+              immediate="true"/>
+        </tc:treeNode>
       </tc:treeData>
     </tc:treeMenu>
 

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml Thu Aug 12 14:36:56 2010
@@ -19,10 +19,7 @@
 
 <f:subview id="navigator"
            xmlns:f="http://java.sun.com/jsf/core"
-           xmlns:tc="http://myfaces.apache.org/tobago/component"
-           xmlns:tx="http://myfaces.apache.org/tobago/extension"
-           xmlns:tf="http://myfaces.apache.org/tobago/facelet-extension"
-           xmlns:ui="http://java.sun.com/jsf/facelets">
+           xmlns:tc="http://myfaces.apache.org/tobago/component">
   <tc:panel>
     <f:facet name="layout">
       <tc:gridLayout rows="*"/>
@@ -30,10 +27,12 @@
 
     <tc:treeMenu id="nav" state="#{navigation.state}">
       <tc:treeData value="#{navigation.tree}" var="node" id="data">
-        <tc:treeNode label="#{node.userObject.title}"
-                     action="#{node.userObject.action}"
-                     immediate="true"
-                     expanded="true"/>
+        <tc:treeNode rendered="#{not node.root}">
+          <tc:treeCommand
+              label="#{node.userObject.title}"
+              action="#{node.userObject.action}"
+              immediate="true"/>
+        </tc:treeNode>
       </tc:treeData>
     </tc:treeMenu>
 

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/tree.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/tree.xhtml?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/tree.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/tree.xhtml Thu Aug 12 14:36:56 2010
@@ -134,5 +134,78 @@
 
     </tc:box>
 
+    <!-- old -->
+    <tc:tree showIcons="true" showJunctions="true" showRootJunction="true" showRoot="true" selectable="single">
+      <tc:treeData value="#{demo.tree}" var="node">
+        <tc:treeNode label="#{node.userObject.name}" expanded="true" image="image/feather.png"/>
+      </tc:treeData>
+    </tc:tree>
+
+    <!-- alternative #2 -->
+    <tc:tree >
+      <tc:treeData value="#{demo.tree}" var="node">
+        <tc:treeNode expanded="true" rendered="#{! node.root}">
+          <tc:treeJunction />
+          <tc:treeIcon value="image/feather.png" />
+          <tc:treeSelect value="#{node.selected}" />
+          <tc:treeLabel value="#{node.userObject.name}" />
+          <!-- or -->
+          <tc:treeCommand action="#{node....}" label="#{node.userObject.name}" />
+        </tc:treeNode>
+      </tc:treeData>
+      <tc:treeSelectValidator mode="single"/>
+    </tc:tree>
+
+    <!-- alternative #3 -->
+    <tc:tree>
+      <f:facet name="template">
+        <tc:panel>
+          <tc:treeJunction/>
+          <tc:treeIcon value="image/feather.png"/>
+        </tc:panel>
+      </f:facet>
+
+      <tc:treeNode rendered="false">
+        <tc:treeData value="#{demo.tree}" var="node">
+          <tc:treeNode expanded="true">
+            <tc:treeSelect value="#{node.selected}"/>
+            <tc:treeLabel value="#{node.userObject.name}"/>
+            <!-- or -->
+            <tc:treeCommand action="#{node....}" label="#{node.userObject.name}"/>
+          </tc:treeNode>
+        </tc:treeData>
+        <tc:treeNode>
+          <tc:treeLabel value="#{node.userObject.name}"/>
+        </tc:treeNode>
+      </tc:treeNode>
+      <tc:treeSelectValidator mode="single"/>
+    </tc:tree>
+
+    <!-- alternative #4 -->
+    <tc:treeListbox>
+      <tc:treeData value="#{demo.tree}" var="node">
+        <tc:treeNode label="#{node.userObject.name}">
+          <tc:treeSelect value="#{node.selected}"/>
+          <tc:treeLabel value="#{node.userObject.name}"/>
+        </tc:treeNode>
+      </tc:treeData>
+    </tc:treeListbox>
+
+    <!-- alternative #5 -->
+    <tc:treeMenu>
+      <tc:treeData value="#{demo.tree}" var="node">
+        <tc:treeNode expanded="">
+          <tc:treeCommand action="#{node....}" label="#{node.userObject.name}"/>
+        </tc:treeNode> 
+      </tc:treeData>
+    </tc:treeMenu>
+
+<!--
+Zu Beachten:
+ * passt das mit treeListbox, treeMenu
+ * passt das mit "von Hand" aufgebauten trees?
+-->
+  
+
   </tc:panel>
 </ui:composition>

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-listbox.jsp (from r979655, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-listbox.jsp?p2=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-listbox.jsp&p1=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp&r1=979655&r2=984805&rev=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-listbox.jsp Thu Aug 12 14:36:56 2010
@@ -21,61 +21,18 @@
 <f:view>
   <tc:loadBundle basename="demo" var="bundle"/>
 
-  <tc:page label="Sandbox - Tree" id="page" width="500px" height="1000px">
+  <tc:page label="Tree Menu" id="page" width="500px" height="1000px">
     <f:facet name="layout">
-      <tc:gridLayout margin="10px" rows="*;*;*"/>
+      <tc:gridLayout margin="10px" rows="*;*"/>
     </f:facet>
 
-    <tc:treeMenu id="menu" showRoot="true">
-      <tc:treeNode label="Root" id="root" expanded="true">
-        <tc:treeData value="#{treeController.tree}" var="node" id="data">
-          <tc:treeNode label="#{node.userObject.name}"
-                       id="template"
-                       expanded="#{node.userObject.expanded}"
-                       markup="#{node.userObject.markup}"
-                       tip="#{node.userObject.tip}"
-                       action="#{node.userObject.action}"
-                       disabled="#{node.userObject.disabled}"/>
-        </tc:treeData>
-        <tc:treeNode label="2 Action 1" action="#{treeController.action1}" id="action1"/>
-        <tc:treeNode label="3 Action 2" action="#{treeController.action2}" id="action2"/>
-        <tc:treeNode label="4 Action 3" action="#{treeController.action3}" id="action3">
-          <tc:treeNode label="4.1 On Click 1" onclick="alert('On Click 1');" id="click1"/>
-          <tc:treeNode label="4.2 On Click 2" onclick="alert('On Click 2');" id="click2">
-            <tc:treeNode label="4.2.1 On Click 3" onclick="alert('On Click 3');" id="click3"/>
-          </tc:treeNode>
-        </tc:treeNode>
-        <tc:treeNode label="5 Link" link="http://myfaces.apache.org/tobago/" id="link" tip="Subnode Link"/>
-        <tc:treeNode label="6 Target" action="#{treeController.action2}" target="Target Window"/>
-      </tc:treeNode>
-    </tc:treeMenu>
-
-    <tc:treeMenu>
+    <tc:treeListbox>
       <tc:treeData value="#{treeController.tree}" var="node" id="data">
-        <tc:treeNode label="#{node.userObject.name}"
-                     id="template"
-                     expanded="#{node.userObject.expanded}"
-                     markup="#{node.userObject.markup}"
-                     tip="#{node.userObject.tip}"
-                     action="#{node.userObject.action}"
-                     disabled="#{node.userObject.disabled}"/>
-      </tc:treeData>
-    </tc:treeMenu>
-
-    <tc:treeMenu>
-      <tc:treeNode label="Root" expanded="true">
-        <tc:treeNode label="2 Action 1"/>
-        <tc:treeNode label="3 Action 2"/>
-        <tc:treeNode label="4 Action 3">
-          <tc:treeNode label="4.1 On Click 1" onclick="alert('On Click 1');"/>
-          <tc:treeNode label="4.2 On Click 2" onclick="alert('On Click 2');">
-            <tc:treeNode label="4.2.1 On Click 3" onclick="alert('On Click 3');"/>
-          </tc:treeNode>
+        <tc:treeNode id="template" expanded="true">
+          <tc:treeLabel value="#{node.userObject.name}"/>
         </tc:treeNode>
-        <tc:treeNode label="5 Link" link="http://myfaces.apache.org/tobago/" tip="Subnode Link"/>
-        <tc:treeNode label="6 Target" target="Target Window"/>
-      </tc:treeNode>
-    </tc:treeMenu>
+      </tc:treeData>
+    </tc:treeListbox>
 
     <tc:cell/>
 

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp?rev=984805&r1=984804&r2=984805&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-menu.jsp Thu Aug 12 14:36:56 2010
@@ -21,60 +21,22 @@
 <f:view>
   <tc:loadBundle basename="demo" var="bundle"/>
 
-  <tc:page label="Sandbox - Tree" id="page" width="500px" height="1000px">
+  <tc:page label="Tree Menu" id="page" width="500px" height="1000px">
     <f:facet name="layout">
-      <tc:gridLayout margin="10px" rows="*;*;*"/>
+      <tc:gridLayout margin="10px" rows="*;*"/>
     </f:facet>
 
-    <tc:treeMenu id="menu" showRoot="true">
-      <tc:treeNode label="Root" id="root" expanded="true">
-        <tc:treeData value="#{treeController.tree}" var="node" id="data">
-          <tc:treeNode label="#{node.userObject.name}"
-                       id="template"
-                       expanded="#{node.userObject.expanded}"
-                       markup="#{node.userObject.markup}"
-                       tip="#{node.userObject.tip}"
-                       action="#{node.userObject.action}"
-                       disabled="#{node.userObject.disabled}"/>
-        </tc:treeData>
-        <tc:treeNode label="2 Action 1" action="#{treeController.action1}" id="action1"/>
-        <tc:treeNode label="3 Action 2" action="#{treeController.action2}" id="action2"/>
-        <tc:treeNode label="4 Action 3" action="#{treeController.action3}" id="action3">
-          <tc:treeNode label="4.1 On Click 1" onclick="alert('On Click 1');" id="click1"/>
-          <tc:treeNode label="4.2 On Click 2" onclick="alert('On Click 2');" id="click2">
-            <tc:treeNode label="4.2.1 On Click 3" onclick="alert('On Click 3');" id="click3"/>
-          </tc:treeNode>
-        </tc:treeNode>
-        <tc:treeNode label="5 Link" link="http://myfaces.apache.org/tobago/" id="link" tip="Subnode Link"/>
-        <tc:treeNode label="6 Target" action="#{treeController.action2}" target="Target Window"/>
-      </tc:treeNode>
-    </tc:treeMenu>
-
     <tc:treeMenu>
       <tc:treeData value="#{treeController.tree}" var="node" id="data">
-        <tc:treeNode label="#{node.userObject.name}"
-                     id="template"
-                     expanded="#{node.userObject.expanded}"
-                     markup="#{node.userObject.markup}"
-                     tip="#{node.userObject.tip}"
-                     action="#{node.userObject.action}"
-                     disabled="#{node.userObject.disabled}"/>
-      </tc:treeData>
-    </tc:treeMenu>
-
-    <tc:treeMenu>
-      <tc:treeNode label="Root" expanded="true">
-        <tc:treeNode label="2 Action 1"/>
-        <tc:treeNode label="3 Action 2"/>
-        <tc:treeNode label="4 Action 3">
-          <tc:treeNode label="4.1 On Click 1" onclick="alert('On Click 1');"/>
-          <tc:treeNode label="4.2 On Click 2" onclick="alert('On Click 2');">
-            <tc:treeNode label="4.2.1 On Click 3" onclick="alert('On Click 3');"/>
-          </tc:treeNode>
+        <tc:treeNode id="template" expanded="true" rendered="#{! node.root}">
+<%--
+          <tc:treeCommand label="#{node.userObject.name}" action="#{node.userObject.action}"/>
+--%>
+            <tc:treeCommand label="#{node.userObject.name}" rendered="#{node.childCount == 0}"
+                            action="#{node.userObject.action}"/>
+            <tc:treeLabel value="#{node.userObject.name}" rendered="#{node.childCount > 0}"/>
         </tc:treeNode>
-        <tc:treeNode label="5 Link" link="http://myfaces.apache.org/tobago/" tip="Subnode Link"/>
-        <tc:treeNode label="6 Target" target="Target Window"/>
-      </tc:treeNode>
+      </tc:treeData>
     </tc:treeMenu>
 
     <tc:cell/>