@Override
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
final UITreeIndent indent = (UITreeIndent) component;
final UITreeNode node = ComponentUtils.findAncestor(indent, UITreeNode.class);
final AbstractUITree tree = ComponentUtils.findAncestor(indent, AbstractUITree.class);
final boolean folder = node.isFolder();
final int level = node.getLevel();
final boolean hasNextSibling = node.isHasNextSibling();
final List<Boolean> junctions = node.getJunctions();
final boolean showRoot = ((UITree) tree).isShowRoot();
final boolean showJunctions = indent.isShowJunctions();
final boolean showRootJunction = ((UITree) tree).isShowRootJunction();
final boolean expanded = folder && node.isExpanded() || !showRoot && level == 0;
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
encodeIndent(facesContext, writer, node, showJunctions, !showRoot || !showRootJunction && showJunctions, junctions);