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 2006/11/13 18:59:00 UTC

svn commit: r474419 [2/2] - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/ core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/model/ core/src/main/java/org/apache/myfaces/tobago...

Added: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java?view=auto&rev=474419
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java (added)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java Mon Nov 13 09:58:59 2006
@@ -0,0 +1,311 @@
+package org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag;
+
+/*
+ * 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.renderkit.RendererBase;
+import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UITreeOldNode;
+import org.apache.myfaces.tobago.component.UITreeOld;
+import org.apache.myfaces.tobago.model.TreeState;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.lang.StringEscapeUtils;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.component.UIComponent;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIParameter;
+import javax.faces.component.UIForm;
+import javax.faces.event.ActionEvent;
+import javax.swing.tree.DefaultMutableTreeNode;
+import java.util.Map;
+import java.io.IOException;
+
+@Deprecated
+public class TreeOldNodeRenderer extends RendererBase {
+
+  private static final Log LOG = LogFactory.getLog(TreeOldNodeRenderer.class);
+
+  public void decode(FacesContext facesContext, UIComponent component) {
+    if (ComponentUtil.isOutputOnly(component)) {
+      return;
+    }
+
+    UITreeOldNode node = (UITreeOldNode) component;
+    UITreeOld tree = node.findTreeRoot();
+    TreeState state = tree.getState();
+    String treeId = tree.getClientId(facesContext);
+    String nodeId = node.getId();
+    final Map requestParameterMap
+        = facesContext.getExternalContext().getRequestParameterMap();
+
+    // expand state
+    String expandState = (String) requestParameterMap.get(treeId);
+    String searchString = ";" + nodeId + ";";
+    if (expandState.indexOf(searchString) > -1) {
+      state.addExpandState((DefaultMutableTreeNode) node.getValue());
+    }
+
+
+    if (TreeOldRenderer.isSelectable(tree)) { // selection
+      String selected = (String) requestParameterMap.get(treeId + UITreeOld.SELECT_STATE);
+      searchString = ";" + nodeId + ";";
+      if (selected.indexOf(searchString) > -1) {
+        state.addSelection((DefaultMutableTreeNode) node.getValue());
+      }
+    }
+
+    // marker
+    String marked = (String) requestParameterMap.get(treeId + UITreeOld.MARKER);
+    if (marked != null) {
+      searchString = treeId + NamingContainer.SEPARATOR_CHAR + nodeId;
+
+      if (marked.equals(searchString)) {
+        state.setMarker((DefaultMutableTreeNode) node.getValue());
+      }
+    }
+
+
+    // link
+    // FIXME: this is equal to the CommandRendererBase, why not use that code?
+    String actionId = ComponentUtil.findPage(component).getActionId();
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("actionId = '" + actionId + "'");
+      LOG.debug("nodeId = '" + treeId + NamingContainer.SEPARATOR_CHAR
+          + nodeId + "'");
+    }
+    if (actionId != null
+        && actionId.equals(treeId + NamingContainer.SEPARATOR_CHAR + nodeId)) {
+      UICommand treeNodeCommand
+          = (UICommand) tree.getFacet(UITreeOld.FACET_TREE_NODE_COMMAND);
+      if (treeNodeCommand != null) {
+        UIParameter parameter = ensureTreeNodeParameter(treeNodeCommand);
+        parameter.setValue(node.getId());
+//        LOG.error("no longer supported: treeNodeCommand.fireActionEvent(facesContext));");
+//        treeNodeCommand.fireActionEvent(facesContext); // FIXME jsfbeta
+//        component.queueEvent(new ActionEvent(component));
+        treeNodeCommand.queueEvent(new ActionEvent(treeNodeCommand));
+      }
+
+      UIForm form = ComponentUtil.findForm(component);
+      if (form != null) {
+        form.setSubmitted(true);
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("setting Form Active: " + form.getClientId(facesContext));
+        }
+      }
+
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("actionId: " + actionId);
+        LOG.debug("nodeId: " + nodeId);
+      }
+    }
+
+    node.setValid(true);
+  }
+
+  private UIParameter ensureTreeNodeParameter(UICommand command) {
+    UIParameter treeNodeParameter = null;
+    for (Object o : command.getChildren()) {
+      UIComponent component = (UIComponent) o;
+      if (component instanceof UIParameter) {
+        UIParameter parameter = (UIParameter) component;
+        if (parameter.getName().equals(UITreeOld.PARAMETER_TREE_NODE_ID)) {
+          treeNodeParameter = parameter;
+        }
+      }
+    }
+    if (treeNodeParameter == null) {
+      treeNodeParameter = new UIParameter();
+      treeNodeParameter.setName(UITreeOld.PARAMETER_TREE_NODE_ID);
+    }
+    return treeNodeParameter;
+  }
+
+  public void encodeBegin(FacesContext facesContext,
+                                UIComponent component) throws IOException {
+
+    UITreeOldNode treeNode = (UITreeOldNode) component;
+
+    String clientId = treeNode.getClientId(facesContext);
+    UIComponent parent = treeNode.getParent();
+
+    String parentClientId = null;
+    if (parent != null && parent instanceof UITreeOldNode) { // if not the root node
+      parentClientId = treeNode.getParent().getClientId(facesContext);
+    }
+
+    UITreeOld root = treeNode.findTreeRoot();
+    String rootId = root.getClientId(facesContext);
+
+    String jsClientId = TreeOldRenderer.createJavascriptVariable(clientId);
+    String jsParentClientId = TreeOldRenderer.createJavascriptVariable(
+        parentClientId);
+//  rootId = HtmlUtils.createJavascriptVariable(rootId);
+
+    TreeState treeState = root.getState();
+    if (treeState == null) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("No treeState found. clientId=" + clientId);
+      }
+    } else {
+
+      DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeNode.getValue();
+
+      ResponseWriter writer = facesContext.getResponseWriter();
+
+      String debuging = null;
+
+      writer.writeText("  var ", null);
+      writer.writeText(jsClientId, null);
+      writer.writeText(" = new TreeNode('", null);
+      // label
+      Object name = treeNode.getAttributes().get(TobagoConstants.ATTR_NAME);
+      if (LOG.isDebugEnabled()) {
+        debuging += name + " : ";
+      }
+      if (name != null) {
+        writer.writeText(StringEscapeUtils.escapeJavaScript(name.toString()), null);
+      } else {
+        LOG.warn("name = null");
+      }
+      writer.writeText("','", null);
+
+      // id
+      writer.writeText(clientId, null);
+      writer.writeText("','", null);
+
+      writer.writeText(root.getMode(), null);
+      writer.writeText("',", null);
+
+      // is folder
+      writer.writeText(component.getChildCount() > 0, null);
+      writer.writeText(",", null);
+      writer.writeText(Boolean.toString(!root.isShowIcons()), null);
+      writer.writeText(",", null);
+      writer.writeText(Boolean.toString(!root.isShowJunctions()), null);
+      writer.writeText(",", null);
+      writer.writeText(Boolean.toString(!root.isShowRootJunction()), null);
+      writer.writeText(",", null);
+      writer.writeText(Boolean.toString(!root.isShowRoot()), null);
+      writer.writeText(",'", null);
+      writer.writeText(rootId, null);
+      writer.writeText("',", null);
+      String selectable = ComponentUtil.getStringAttribute(root,
+          TobagoConstants.ATTR_SELECTABLE);
+      if (selectable != null
+          && (!(selectable.equals("multi") || selectable.equals("multiLeafOnly")
+          || selectable.equals("single") || selectable.equals("singleLeafOnly")
+          || selectable.equals("sibling") || selectable.equals("siblingLeafOnly")))) {
+        selectable = null;
+      }
+      if (selectable != null) {
+        writer.writeText("'", null);
+        writer.writeText(selectable, null);
+        writer.writeText("'", null);
+      } else {
+        writer.writeText("false", null);
+      }
+      writer.writeText(",", null);
+      writer.writeText(Boolean.toString(ComponentUtil.getBooleanAttribute(root,
+          TobagoConstants.ATTR_MUTABLE)), null);
+      writer.writeText(",'", null);
+      writer.writeText(
+          ComponentUtil.findPage(component).getFormId(facesContext), null);
+      writer.writeText("',", null);
+      if (component.getChildCount() == 0
+          || (selectable != null && !selectable.endsWith("LeafOnly"))) {
+        boolean selected = treeState.isSelected(node);
+        writer.writeText(Boolean.toString(selected), null);
+        if (LOG.isDebugEnabled()) {
+          debuging += selected ? "S" : "-";
+        }
+      } else {
+        writer.writeText("false", null);
+        if (LOG.isDebugEnabled()) {
+          debuging += "-";
+        }
+        if (treeState.isSelected(node)) {
+          LOG.warn("Ignore selected FolderNode in LeafOnly selection tree!");
+        }
+      }
+      writer.writeText(",", null);
+      writer.writeText(Boolean.toString(treeState.isMarked(node)), null);
+      writer.writeText(",", null);
+      // expanded
+      boolean expanded = treeState.isExpanded(node);
+      writer.writeText(Boolean.toString(expanded), null);
+      if (LOG.isDebugEnabled()) {
+        debuging += expanded ? "E" : "-";
+      }
+      writer.writeText(",", null);
+
+      // required
+      writer.writeText(Boolean.toString(root.isRequired()), null);
+      writer.writeText(",", null);
+
+      // disabled
+      writer.writeText(ComponentUtil.getBooleanAttribute(treeNode,
+          TobagoConstants.ATTR_DISABLED), null);
+
+      // resources
+      writer.writeText(",treeResourcesHelp", null);
+      writer.writeText(",", null);
+
+      // action (not implemented)
+      writer.writeText("null", null);
+      writer.writeText(",", null);
+
+      // parent
+      if (jsParentClientId != null) {
+        writer.writeText(jsParentClientId, null);
+      } else {
+        writer.writeText("null", null);
+      }
+      writer.writeText(",", null);
+
+      // icon (not implemented)
+      writer.writeText("null", null);
+      writer.writeText(",", null);
+
+      // open folder icon (not implemented)
+      writer.writeText("null", null);
+      writer.writeText(", '", null);
+
+      // width
+      writer.writeText("300", null);
+      writer.writeText("');\n", null);
+
+/*
+      if (jsParentClientId != null) { // if not the root node
+        writer.writeText("  ", null);
+        writer.writeText(jsParentClientId, null);
+        writer.writeText(".add(", null);
+        writer.writeText(jsClientId, null);
+        writer.writeText(");\n", null);
+      }
+*/
+      if (LOG.isDebugEnabled()) {
+        LOG.debug(debuging);
+      }
+    }
+  }
+}

