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 2012/02/03 15:49:15 UTC

svn commit: r1240197 - in /myfaces/tobago/branches/tobago-tree-table: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/ tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/stand...

Author: lofwyr
Date: Fri Feb  3 14:49:15 2012
New Revision: 1240197

URL: http://svn.apache.org/viewvc?rev=1240197&view=rev
Log:
TOBAGO-1049: Tree inside of the Sheet (aka TreeTable)
 - working on the "marked" hidden field
 - removing hidden field in tree for "selected", every node has its own field now

Modified:
    myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java
    myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxNodeRenderer.java
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxRenderer.java
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java?rev=1240197&r1=1240196&r2=1240197&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java Fri Feb  3 14:49:15 2012
@@ -18,12 +18,18 @@ package org.apache.myfaces.tobago.intern
  */
 
 import org.apache.myfaces.tobago.model.TreeDataModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import javax.faces.component.NamingContainer;
+import javax.faces.context.FacesContext;
 import javax.faces.model.DataModel;
 import javax.swing.tree.DefaultMutableTreeNode;
 
 public class AbstractUIData extends javax.faces.component.UIData {
 
+  private static final Logger LOG = LoggerFactory.getLogger(AbstractUIData.class);
+
   /**
    * Only for tree model.
    */
@@ -73,6 +79,23 @@ public class AbstractUIData extends java
   }
 
   /**
+   * Returns every time the real client id of the tree without the row id.
+   */
+  public String getTreeClientId(FacesContext facesContext) {
+    final String clientId = getClientId(facesContext);
+    final int rowIndex = getRowIndex();
+    if (rowIndex == -1) {
+      return clientId;
+    } else {
+      final String suffix = "" + NamingContainer.SEPARATOR_CHAR + rowIndex;
+      if (!clientId.endsWith(suffix)) {
+        LOG.error("The clientId has unknown format: '" + clientId + "'. It not ends with: '" + suffix + "'.");
+      }
+      return clientId.substring(0, clientId.length() - suffix.length());
+    }
+  }
+
+  /**
    * The value describes, if the UIData renderer creates container elements to hold the row information.
    * This information is important for the TreeNodeRenderer to set the visible state in the output or not.
    * Typically the Sheet returns true and a Tree returns false, because the sheet renders the HTML TR tags,

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java?rev=1240197&r1=1240196&r2=1240197&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java Fri Feb  3 14:49:15 2012
@@ -39,11 +39,21 @@ public abstract class AbstractUITree ext
 
   public static final String MESSAGE_NOT_LEAF = "tobago.tree.MESSAGE_NOT_LEAF";
 
+  /** deprecated since Tobago 1.5.? */
+  @Deprecated
   public static final String SEP = "-";
 
+  /** deprecated since Tobago 1.5.? */
+  @Deprecated
   public static final String SELECT_STATE = SEP + "selectState";
+
+  /** deprecated since Tobago 1.5.?  */
+  @Deprecated
   public static final String MARKED = "marked";
 
+  public static final String SUFFIX_MARKED = "marked";
+  public static final String SUFFIX_EXPANDED = "expanded";
+
   @Override
   public void processValidators(FacesContext facesContext) {
     final int last = hasRows() ? getFirst() + getRows() : Integer.MAX_VALUE;

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxNodeRenderer.java?rev=1240197&r1=1240196&r2=1240197&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxNodeRenderer.java Fri Feb  3 14:49:15 2012
@@ -90,7 +90,8 @@ public class TreeListboxNodeRenderer ext
     }
 
     // marked
-    String marked = (String) requestParameterMap.get(treeId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.MARKED);
+    String marked
+        = (String) requestParameterMap.get(treeId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_MARKED);
     if (marked != null) {
       String searchString = treeId + NamingContainer.SEPARATOR_CHAR + nodeStateId;
       boolean markedValue = marked.equals(searchString);

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxRenderer.java?rev=1240197&r1=1240196&r2=1240197&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxRenderer.java Fri Feb  3 14:49:15 2012
@@ -87,8 +87,8 @@ public class TreeListboxRenderer extends
 
     writer.startElement(HtmlElements.INPUT, tree);
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
-    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.MARKED);
-    writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.MARKED);
+    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_MARKED);
+    writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_MARKED);
     writer.writeAttribute(HtmlAttributes.VALUE, "", false);
     writer.endElement(HtmlElements.INPUT);
 

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java?rev=1240197&r1=1240196&r2=1240197&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java Fri Feb  3 14:49:15 2012
@@ -41,9 +41,7 @@ import org.apache.myfaces.tobago.webapp.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIData;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 import java.util.Map;
@@ -63,26 +61,28 @@ public class TreeMenuNodeRenderer extend
       return;
     }
 
