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

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


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

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

    try
    {
      tContext.install();

      ResponseWriter rw = context.getResponseWriter();

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

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

      // start the outer table:
      rw.startElement(XhtmlConstants.TABLE_ELEMENT, null);
      renderTableAttributes(context, arc, 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, arc, tContext, component);

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

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

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


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

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

        rw.startElement(XhtmlConstants.SCRIPT_ELEMENT, null);
        renderScriptDeferAttribute(context, arc);
        // Bug #3426092:
        // render the type="text/javascript" attribute in accessibility mode
        renderScriptTypeAttribute(context, arc);

        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(arc))
      {
        XhtmlUtils.addLib(context, arc, "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, arc);
          // Bug #3426092:
          // render the type="text/javascript" attribute in accessibility mode
          renderScriptTypeAttribute(context, arc);
          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.
      arc.setSkinResourceKeyMap(oldSkinResourceMap);

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

  }
View Full Code Here


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

    }

    @Override
    protected boolean getShowAll(FacesBean bean)
    {
      TableRenderingContext tContext =
        TableRenderingContext.getCurrentInstance();
      UIComponent component = tContext.getTable();
      if (component instanceof UIXTable)
      {
        UIXTable table = (UIXTable) component;
        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

     * @todo Deal with repeating!
     */
    @Override
    protected String getClientId(FacesContext context, UIComponent component)
    {
      TableRenderingContext tContext =
        TableRenderingContext.getCurrentInstance();
      return tContext.getTableId() + "-nb";
    }
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

    return true;
  }

  private boolean _isInTable()
  {
    TableRenderingContext tContext =
      TableRenderingContext.getCurrentInstance();
    if (tContext != null)
    {
      return TableRenderingContext.isInsideContentOfTable();
    }
View Full Code Here

  {
    Object hAlign = node.getAttributeValue(context, H_ALIGN_ATTR);

    if (hAlign==null)
    {
      TableRenderingContext tContext =
        TableRenderingContext.getCurrentInstance();
      // =-= ACW: if we are inside a table, we must default the align
      // attribute to middle.  if we don't do this we get bug 2188751.
      //  if we always default to left, we get bug 2372048.
      // the 'left' and 'right' values have terrible vertical alignment.
      // 'middle' works best.
      if ((tContext != null) &&
          (tContext.getRenderStage().getStage() == RenderStage.DATA_STAGE))
      {
        hAlign = MIDDLE_ATTRIBUTE_VALUE;
      }
    }
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.