Propchange: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldRenderer.java?view=auto&rev=474419
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldRenderer.java (added)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldRenderer.java Mon Nov 13 09:58:59 2006
@@ -0,0 +1,261 @@
+package org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag;
+
+/*
+ * 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.renderkit.RendererBase;
+import org.apache.myfaces.tobago.renderkit.RenderUtil;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
+import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UITreeOld;
+import org.apache.myfaces.tobago.component.UITreeOldNode;
+import org.apache.myfaces.tobago.model.TreeState;
+import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.apache.myfaces.tobago.config.TobagoConfig;
+import org.apache.myfaces.tobago.context.ResourceManagerUtil;
+import org.apache.myfaces.tobago.TobagoConstants;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.component.NamingContainer;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.StringTokenizer;
+
+@Deprecated
+public class TreeOldRenderer extends RendererBase {
+
+  /**
+   * Resources to display the tree.
+   */
+  private static final String[] TREE_IMAGES = {
+      "openfoldericon.gif",
+      "foldericon.gif",
+      "unchecked.gif",
+      "uncheckedDisabled.gif",
+      "checked.gif",
+      "checkedDisabled.gif",
+      "new.gif",
+      "T.gif",
+      "L.gif",
+      "I.gif",
+      "Lminus.gif",
+      "Tminus.gif",
+      "Rminus.gif",
+      "Lplus.gif",
+      "Tplus.gif",
+      "Rplus.gif",
+      "treeMenuOpen.gif",
+      "treeMenuClose.gif",
+  };
+
+
+  @Override
+  public void decode(FacesContext facesContext, UIComponent component) {
+    if (ComponentUtil.isOutputOnly(component)) {
+      return;
+    }
+
+    UITreeOld tree = (UITreeOld) component;
+    TreeState state = tree.getState();
+
+    if (state != null) {
+      if ("Tree".equals(tree.getRendererType())) {
+        state.clearExpandState();
+      }
+      if (isSelectable(tree)) {
+        state.clearSelection();
+      }
+      if (ComponentUtil.getBooleanAttribute(tree, TobagoConstants.ATTR_MUTABLE)) {
+        state.setMarker(null);
+      }
+    }
+    tree.setValid(true);
+  }
+
+  public static boolean isSelectable(UITreeOld tree) {
+    return tree.isSelectableTree();
+  }
+
+  public static String createJavascriptVariable(String clientId) {
+    return clientId == null
+        ? null
+        : clientId.replace(NamingContainer.SEPARATOR_CHAR, '_');
+  }
+
+  @Override
+  public void encodeEnd(FacesContext facesContext,
+      UIComponent component) throws IOException {
+
+    UITreeOld tree = (UITreeOld) component;
+
+    String clientId = tree.getClientId(facesContext);
+    UITreeOldNode root = tree.getRoot();
+
+    TobagoResponseWriter writer = (TobagoResponseWriter) facesContext.getResponseWriter();
+
+    writer.startElement(HtmlConstants.DIV, tree);
+    writer.writeComponentClass();
+    writer.writeAttribute(HtmlAttributes.STYLE, null, TobagoConstants.ATTR_STYLE);
+
+    writer.startElement(HtmlConstants.INPUT, tree);
+    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", null);
+    writer.writeNameAttribute(clientId);
+    writer.writeIdAttribute(clientId);
+    writer.writeAttribute(HtmlAttributes.VALUE, ";", null);
+    writer.endElement(HtmlConstants.INPUT);
+
+    writer.startElement(HtmlConstants.INPUT, tree);
+    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", null);
+    writer.writeNameAttribute(clientId + UITreeOld.MARKER);
+    writer.writeIdAttribute(clientId + UITreeOld.MARKER);
+    writer.writeAttribute(HtmlAttributes.VALUE, "", null);
+    writer.endElement(HtmlConstants.INPUT);
+
+    if (isSelectable(tree)) {
+      writer.startElement(HtmlConstants.INPUT, tree);
+      writer.writeAttribute(HtmlAttributes.TYPE, "hidden", null);
+      writer.writeNameAttribute(clientId + UITreeOld.SELECT_STATE);
+      writer.writeIdAttribute(clientId + UITreeOld.SELECT_STATE);
+      writer.writeAttribute(HtmlAttributes.VALUE, ";", null);
+      writer.endElement(HtmlConstants.INPUT);
+    }
+
+    if (ComponentUtil.getBooleanAttribute(tree, TobagoConstants.ATTR_MUTABLE)) {
+
+
+//      writer.startElement(HtmlConstants.DIV, null);
+//      writer.writeAttribute(HtmlAttributes.STYLE, "border: 2px groove #ddeeff", null);
+//      writer.writeText("", null);
+
+      UIComponent toolbar = tree.getFacet("mutableToolbar");
+      if (toolbar == null) {
+        toolbar = tree.getFacet("defaultToolbar");
+      }
+      RenderUtil.encode(facesContext, toolbar);
+
+
+//      writer.endElement(HtmlConstants.DIV);
+    }
+
+//    writer.startElement(HtmlConstants.DIV, null);
+    writer.startElement(HtmlConstants.TABLE, tree);
+    writer.writeAttribute(HtmlAttributes.CELLPADDING, "0", null);
+    writer.writeAttribute(HtmlAttributes.CELLSPACING, "0", null);
+    writer.writeAttribute(HtmlAttributes.BORDER, "0", null);
+    writer.writeAttribute(HtmlAttributes.SUMMARY, "", null);
+    writer.writeComponentClass();
+    writer.startElement(HtmlConstants.TR, null);
+    writer.startElement(HtmlConstants.TD, null);
+    writer.writeIdAttribute(clientId + "-cont");
+    writer.writeComment("placeholder for treecontent");
+    writer.endElement(HtmlConstants.TD);
+    writer.endElement(HtmlConstants.TR);
+    writer.endElement(HtmlConstants.TABLE);
+//    writer.endElement(HtmlConstants.DIV);
+
+    String[] scriptTexts = createJavascript(facesContext, clientId, root);
+
+    String[] scripts = {"script/tree.js"};
+    List<String> scriptFiles = ComponentUtil.findPage(tree).getScriptFiles();
+    for (String script : scripts) {
+      scriptFiles.add(script);
+    }
+
+    if (!TobagoConfig.getInstance(facesContext).isAjaxEnabled()) {
+      HtmlRendererUtil.startJavascript(writer);
+      for (String scriptText : scriptTexts) {
+        writer.writeText(scriptText, null);
+        writer.writeText('\n', null);
+      }
+      HtmlRendererUtil.endJavascript(writer);
+    } else {
+      HtmlRendererUtil.writeScriptLoader(facesContext, scripts, scriptTexts);
+    }
+
+    writer.endElement(HtmlConstants.DIV);
+  }
+
+  private String[] createJavascript(FacesContext facesContext, String clientId,
+                                  UITreeOldNode root)
+  throws IOException {
+    StringBuffer sb = new StringBuffer();
+
+    sb.append("{\n");
+
+    sb.append("  var treeResourcesHelp = new Object();\n");
+    for (String images : TREE_IMAGES) {
+      sb.append("  treeResourcesHelp[\"");
+      sb.append(images);
+      sb.append("\"] = \"");
+      sb.append(ResourceManagerUtil.getImageWithPath(facesContext,
+          "image/" + images));
+      sb.append("\";\n");
+    }
+    sb.append(" \n  treeResourcesHelp.getImage = function (name) {\n");
+    sb.append("    var result = this[name];\n");
+    sb.append("    if (result) {\n");
+    sb.append("      return result;\n");
+    sb.append("    } else {\n");
+    sb.append("      return \"");
+    sb.append(ResourceManagerUtil.getImageWithPath(facesContext, "image/blank.gif"));
+    sb.append("\";\n");
+    sb.append("    }\n");
+    sb.append("  };\n \n");
+
+    sb.append(getNodesAsJavascript(facesContext, root));
+
+    sb.append("  var treeDiv = document.getElementById('");
+    sb.append(clientId);
+    sb.append("-cont');\n");
+    sb.append("  treeDiv.innerHTML = ");
+    String rootNode = createJavascriptVariable(root.getClientId(facesContext));
+    sb.append(rootNode);
+    sb.append(".toString(0, true);\n  ");
+
+    sb.append(rootNode);
+    sb.append(".initSelection();\n");
+
+    sb.append("}");
+//    return sb.toString();
+    StringTokenizer tokenizer = new StringTokenizer(sb.toString(), "\n");
+    String[] strings = new String[tokenizer.countTokens()];
+    for (int i = 0; i < strings.length; i++) {
+      strings[i] = tokenizer.nextToken();
+    }
+    return strings;
+  }
+
+  protected String getNodesAsJavascript(FacesContext facesContext, UITreeOldNode root) throws IOException {
+    TobagoResponseWriter writer = (TobagoResponseWriter) facesContext.getResponseWriter();
+    StringWriter stringWriter = new StringWriter();
+    facesContext.setResponseWriter(writer.cloneWithWriter(stringWriter));
+    RenderUtil.encode(facesContext, root);
+    facesContext.setResponseWriter(writer);
+    return stringWriter.toString();
+  }
+
+  protected String nodeStateId(FacesContext facesContext, UITreeOldNode node) {
+    // this must do the same as nodeStateId() in tree.js
+    String clientId = node.getClientId(facesContext);
+    int last = clientId.lastIndexOf(':') + 1;
+    return clientId.substring(last);
+  }
+}

