Index: component/src/com/icesoft/faces/component/tree/Tree.java =================================================================== --- component/src/com/icesoft/faces/component/tree/Tree.java (revision 122) +++ component/src/com/icesoft/faces/component/tree/Tree.java (working copy) @@ -225,7 +225,7 @@ super.encodeBegin(context); } - + private boolean keepSaved(FacesContext context) { Iterator clientIds = savedChildren.keySet().iterator(); @@ -242,8 +242,8 @@ } return false; - } - + } + /** * @param nodePath */ @@ -256,8 +256,8 @@ // put the current node on the request map this.setCurrentVarToRequestMap(facesContext, getCurrentNode()); - + // restore the state for current node restoreChildrenState(facesContext); @@ -275,8 +275,7 @@ * @return TreeModel model associated with tree */ public TreeModel getModel() { - ValueBinding vb = getValueBinding("value"); - return (TreeModel) vb.getValue(getFacesContext()); + return (TreeModel) getValue(); } /** @@ -344,9 +343,9 @@ * @return String style class property value. */ public String getStyleClass() { - return Util.getQualifiedStyleClass(this, - styleClass, - CSS_DEFAULT.TREE_DEFAULT_STYLE_CLASS, + return Util.getQualifiedStyleClass(this, + styleClass, + CSS_DEFAULT.TREE_DEFAULT_STYLE_CLASS, "styleClass"); } @@ -382,8 +381,8 @@ } String getTreeRowStyleClass() { - return Util.getQualifiedStyleClass(this, - CSS_DEFAULT.STYLE_TREEROW); + return Util.getQualifiedStyleClass(this, + CSS_DEFAULT.STYLE_TREEROW); } /** * @param imageProperty @@ -802,7 +801,7 @@ Object values[] = new Object[28]; values[0] = super.saveState(context); - values[1] = title; + values[1] = title; values[2] = navigationEventType; values[3] = imageDir; values[4] = navOpenTop; @@ -827,10 +826,10 @@ values[23] = hideNavigation; values[24] = nodePath; values[25] = savedChildren; - values[26] = pathToExpandedNode; + values[26] = pathToExpandedNode; values[27] = keyboardNavigationEnabled; - + return (values); } @@ -871,7 +870,7 @@ nodePath = (String) values[24]; savedChildren = (Map) values[25]; pathToExpandedNode = (String) values[26]; - keyboardNavigationEnabled = (Boolean) values[27]; + keyboardNavigationEnabled = (Boolean) values[27]; } @@ -1141,7 +1140,7 @@ this.title = title; } - // This class wraps TreeNode events + // This class wraps TreeNode events // the TreeNode generates an event and the Tree.queueEvent() // wraps the event in a NodeEvent which the Tree.broadcast // recieves and passes on to the TreeNode. @@ -1347,7 +1346,7 @@ void setPathToExpandedNode(String pathToExpandedNode) { this.pathToExpandedNode = pathToExpandedNode; } - + public boolean isKeyboardNavigationEnabled() { if (keyboardNavigationEnabled != null) { return keyboardNavigationEnabled.booleanValue(); @@ -1360,7 +1359,7 @@ public void setKeyboardNavigationEnabled(boolean keyboardNavigationEnabled) { this.keyboardNavigationEnabled = new Boolean(keyboardNavigationEnabled); - } + } } // Private class to represent saved state information for the children of the Tree component Index: component/src/com/icesoft/faces/component/tree/TreeRenderer.java =================================================================== --- component/src/com/icesoft/faces/component/tree/TreeRenderer.java (revision 122) +++ component/src/com/icesoft/faces/component/tree/TreeRenderer.java (working copy) @@ -45,6 +45,7 @@ import org.w3c.dom.Text; import javax.faces.component.UIComponent; +import javax.faces.component.UICommand; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.swing.tree.DefaultMutableTreeNode; @@ -139,8 +140,13 @@ validateParameters(facesContext, uiComponent, Tree.class); Tree treeComponent = (Tree) uiComponent; - TreeModel treeModel = (TreeModel) uiComponent + TreeModel treeModel = null; + if (uiComponent instanceof UICommand) { + treeModel = (TreeModel) ((UICommand) uiComponent).getValue(); + } else { + treeModel = (TreeModel) uiComponent .getValueBinding("value").getValue(facesContext); + } if (treeComponent.getChildCount() != 1) { throw new MalformedTreeTagException( @@ -180,8 +186,8 @@ String keydown = DomBasicRenderer.combinedPassThru(userKeyDown, keyboardSupport); rootDomNode.setAttribute(HTML.ONKEYDOWN_ATTR, keydown); String userClick = (String) uiComponent.getAttributes().get(HTML.ONCLICK_ATTR); - String click = DomBasicRenderer.combinedPassThru(userClick, keyboardSupport); - rootDomNode.setAttribute(HTML.ONCLICK_ATTR, click); + String click = DomBasicRenderer.combinedPassThru(userClick, keyboardSupport); + rootDomNode.setAttribute(HTML.ONCLICK_ATTR, click); } domContext.stepInto(uiComponent); @@ -213,8 +219,13 @@ DOMContext domContext = DOMContext.getDOMContext(facesContext, uiComponent); - TreeModel treeModel = (TreeModel) uiComponent + TreeModel treeModel = null; + if (uiComponent instanceof UICommand) { + treeModel = (TreeModel) ((UICommand) uiComponent).getValue(); + } else { + treeModel = (TreeModel) uiComponent .getValueBinding("value").getValue(facesContext); + } DefaultMutableTreeNode treeComponentRootNode = (DefaultMutableTreeNode) treeModel.getRoot(); Element rootNode = (Element) domContext.getRootNode(); @@ -275,7 +286,7 @@ parentDOMNode); } else { - // root node is hidden + // root node is hidden // put the next node on the request map Map requestMap = facesContext.getExternalContext().getRequestMap(); String varAttribute = treeComponent.getVar(); @@ -345,7 +356,7 @@ String pathToCurrentNode = TreeRenderer.getPathAsString(currentNode, (DefaultMutableTreeNode) treeComponent.getModel() .getRoot()); - + treeNode.setMutable(currentNode); treeNode.setId(Tree.ID_PREFIX + pathToCurrentRoot); treeNode.setParent(treeComponent); @@ -506,7 +517,7 @@ Element lineImage = domContext.createElement(HTML.IMG_ELEM); Text space = domContext.createTextNode(" "); treeNodeDiv.appendChild(space); - + treeNodeDiv.appendChild(lineImage); lineImage.setAttribute(HTML.BORDER_ATTR, "0"); lineImage.setAttribute(HTML.ALT_ATTR, ""); @@ -535,7 +546,7 @@ } catch (IOException e) { e.printStackTrace(); } - + treeNodeDiv.normalize(); } @@ -607,8 +618,8 @@ "tree_nav_bottom_open.gif"); tree_nav_top_close.setAttribute(HTML.SRC_ATTR, appBase + "tree_nav_top_close.gif"); - + imageLoaderDiv.appendChild(tree_document); imageLoaderDiv.appendChild(tree_line_blank); imageLoaderDiv.appendChild(tree_line_vertical); @@ -633,7 +644,7 @@ uiComponent, facesContext))); Element hiddenTreeAction = domContext.createElement(HTML.INPUT_ELEM); - hiddenTreeAction.setAttribute(HTML.TYPE_ATTR, "hidden"); + hiddenTreeAction.setAttribute(HTML.TYPE_ATTR, "hidden"); hiddenTreeAction.setAttribute(HTML.NAME_ATTR, CustomComponentUtils.getHiddenTreeActionFieldName( uiComponent.getClientId( facesContext),