protected void encodeIconForNodeState( FacesContext context, AbstractTree tree, AbstractTreeNode treeNode, TreeNodeState nodeState, String customIcon) throws IOException { if (Strings.isNullOrEmpty(customIcon)) { encodeDefaultIcon( context, treeNode, concatClasses( nodeState.getIconClass(), treeNode.getAttributes().get("iconClass"), tree.getAttributes().get("iconClass"))); } else { encodeCustomIcon( context, treeNode, concatClasses( nodeState.getCustomIconClass(), treeNode.getAttributes().get("iconClass"), tree.getAttributes().get("iconClass")), customIcon); } }
protected void encodeIcon(FacesContext context, UIComponent component) throws IOException { TreeNodeState nodeState = getNodeState(context); AbstractTreeNode treeNode = (AbstractTreeNode) component; AbstractTree tree = treeNode.findTreeComponent(); if (nodeState.isLeaf()) { String iconLeaf = (String) getFirstNonEmptyAttribute("iconLeaf", treeNode, tree); encodeIconForNodeState(context, tree, treeNode, nodeState, iconLeaf); } else { String iconExpanded = (String) getFirstNonEmptyAttribute("iconExpanded", treeNode, tree); String iconCollapsed = (String) getFirstNonEmptyAttribute("iconCollapsed", treeNode, tree); if (Strings.isNullOrEmpty(iconCollapsed) && Strings.isNullOrEmpty(iconExpanded)) { encodeIconForNodeState(context, tree, treeNode, nodeState, null); } else { SwitchType toggleType = TreeRendererBase.getToggleTypeOrDefault(treeNode.findTreeComponent()); if (toggleType == SwitchType.client || nodeState == TreeNodeState.collapsed) { encodeIconForNodeState(context, tree, treeNode, TreeNodeState.collapsed, iconCollapsed); } if (toggleType == SwitchType.client || nodeState == TreeNodeState.expanded || nodeState == TreeNodeState.expandedNoChildren) { encodeIconForNodeState(context, tree, treeNode, TreeNodeState.expanded, iconExpanded); } } } }