Propchange: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java?view=diff&rev=474419&r1=474418&r2=474419
==============================================================================
    (empty)

Modified: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/navigation.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/navigation.jsp?view=diff&rev=474419&r1=474418&r2=474419
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/navigation.jsp (original)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/navigation.jsp Mon Nov 13 09:58:59 2006
@@ -104,6 +104,9 @@
     <tc:link link="screenshot/tree.jsp"
              label="Tree" target="View"/>
 
+    <tc:link link="screenshot/treeOld.jsp"
+             label="Tree Old" target="View"/>
+
     <tc:link link="screenshot/treeListBox.jsp"
              label="TreeListBox" target="View"/>
 

Modified: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp?view=diff&rev=474419&r1=474418&r2=474419
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp (original)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp Mon Nov 13 09:58:59 2006
@@ -59,7 +59,7 @@
           <%--<tc:gridLayout rows="300px;1*" />--%>
           <tc:gridLayout rows="200px;300px;1*" />
         </f:facet>
-        <tc:tree state="#{treeState}" value="#{tree}" id="screenshotTree"
+        <tc:tree state="#{treeState}" id="screenshotTree"
             idReference="userObject"
             nameReference="userObject"
             showIcons="true"
@@ -67,9 +67,20 @@
             showRootJunction="true"
             showRoot="true"
             selectable="single"
