public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.startElement("treeitem",component);
TreeItemComponent treeItemComponent = (TreeItemComponent) component;
DefaultMutableTreeNode treeNode = treeItemComponent.getCurrentTreeNode();
String nodeId = computeId(facesContext,treeItemComponent);
treeItemComponent.setNodeId(nodeId);
if(!isParentSmoothlyUpdateable(component)){
if (treeItemComponent instanceof SmoothlyUpdateable) {
SmoothlyUpdateable smoothlyUpdateable = (SmoothlyUpdateable) treeItemComponent;
if (smoothlyUpdateable.needsUpdate()) {
Bridge bridge = XulUtils.getBridge();
Zone zone = new Zone(nodeId);
bridge.addCommand(new UpdateZoneCommand(zone,buildTargetName(component)));
}
}
}
responseWriter.writeAttribute("id",nodeId, "id");
if(treeNode.getChildCount() > 0){
responseWriter.writeAttribute("container","true","container");
}
renderAttributes(facesContext,component,(List) component.getAttributes().get("annotatedAttributes"));
// Render open attribute
Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
if (paramMap.containsKey(nodeId)) {
String value = (String) paramMap.get(nodeId);
Boolean booleanValue = treeItemComponent.getOpen();
if(booleanValue != null){
if(booleanValue.toString(booleanValue.booleanValue()).equals(value)){
renderAttribute(facesContext,component,"open");
}
}