-    final UIData data = ComponentUtils.findAncestor(node, UIData.class);
-    final String treeId = data.getClientId(facesContext);
-    final String nodeStateId = node.nodeStateId(facesContext);
+    final AbstractUIData data = ComponentUtils.findAncestor(node, AbstractUIData.class);
+    // we need the client id without the iterated row index here
+    final String treeId = data.getTreeClientId(facesContext);
+    final int rowIndex = data.getRowIndex();
     final Map<String, String> requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
     final String id = node.getClientId(facesContext);
     final boolean folder = node.isFolder();
 
     // expand state
 //    if (folder) { XXX this value seems to be not restored...
-    boolean expanded = Boolean.parseBoolean(requestParameterMap.get(id + ComponentUtils.SUB_SEPARATOR + "expanded"));
+    boolean expanded = Boolean.parseBoolean(
+        requestParameterMap.get(id + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_EXPANDED));
     if (node.isExpanded() != expanded) {
       new TreeExpansionEvent(node, node.isExpanded(), expanded).queue();
     }
 //    }
 
     // marked
-    String marked = (String) requestParameterMap.get(treeId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.MARKED);
+    String marked
+        = (String) requestParameterMap.get(treeId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_MARKED);
     if (marked != null) {
-      String searchString = treeId + NamingContainer.SEPARATOR_CHAR + nodeStateId;
-      boolean markedValue = marked.equals(searchString);
+      boolean markedValue = marked.equals("" + rowIndex);
       if (node.isMarked() != markedValue) {
         new TreeMarkedEvent(node, node.isMarked(), markedValue).queue();
       }
@@ -176,8 +176,8 @@ public class TreeMenuNodeRenderer extend
       TobagoResponseWriter writer, UITreeNode node, String clientId, boolean expanded) throws IOException {
     writer.startElement(HtmlElements.INPUT, node);
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
-    writer.writeClassAttribute(Classes.create(node, "expanded", Markup.NULL));
-    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "expanded");
+    writer.writeClassAttribute(Classes.create(node, AbstractUITree.SUFFIX_EXPANDED, Markup.NULL));
+    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_EXPANDED);
     writer.writeAttribute(HtmlAttributes.VALUE, Boolean.toString(expanded), false);
     writer.endElement(HtmlElements.INPUT);
   }

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java?rev=1240197&r1=1240196&r2=1240197&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java Fri Feb  3 14:49:15 2012
@@ -17,7 +17,6 @@ package org.apache.myfaces.tobago.render
  * limitations under the License.
  */
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.tobago.component.UITree;
 import org.apache.myfaces.tobago.component.UITreeNode;
 import org.apache.myfaces.tobago.context.Markup;
@@ -28,7 +27,6 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.component.AbstractUITree;
 import org.apache.myfaces.tobago.layout.Display;
 import org.apache.myfaces.tobago.layout.LayoutBase;
-import org.apache.myfaces.tobago.model.TreeSelectable;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.Style;
@@ -42,9 +40,7 @@ import org.apache.myfaces.tobago.webapp.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIData;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 import java.util.Map;
@@ -71,39 +67,28 @@ public class TreeNodeRenderer extends La
       return;
     }
 
-    final UIData data = ComponentUtils.findAncestor(node, UIData.class);
-    final String treeIdWithRow = data.getClientId(facesContext);
+    final AbstractUIData data = ComponentUtils.findAncestor(node, AbstractUIData.class);
     // we need the client id without the iterated row index here
-    final String treeId = treeIdWithRow.substring(0, treeIdWithRow.lastIndexOf(NamingContainer.SEPARATOR_CHAR));
-    final String nodeStateId = node.nodeStateId(facesContext);
+    final String treeId = data.getTreeClientId(facesContext);
+    final int rowIndex = data.getRowIndex();
     final Map<String, String> requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
     final String id = node.getClientId(facesContext);
     final boolean folder = node.isFolder();
 
     // expand state
     if (folder) {
-      boolean expanded = Boolean.parseBoolean(requestParameterMap.get(id + ComponentUtils.SUB_SEPARATOR + "expanded"));
+      boolean expanded = Boolean.parseBoolean(
+          requestParameterMap.get(id + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_EXPANDED));
       if (node.isExpanded() != expanded) {
         new TreeExpansionEvent(node, node.isExpanded(), expanded).queue();
       }
     }
 
-    // select
-    String searchString;
-    // todo: UISheet
-    if (data instanceof UITree && ((UITree)data).getSelectableAsEnum() != TreeSelectable.OFF) { // selection
-      String selected = (String) requestParameterMap.get(treeId + AbstractUITree.SELECT_STATE);
-      searchString = ";" + nodeStateId + ";";
-      if (StringUtils.contains(selected, searchString)) {
-        // TODO: add selection to Component
-        //state.addSelection((DefaultMutableTreeNode) node.getValue());
-      }
-    }
-
     // marked