-            mutable="false"
-            />
+            mutable="false">
+          <tc:treeNode label="Root">
+            <tc:treeNodes value="#{tree}"/>
+            <tc:treeNode label="Sub 1"/>
+            <tc:treeNode label="Sub 2"/>
+            <tc:treeNode label="Sub 3">
+              <tc:treeNode label="Sub 3.1"/>
+              <tc:treeNode label="Sub 3.2"/>
+            </tc:treeNode>
+            <tc:treeNode label="Sub 4"/>
+          </tc:treeNode>
+        </tc:tree>
 
+<%--
         <tc:tree state="#{treeState}" value="#{tree}"
             idReference="userObject"
             nameReference="userObject"
@@ -79,6 +90,8 @@
             showRoot="false"
             mode="menu"
             />
+--%>
+        <tc:out value="Under construction"/>
 
         <tc:cell/>
 

Added: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeOld.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeOld.jsp?view=auto&rev=474419
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeOld.jsp (added)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeOld.jsp Mon Nov 13 09:58:59 2006
@@ -0,0 +1,90 @@
+<%--
+ * 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.
+--%>
+
+<%@ page import="javax.swing.tree.DefaultMutableTreeNode" %>
+<%@ page import="org.apache.myfaces.tobago.model.TreeState" %>
+
+<%
+  DefaultMutableTreeNode tree;
+  TreeState treeState;
+
+  tree = new DefaultMutableTreeNode("Category");
+  tree.insert(new DefaultMutableTreeNode("Sports"), 0);
+  tree.insert(new DefaultMutableTreeNode("Movies"), 0);
+  DefaultMutableTreeNode music = new DefaultMutableTreeNode("Music");
+  tree.insert(music, 0);
+  tree.insert(new DefaultMutableTreeNode("Games"), 0);
+  DefaultMutableTreeNode temp = new DefaultMutableTreeNode("Science");
+  temp.insert(
+      new DefaultMutableTreeNode("Geography"), 0);
+  temp.insert(
+      new DefaultMutableTreeNode("Mathematics"), 0);
+  DefaultMutableTreeNode temp2 = new DefaultMutableTreeNode("Astronomy");
+  temp2.insert(new DefaultMutableTreeNode("Education"), 0);
+  temp2.insert(new DefaultMutableTreeNode("Pictures"), 0);
+  temp.insert(temp2, 2);
+  tree.insert(temp, 2);
+  treeState = new TreeState();
+  treeState.addExpandState(tree);
+  treeState.addExpandState(temp);
+  treeState.addSelection(temp2);
+  treeState.setMarker(music);
+  session.setAttribute("tree", tree);
+  session.setAttribute("treeState", treeState);
+%>
+
+<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
+
+<layout:screenshot>
+  <f:subview id="tree">
+    <jsp:body>
+      <tc:panel>
+        <f:facet name="layout">
+          <%--<tc:gridLayout rows="300px;1*" />--%>
+          <tc:gridLayout rows="200px;300px;1*" />
+        </f:facet>
+        <tc:treeOld state="#{treeState}" value="#{tree}" id="screenshotTree"
+            idReference="userObject"
+            nameReference="userObject"
+            showIcons="true"
+            showJunctions="true"
+            showRootJunction="true"
+            showRoot="true"
+            selectable="single"
+            mutable="false"
+            />
+
+        <tc:treeOld state="#{treeState}" value="#{tree}"
+            idReference="userObject"
+            nameReference="userObject"
+            showIcons="false"
+            showJunctions="false"
+            showRootJunction="false"
+            showRoot="false"
+            mode="menu"
+            />
+
+        <tc:cell/>
+
+      </tc:panel>
+
+    </jsp:body>
+  </f:subview>
+</layout:screenshot>
+

Propchange: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeOld.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeOld.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL