protected void renderTabItem()

in trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java [1362:1555]


  protected void renderTabItem(
    FacesContext        context,
    RenderingContext    rc,
    ResponseWriter      rw,
    Map<String, Object> itemData,
    boolean             isRtl
    ) throws IOException
  {
    rw.startElement("table", null);
    OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);

    String appendedStyle = "display: inline;";

    // In Safari and webkit browsers display:inline doesn't work as expected, and
    // display:inline-block need to be used to make the table inline.
    // NokiaS60 has a webkit based browser
    if (rc.getAgent().getAgentName() == Agent.AGENT_WEBKIT || isNokiaS60(rc))
    {
      appendedStyle = "display: inline-block;";
    }
    writeInlineStyles(rw, toString(itemData.get("inlineStyle")),
      appendedStyle); // user's style + what we must have on top of it
    rw.writeAttribute("title", itemData.get("shortDesc"), null);
    StringBuilder itemStyleClass = new StringBuilder();
    String userStyleClass = toString(itemData.get("styleClass"));
    if (userStyleClass != null)
    {
      itemStyleClass.append(userStyleClass);
      itemStyleClass.append(" "); // more style classes are appended below
    }

    // Assign the event handlers:
    boolean isDisabled = getBooleanFromProperty(itemData.get("isDisabled"));
    boolean isActive = getBooleanFromProperty(itemData.get("isActive"));
    String sectionStyleClass1;
    String sectionStyleClass2 = null;
    if (isActive)
    {
      if (isDisabled)
      {
        sectionStyleClass2 = SkinSelectors.P_AF_DISABLED;
      }
      sectionStyleClass1 =
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_ACTIVE_STYLE_CLASS;
    }
    else
    {
      if (isDisabled)
      {
        sectionStyleClass2 = SkinSelectors.P_AF_DISABLED;
      }
      sectionStyleClass1 =
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_INACTIVE_STYLE_CLASS;
    }
    renderStyleClass(context, rc, itemStyleClass.toString());
    rw.startElement("tbody", null);
    _writeInlineTbodyStyles(rc, rw);
    rw.startElement("tr", null);

    boolean isFirst = getBooleanFromProperty(itemData.get("isFirst"));
    boolean isLast = getBooleanFromProperty(itemData.get("isLast"));
    boolean previousActive = getBooleanFromProperty(itemData.get("previousActive"));

    // start portion of tab:
    if (isFirst)
    {
      // first start
      rw.startElement("td", null);
      _renderTabSection(
        context,
        rc,
        rw,
        sectionStyleClass1,
        sectionStyleClass2,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_START_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_START_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_START_CONTENT_STYLE_CLASS,
        null,
        isDisabled,
        isRtl);
      rw.endElement("td");
    }
    else if (previousActive)
    {
      // start-join-selected-to-deselected
      rw.startElement("td", null);
      _renderTabSection(
        context,
        rc,
        rw,
        sectionStyleClass1,
        sectionStyleClass2,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_START_JOIN_FROM_ACTIVE_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_END_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_MID_CONTENT_STYLE_CLASS,
        null,
        isDisabled,
        isRtl);
      rw.endElement("td");
    }
    else if (isActive)
    {
      // start-join-deselected-to-selected
      rw.startElement("td", null);
      _renderTabSection(
        context,
        rc,
        rw,
        sectionStyleClass1,
        sectionStyleClass2,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_START_JOIN_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_START_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_START_CONTENT_STYLE_CLASS,
        null,
        isDisabled,
        isRtl);
      rw.endElement("td");
    }
    else
    {
      // start-join-deselected-to-deselected
      rw.startElement("td", null);
      _renderTabSection(
        context,
        rc,
        rw,
        sectionStyleClass1,
        sectionStyleClass2,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_START_JOIN_FROM_INACTIVE_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_END_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_MID_CONTENT_STYLE_CLASS,
        null,
        isDisabled,
        isRtl);
      rw.endElement("td");
    }

    // mid portion of tab:
    rw.startElement("td", null);
    _renderTabSection(
      context,
      rc,
      rw,
      sectionStyleClass1,
      sectionStyleClass2,
      SkinSelectors.AF_NAVIGATION_LEVEL_TABS_MID_STYLE_CLASS,
      SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_MID_STYLE_CLASS,
      SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_MID_CONTENT_STYLE_CLASS,
      itemData,
      isDisabled,
      isRtl);
    rw.endElement("td");

    if (isLast)
    {
      // last end
      rw.startElement("td", null);
      _renderTabSection(
        context,
        rc,
        rw,
        sectionStyleClass1,
        sectionStyleClass2,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_END_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_END_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_END_CONTENT_STYLE_CLASS,
        null,
        isDisabled,
        isRtl);
      rw.endElement("td");
    }
    else if ( isActive ||  (!getBooleanFromProperty(itemData.get("nextActive"))) )
    {
      // end-join-selected-to-deselected or end-join-deselected-to-deselected
      rw.startElement("td", null);
      _renderTabSection(
        context,
        rc,
        rw,
        sectionStyleClass1,
        sectionStyleClass2,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_END_JOIN_TO_INACTIVE_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_END_JOIN_STYLE_CLASS,
        SkinSelectors.AF_NAVIGATION_LEVEL_TABS_BOTTOM_END_CONTENT_STYLE_CLASS,
        null,
        isDisabled,
        isRtl);
      rw.endElement("td");
    }

    rw.endElement("tr");
    rw.endElement("tbody");
    rw.endElement("table");
  }