public void encodePartially(FacesContext facesContext, UIComponent component) throws IOException {
Tree tree = (Tree) component;
ResponseWriter writer = facesContext.getResponseWriter();
Map<String,String> params = facesContext.getExternalContext().getRequestParameterMap();
String clientId = tree.getClientId(facesContext);
TreeNode root = (TreeNode) tree.getValue();
String rowKey = params.get(clientId + "_rowKey");
TreeNode currentNode = treeExplorer.findTreeNode(rowKey, new TreeModel(root));
int rowIndex = 0;
ServletResponse response = (ServletResponse) facesContext.getExternalContext().getResponse();
response.setContentType("text/xml");
writer.write("<nodes>");
for(Iterator<TreeNode> iterator = currentNode.getChildren().iterator(); iterator.hasNext();) {
TreeNode child = iterator.next();
UITreeNode uiTreeNode = tree.getUITreeNodeByType(child.getType());
facesContext.getExternalContext().getRequestMap().put(tree.getVar(), child.getData());
writer.write("<node>");
writer.write("<content>");
RendererUtils.startCDATA(facesContext);
renderChildren(facesContext, uiTreeNode);
RendererUtils.endCDATA(facesContext);
writer.write("</content>");
writer.write("<rowKey>" + rowKey + "." + rowIndex + "</rowKey>");
writer.write("<isLeaf>" + child.isLeaf() + "</isLeaf>");
if(uiTreeNode.getStyleClass() != null) {
writer.write("<contentClass>" + uiTreeNode.getStyleClass() + "</contentClass>");
}
writer.write("</node>");