private void _renderNode()

in trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java [516:705]


  private void _renderNode(
    UIXRenderingContext context,
    UIXHierarchy tree,
    UINode icon,
    UINode stamp,
    final String varName,
    RowKeySet state,
    Map<Object, Boolean> selectedPaths,
    Boolean[] prepend,
    boolean leftToRight,
    boolean isFirstSibling,
    boolean isLastSibling,
    int nodeDepth
    ) throws IOException
  {
    ResponseWriter writer = context.getResponseWriter();

    // each row is a table
    writer.startElement(TABLE_ELEMENT, null);
    renderLayoutTableAttributes(context, ZERO, ZERO, ZERO, null);
    writer.startElement(TABLE_ROW_ELEMENT, null);



    // render the prepend
    _prependIcons(context, tree, prepend, leftToRight);


    String onclickExpand = null;
    int expand = _getExpandValue(tree, state);

    if ((expand != NO_CHILDREN) &&
        supportsNavigation(context))
    {
      onclickExpand = TreeUtils.callJSExpandNode(tree, varName+".treeState",
                                                 (expand == EXPAND_CLOSED));
    }

    renderExpandCell(context,
                     tree,
                     leftToRight,
                     isFirstSibling,
                     isLastSibling,
                     expand,
                     onclickExpand);



//    DataObject curData = BeanAdapterUtils.getAdapter(context, tree.getRowData());
    String treeStyle = TREE_ROW_STYLE_CLASS;


    // location was a colon separated list of IDs
    //boolean selected = proxy.isSelected(context, node, location);
    Object currPath = tree.getRowKey();
    boolean selected = _isShownSelected(tree, selectedPaths, currPath); 

    String onClick = _callJSSelect(tree, varName);

//    if ( proxy.selectionEnabled(context) )
//    {
//      // selection with the proxy doesn't work on netscape
//      // filed as bug 1817185 - so far we have not figured
//      // out a way without using layers and we are seeing nodes
//      // jump around with layers so disabling selection on netscape
//      if ( isNetscape(context) )
//        selected = false;
//      else
//      {
//        if (supportsNavigation(context))
//          onClick = "return _select('" + treename + "'," + renderedIndex +
//            ",'" + location + "');";
//      }
//    }

    if (selected)
    {
        treeStyle = TREE_ROW_SELECTED_STYLE_CLASS;
    }

//    context.setCurrentDataObject(curData);

    // render the icon
    if( icon != null)
    {
      String backgroundIcon = getIconBackgroundIcon( expand, leftToRight );
  
      writer.startElement(TABLE_DATA_ELEMENT, null);
  
      if(backgroundIcon != null)
      {
        String backgroundIconURI = getAbsoluteImageURI( context,
                                                        backgroundIcon);
  
        StringBuffer backgroundStyle = new StringBuffer(
                                        _BACKGROUND_IMAGE_URL.length() +
                                        backgroundIconURI.length() +
                                        _END_FUNC.length() );
  
        backgroundStyle.append( _BACKGROUND_IMAGE_URL );
        backgroundStyle.append( backgroundIconURI );
        backgroundStyle.append( _END_FUNC );
        
        writer.writeAttribute(STYLE_ATTRIBUTE,
                              backgroundStyle.toString(),
                null);
      }

      icon.render(context);
      writer.endElement(TABLE_DATA_ELEMENT);
  
      // render space between icon and node stamp
      renderIconCell( context,
                      tree,
                      null,
                      TRANSPARENT_GIF,
                      false,
                      null, // alt Text
                      _NODE_SPACER,
                      _ICON_HEIGHT,
                      null );
    }

    // render the node stamp
    writer.startElement(TABLE_DATA_ELEMENT, null);
    writer.writeAttribute( NOWRAP_ATTRIBUTE, Boolean.FALSE, null);
    renderStyleClassAttribute(context, TREE_NODE_ADJUST_STYLE_CLASS);


    writer.startElement(SPAN_ELEMENT, null);
//    out.writeAttribute(ID_ATTRIBUTE,
//                       treename + IntegerUtils.getString(renderedIndex));
    renderStyleClassAttribute(context, treeStyle);
    writer.writeAttribute(ONCLICK_ATTRIBUTE, onClick, null);

    // if screen reader mode render the stamp with level of node from root
    _renderStampBasedOnAccessibilty(context, stamp, nodeDepth);

    writer.endElement(SPAN_ELEMENT);
    writer.endElement(TABLE_DATA_ELEMENT);

    // end row
    writer.endElement(TABLE_ROW_ELEMENT);
    //end table
    writer.endElement(TABLE_ELEMENT);

    // render children
    if ((expand == EXPAND_OPEN) || (expand == EXPAND_ALWAYS))
    {
      tree.enterContainer();
      int childCount = tree.getRowCount();

      if (childCount > 0)
      {
        // prepare the prepended icons for the child nodes
        prepend = _appendIcon(prepend,
                              (isLastSibling)
                                ? Boolean.FALSE
                                : Boolean.TRUE);
        Boolean[] currClone;


        ++nodeDepth; // increment the depth of the child from the root

        int oldIndex = tree.getRowIndex();
        for (int i = 0; i < childCount; i++)
        {
          currClone = new Boolean[prepend.length];
          System.arraycopy(prepend, 0, currClone, 0, prepend.length);

          tree.setRowIndex(i);
          _renderNode(context,
                      tree,
                      icon,
                      stamp,
                      varName,
                      state,
                      selectedPaths,
                      currClone,
                      leftToRight,
                      false,
                      (i == childCount - 1),
                      nodeDepth);
        }
        tree.setRowIndex(oldIndex);
        --nodeDepth;
      }
      tree.exitContainer();
    }
  }