public void encodeChildren()

in trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/ShowOneListRendererBase.java [134:291]


  public void encodeChildren(FacesContext context, UIComponent component)
    throws IOException
  {
    writeAdditionalJS(context, component); // To spit out additional JS if any
    String position;
    String alignment;
    
    // In the case of narrow-screen PDAs, to reduce component's width, 
    // position is always top and alignment is always left. 
    if(XhtmlRenderer.supportsNarrowScreen
                    (RenderingContext.getCurrentInstance()))
    {
      position = _POSITION_TOP;
      alignment = _ALIGNMENT_LEFT;
    }
    else
    {
      alignment = _getAlignment(component);
      if (alignment == null)
      {
        alignment = _ALIGNMENT_DEFAULT_VALUE;
      }
      // No need to check for invalid value of alignment attr value as
      // it's handled below.

      // If the position is either null or an invalid value, default it.
      position = _getPosition(component);
      if (! positionMap.containsKey(position))
      {
        position = _POSITION_DEFAULT_VALUE;
      }
    }

    _LOG.finest("ShowOneListRendererBase.encodeChildren: alignment: {0}, position: {1} ",
                new Object[]{alignment, position} );

    ResponseWriter out = context.getResponseWriter();

    String disclosedItemId = _getDisclosedItemId(context, component);
    RenderingContext arc = RenderingContext.getCurrentInstance();
    boolean isDesktop = (arc.getAgent().getType().equals(Agent.TYPE_DESKTOP));

    // Wrap the table element with a div tag for mobile browsers since some of it 
    // doesn't support PPR for table element. 
    if(!isDesktop )
    {
      out.startElement("div", component);
      out.writeAttribute("id", component.getClientId(context), null);
    }
    out.startElement("table", component);
    if(isDesktop )
    {
      out.writeAttribute("id", component.getClientId(context), null);
    }

    String shortDesc = (String) component.getAttributes().get("shortDesc");
    if (shortDesc != null)
    {
      out.writeAttribute("summary", shortDesc, null);
    }
    else
    {
      out.writeAttribute("summary", "", null);
    }
    out.writeAttribute("border", "0", null);
    out.writeAttribute("cellspacing", "0", null);
    out.writeAttribute("cellpadding", "0", null);

    String styleClass = (String) component.getAttributes().get("styleClass");
    
    if (styleClass != null)
    {
      XhtmlRenderer.renderStyleClass(context, arc, styleClass);
    }

    UIXRenderingContext rCtx = getRenderingContext(context, component);
    ShowOneUtils.renderGenericAttributes(rCtx, component, out);

    out.startElement("tr", component);

    // =-= rbaranwa push some of the below into functions
    if (position.equals(_POSITION_LEFT))
    {
      out.startElement("td", component);

      _renderAlignmentTopBottom(out, alignment);

      renderListDisplay(context, component,  disclosedItemId);
      out.endElement("td");

      renderSpacerTD(out, component, _SEPARATOR_SIZE);

      out.startElement("td", component);
      out.writeAttribute("align", "left", null);
      _findAndEncodeChild(context, component, disclosedItemId);
      out.endElement("td");
    }

    if (position.equals(_POSITION_RIGHT))
    {
      out.startElement("td", component);
      out.writeAttribute("align", "right", null);
      _findAndEncodeChild(context, component, disclosedItemId);
      out.endElement("td");

      renderSpacerTD(out, component, _SEPARATOR_SIZE);

      out.startElement("td", component);
      _renderAlignmentTopBottom(out, alignment);
      out.writeAttribute("align", "left", null);
      renderListDisplay(context, component,  disclosedItemId);
      out.endElement("td");
    }

    if (position.equals(_POSITION_BOTTOM))
    {
      out.startElement("td", component);
      _findAndEncodeChild(context, component, disclosedItemId);
      out.endElement("td");
      out.endElement("tr");

      _renderSpacerTR(out, component);

      out.startElement("tr", component);
      out.startElement("td", component);

      _renderAlignmentLeftRight(out, alignment);

      renderListDisplay(context, component,  disclosedItemId);
      out.endElement("td");
    }

    if (position.equals(_POSITION_TOP))
    {
      out.startElement("td", component);

      _renderAlignmentLeftRight(out, alignment);

      renderListDisplay(context, component,  disclosedItemId);
      out.endElement("td");
      out.endElement("tr");

      _renderSpacerTR(out, component);

      out.startElement("tr", component);

      out.startElement("td", component);
      _findAndEncodeChild(context, component, disclosedItemId);
      out.endElement("td");
    }

    out.endElement("tr");
    out.endElement("table");
    if(!isDesktop )
    { 
      out.endElement("div");
    }
  }