Package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table

Examples of org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableRenderingContext


    FacesContext        context,
    RenderingContext arc,
    UIComponent         component,
    FacesBean           bean) throws IOException
  {
    TableRenderingContext tContext =
      TableRenderingContext.getCurrentInstance();

    if (tContext == null)
    {
      _LOG.warning("{0}: Column used outside of a Table", component);
      return;
    }


    if (_isColumnGroup(component))
    {
      _columnGroupRenderer.encodeAll(context, arc, component, bean);
      return;
    }

    // check to see if we are rendering a table column header, or table data
    RenderStage rs = tContext.getRenderStage();
    int stage = rs.getStage();
    switch (stage)
    {
    case RenderStage.INITIAL_STAGE:
      _computeMode(arc, tContext, component, bean);
      break;

    case RenderStage.COLUMN_HEADER_STAGE:
      _renderHeaderMode(context, arc, tContext, component);
      break;

    case RenderStage.COLUMN_FOOTER_STAGE:
      _renderFooterMode(context, arc, tContext, component);
      break;

    case RenderStage.TREE_NODE_STAGE:
      //      _renderHGridNodeStamp(context, arc, tContext, component);
      break;

    case RenderStage.DATA_STAGE:
      _renderDataMode(context, arc, tContext, component);
      break;

    case RenderStage.START_ROW_STAGE:
      _startRowMode(tContext, component);
      break;

    case RenderStage.END_STAGE:
      // we do not do any special clean up
      break;
    default:
      assert false : "Bad renderStage:"+stage;
    }

    // after we render, we must increment both the physical and the logical
    // column indices
    ColumnData colData = tContext.getColumnData();
    colData.incrementColumnIndex();
  }
