}
protected void encodeMarkup(FacesContext context, Tree tree) throws IOException {
ResponseWriter writer = context.getResponseWriter();
String clientId = tree.getClientId(context);
TreeNode root = (TreeNode) tree.getValue();
boolean dynamic = tree.isDynamic();
boolean selectable = tree.getSelectionMode() != null;
boolean checkbox = selectable && tree.getSelectionMode().equals("checkbox");
//container class
String containerClass = Tree.CONTAINER_CLASS;
containerClass = selectable ? containerClass + " " + Tree.SELECTABLE_CLASS : containerClass;
containerClass = tree.getStyleClass() == null ? containerClass : containerClass + " " + tree.getStyleClass();
writer.startElement("div", tree);
writer.writeAttribute("id", clientId, null);
writer.writeAttribute("class", containerClass, null);
if(tree.getStyle() != null)
writer.writeAttribute("style", tree.getStyle(), null);
writer.startElement("ul", null);
writer.writeAttribute("class", Tree.ROOT_NODES_CLASS, null);
if(root != null) {
root.setExpanded(true);
encodeTreeNode(context, tree, root, clientId, null, dynamic, checkbox);
}
writer.endElement("ul");