-    String marked = (String) requestParameterMap.get(treeId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.MARKED);
+    String marked
+        = (String) requestParameterMap.get(treeId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_MARKED);
     if (marked != null) {
-      boolean markedValue = marked.equals(id);
+      boolean markedValue = marked.equals("" + rowIndex);
       if (node.isMarked() != markedValue) {
         new TreeMarkedEvent(node, node.isMarked(), markedValue).queue();
       }
@@ -192,8 +177,8 @@ public class TreeNodeRenderer extends La
       TobagoResponseWriter writer, UITreeNode node, String clientId, boolean expanded) throws IOException {
     writer.startElement(HtmlElements.INPUT, node);
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
-    writer.writeClassAttribute(Classes.create(node, "expanded", Markup.NULL));
-    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "expanded");
+    writer.writeClassAttribute(Classes.create(node, AbstractUITree.SUFFIX_EXPANDED, Markup.NULL));
+    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_EXPANDED);
     writer.writeAttribute(HtmlAttributes.VALUE, Boolean.toString(expanded), false);
     writer.endElement(HtmlElements.INPUT);
   }

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java?rev=1240197&r1=1240196&r2=1240197&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java Fri Feb  3 14:49:15 2012
@@ -84,32 +84,17 @@ public class TreeRenderer extends Layout
     writer.writeClassAttribute(Classes.create(tree));
     Style style = new Style(facesContext, tree);
     writer.writeStyleAttribute(style);
-
-    writer.startElement(HtmlElements.INPUT, tree);
-    writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
-    writer.writeNameAttribute(clientId);
     writer.writeIdAttribute(clientId);
-    writer.writeAttribute(HtmlAttributes.VALUE, ";", false);
-    writer.endElement(HtmlElements.INPUT);
 
     writer.startElement(HtmlElements.INPUT, tree);
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
-    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.MARKED);
-    writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.MARKED);
-    writer.writeClassAttribute(Classes.create(tree, "marked"));
+    final String markedId = clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_MARKED;
+    writer.writeNameAttribute(markedId);
+    writer.writeIdAttribute(markedId);
+    writer.writeClassAttribute(Classes.create(tree, AbstractUITree.SUFFIX_MARKED));
     writer.writeAttribute(HtmlAttributes.VALUE, "", false);
     writer.endElement(HtmlElements.INPUT);
 
-/*
-    if (tree.getSelectableAsEnum().isSupportedByTree()) {
-      writer.startElement(HtmlElements.INPUT, tree);
-      writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
-      writer.writeNameAttribute(clientId + AbstractUITree.SELECT_STATE);
-      writer.writeIdAttribute(clientId + AbstractUITree.SELECT_STATE);
-      writer.writeAttribute(HtmlAttributes.VALUE, ";", false);
-      writer.endElement(HtmlElements.INPUT);
-    }
-*/
     final int last = tree.hasRows() ? tree.getFirst() + tree.getRows() : Integer.MAX_VALUE;
     for (int rowIndex = tree.getFirst(); rowIndex < last; rowIndex++) {
       tree.setRowIndex(rowIndex);

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js?rev=1240197&r1=1240196&r2=1240197&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js Fri Feb  3 14:49:15 2012
@@ -162,7 +162,7 @@ Tobago.Tree.init = function(elements) {
     var node = command.parent(".tobago-treeNode");
     var tree = node.closest(".tobago-tree");
     var marked = tree.children(".tobago-tree-marked");
-    marked.attr("value", node.attr("id"));
+    marked.attr("value", Tobago.Tree.rowIndex(node));
     tree.find(".tobago-treeNode").removeClass("tobago-treeNode-markup-marked");
     node.addClass("tobago-treeNode-markup-marked");
   });
@@ -173,9 +173,13 @@ Tobago.Tree.init = function(elements) {
     var node = command.parent(".tobago-treeMenuNode");
     var tree = node.closest(".tobago-treeMenu");
     var marked = tree.children(".tobago-treeMenu-marked");
-    marked.attr("value", node.attr("id"));
+    marked.attr("value", Tobago.Tree.rowIndex(node));
     tree.find(".tobago-treeMenuNode").removeClass("tobago-treeMenuNode-markup-marked");
     node.addClass("tobago-treeMenuNode-markup-marked");
   });
 
 };
+
+Tobago.Tree.rowIndex = function (node) {
+  return node.attr("id").replace(/.+\:(\d+)(\:\w+)+/, '$1');
+};