View Full Code Here


    FacesContext        context,
    RenderingContext arc,
    UIComponent         component,
    FacesBean           bean) throws IOException
  {
    TableRenderingContext tContext =
      TableRenderingContext.getCurrentInstance();

    RenderStage rs = tContext.getRenderStage();
    int stage = rs.getStage();
    switch (stage)
    {
    case RenderStage.INITIAL_STAGE:
      _computeMode(context, tContext, component);
View Full Code Here

    }

    @Override
    protected String getClientId(FacesContext context, UIComponent component)
    {
      TableRenderingContext tContext = TableRenderingContext.getCurrentInstance();
      return tContext.getTableId();
    }
View Full Code Here

    // store TableRenderer's skin resource map, so that called to
    // context.getTranslatedValue will get the correct key.
    rc.setSkinResourceKeyMap(_resourceKeyMap);

    TableRenderingContext tContext = createRenderingContext(context,
                                        rc,
                                        component);

    try
    {
      tContext.install();

      ResponseWriter rw = context.getResponseWriter();

      rw.startElement("div", component);
      renderId(context, component);
      renderAllAttributes(context, rc, component, bean);

      // If we need to render a "special" empty table, then bail.
      if (renderTableWithoutColumns(context, rc, tContext, component))
          return;

      // start the outer table:
      rw.startElement(XhtmlConstants.TABLE_ELEMENT, null);
      renderTableAttributes(context, rc, component, bean, "0", "0");

      RenderStage renderStage = tContext.getRenderStage();
      assert (renderStage.getStage()==RenderStage.INITIAL_STAGE);

      // give the table's columns a chance to initialize:
      renderSingleRow(context, rc, tContext, component);

      // 1. render the header bars (title, controlbar and subcontrolbar)
      renderNavigationHeaderBars(context, rc, tContext, component, bean);

      // 2. render the table content
      renderTableContent(context, rc, tContext, component);

      // 3. render the footer bars (controlbar) if applicable
      if (_shouldRepeatControlBar(rc))
      {
        renderNavigationFooterBars(context, rc, tContext, component, bean);
      }

      // end the outertable:
      rw.endElement(XhtmlConstants.TABLE_ELEMENT);


      // gives some beans the chance to cleanup:
      renderStage.setStage(RenderStage.END_STAGE);
      renderSingleRow(context, rc, tContext, component);

      String tid = tContext.getTableId();
      FormData formData = rc.getFormData();
      if (formData != null)
      {
        // Add sorting parameters.
        // =-=AdamWiner FIXME: only really needed with sorting.
        formData.addNeededValue(XhtmlConstants.STATE_PARAM);
        formData.addNeededValue(XhtmlConstants.VALUE_PARAM);

        //HKuhn - no need for scripts in printable mode
        if (supportsScripting(rc))
        {
          rw.startElement(XhtmlConstants.SCRIPT_ELEMENT, null);
          renderScriptDeferAttribute(context, rc);
          // Bug #3426092:
          // render the type="text/javascript" attribute in accessibility mode
          renderScriptTypeAttribute(context, rc);

          String formName = formData.getName();

          rw.writeText(tContext.getJSVarName()+"="+
                 TreeUtils.createNewJSCollectionComponentState(formName, tid)+";", null);
          rw.endElement(XhtmlConstants.SCRIPT_ELEMENT);

        }
      }

      int first = tContext.getCollectionComponent().getFirst();

      if (supportsScripting(rc))
      {
        XhtmlUtils.addLib(context, rc, "TableProxy()");

        // Bug #2378405: Add a javascript variable giving the row number of
        // the first row in the displayed rowset.

        // Although it seems like we should check for existence here (to
        // prevent duplication), we actually should not. If we have multiple
        // tables on a page, they will all need independent value fields.

        // We'd really like to use the flattened name here, but a colon doesn't
        // work as part of a javascript variable name, so we have to build up a
        // pseudo flattened name of the form _<tableName>_value.
        // (=-=AEW Change code to write the value directly into the window,
        // so a colon *would* work;  however, if a field had an id of "value"
        // in the table, we'd get a conflict;  so don't change?)

        // Also, since 1 is by far the most common value, don't bother
        // writing it out: the Javascript will assume the value is 1 if
        // it isn't.
        int value = first + 1;
        if (value != 1)
        {
          rw.startElement(XhtmlConstants.SCRIPT_NAME, null);
          renderScriptDeferAttribute(context, rc);
          // Bug #3426092:
          // render the type="text/javascript" attribute in accessibility mode
          renderScriptTypeAttribute(context, rc);
          rw.writeText("window[\"_", null);
          rw.writeText(tContext.getTableId(), null);
          rw.writeText(_VALUE_FIELD_NAME, null);
          rw.writeText("\"]=", null);
          rw.writeText(IntegerUtils.getString(value), null);
          rw.endElement(XhtmlConstants.SCRIPT_NAME);
        }
      }

      OutputUtils.renderHiddenField(context,
                                    tContext.getTableId() + ":rangeStart",
                                    IntegerUtils.getString(first));

      rw.endElement("div");
    }
    finally
    {
      // restore current skin resource map. Most likely there won't be one.
      rc.setSkinResourceKeyMap(oldSkinResourceMap);

      if (tContext != null)
        tContext.release();
    }

  }
View Full Code Here

    FacesContext     context,
    RenderingContext rc,
    UIComponent      component
    )
  {
    return new TableRenderingContext(context, rc, component);
  }
View Full Code Here

    @Override
    protected String getClientId(
      FacesContext context,
      UIComponent  component)
    {
      TableRenderingContext tContext = TableRenderingContext.getCurrentInstance();
      return tContext.getTableId();
    }
View Full Code Here

    @Override
    protected boolean getShowAll(
      UIComponent component,
      FacesBean   bean)
    {
      TableRenderingContext tContext =
        TableRenderingContext.getCurrentInstance();
      UIComponent c = tContext.getTable();
      if (c instanceof UIXTable)
      {
        UIXTable table = (UIXTable)c;
        return table.isShowAll();
      }
View Full Code Here

    // For now, disable showAll except on UIXTable
    @Override
    protected boolean showAllSupported()
    {
      TableRenderingContext tContext =
        TableRenderingContext.getCurrentInstance();
      UIComponent component = tContext.getTable();
      return (component instanceof UIXTable);
    }
View Full Code Here

    }

    @Override
    protected String getSource()
    {
      TableRenderingContext tContext =
        TableRenderingContext.getCurrentInstance();
      return tContext.getTableId();
    }
View Full Code Here

    @Override
    protected String getClientId(
      FacesContext context,
      UIComponent  component)
    {
      TableRenderingContext tContext =
        TableRenderingContext.getCurrentInstance();
      return tContext.getTableId() + "-nb";
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableRenderingContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.