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

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


    {
      areWeRoot = false;
      currentNode = parentNode.get(parentNode.currentChild);
    }

    final ColumnData colData = tContext.getColumnData();
    int row = colData.getRowIndex();
    int waitUntilRow = currentNode.waitUntilRow;
    // check to see if this columnGroup's header has been rendered:
    if (waitUntilRow==0)
    {
      // this columnGroup's header has not been rendered. So we will render it
      // and skip rendering the headers of our children.
      int totalRows = colData.getHeaderRowSpan();
      int rowSpan = (totalRows - row) - currentNode.rows + 1;

      // This columnGroup may have a rowSpan > 1. So we need to indicate on
      // which row our children will start rendering:
      currentNode.waitUntilRow = rowSpan + row;

      String headerID = _renderColumnHeader(context, rc, tContext, column,
                                            rowSpan, currentNode.cols);
      if (headerID != null)
      {
        if (areWeRoot)
        {
          currentNode.headerIDs = headerID;
        }
        else
        {
          currentNode.headerIDs = parentNode.headerIDs+" "+headerID;
        }
      }
    }
    else if (row >= waitUntilRow)
    {
      // this columnGroup's header has already been rendered. And we have
      // skipped as many rows as necessary (for this columnGroup's
      // rowSpan). So now we can render the headers of our children.
      _setParentNode(tContext, currentNode);
      _renderChildren(context, column, currentNode);
      _setParentNode(tContext, parentNode);
      // and we are done. Do not increment the physicalIndex as our children
      // would have done so:
      return;
    }

    // at this point we need to increment the physical column index, since our
    // children did not render:
    // this columnGroup occupies as many physicalIndices as its colSpan:
    colData.setColumnIndex(colData.getPhysicalColumnIndex() +
                           currentNode.cols,
                           colData.getLogicalColumnIndex());
  }
View Full Code Here


    UIComponent           column,
    int                   rowSpan,
    int                   colSpan
    ) throws IOException
  {
    ColumnData colData = tContext.getColumnData();

    // only no-wrap header cells if specified
    boolean isNoWrap = getHeaderNoWrap(column, getFacesBean(column));

    // indicate to the headerNode that it is a column group header
    colData.setColumnGroupHeader(true);
    // indicate to the headerNode whether or not to permit wrapping:
    colData.setCurrentHeaderNoWrap(isNoWrap);

    final String colID =
      renderHeaderAndSpan(context, rc, tContext, column,
                          rowSpan, colSpan);
    colData.setColumnGroupHeader(false);
    colData.setCurrentHeaderNoWrap(false);

    return colID;
  }
View Full Code Here

    UIComponent           column,
    int                   rowSpan,
    int                   colSpan
    ) throws IOException
  {
    ColumnData colData = tContext.getColumnData();
    String colID;
    if (shouldRenderId(context, column) ||
        tContext.isExplicitHeaderIDMode())
      // =-=AEW THIS WILL GENERATE DIFFS FROM "unique ID" land
      colID = getClientId(context, column);
    else
      colID = null;


    int physicalIndex = colData.getPhysicalColumnIndex();
    int sortability = getSortability(tContext, column);
    boolean sortable = (sortability != SORT_NO) &&
                       supportsNavigation(rc);

    if(sortable)
    {
      // the sortable script has a "state" parameter, so add this
      // to the form data if the agent does not support dynamic
      // generation of elements (on those that do, form data elements
      // can be created on the fly as necessary); see the JS
      // referenced in this.getSortingOnclick
      Object domLevel =
        rc.getAgent().getCapabilities().get(TrinidadAgent.CAP_DOM);
      if(
        domLevel == null ||
        domLevel == TrinidadAgent.DOM_CAP_NONE ||
        domLevel == TrinidadAgent.DOM_CAP_FORM)
      {
        FormData formData = rc.getFormData();
        if(formData != null)
        {
          formData.addNeededValue(XhtmlConstants.STATE_PARAM);
        }
      }
    }

    // we do not want to wrap if wrapping has explicitly been disabled. if we
    // are inside a columnGroup then we need to check the header format on the
    // columnGroup: bug 3201579:
    boolean isNoWrap = colData.isColumnGroupHeader()
      ? colData.getCurrentHeaderNoWrap()
    // =-=AEW It's weird that we're going back to colData instead
    // of just looking on ourselves!  When we're in a columnGroup, sure.
      : colData.getHeaderNoWrap(physicalIndex);


    String sortIconName = _getIconName(sortability);
    Icon sortIcon = rc.getIcon(sortIconName);
    boolean hasSortingIcon = (sortIcon != null) && !sortIcon.isNull();

    // we do not want to wrap if there is an icon on the header:
    // On PDA, where screen width is limited, we cannot afford not to
    // wrap.  isPDA check is used in several places in this class.
    // PDA specific logic will be moved to PDA render kit in the future.
    if (!isPDA(rc))
    {
      isNoWrap = isNoWrap || hasSortingIcon;
    }
    //       || getRequired(bean);
    //       || getMessageType(bean);

    Object width = tContext.getColumnWidth(physicalIndex);

    ResponseWriter rw = context.getResponseWriter();
    rw.startElement("th", column);
    rw.writeAttribute("id", colID, "id");

    CellUtils.renderHeaderAttrs(context, tContext,
                                null, //abbreviation (MISSING!)
                                width,
                                isNoWrap,
                                true); //isColHeader

    String styleClass = getSortableHeaderStyleClass(tContext, sortability);
    String borderStyleClass =
      CellUtils.getHeaderBorderStyle(tContext,
                                     rc,
                                     true, //isColHeader
                                     sortable);

    renderStyleClasses(context, rc, new String[]{ styleClass,
                                                   borderStyleClass});

    String style = getHeaderInlineStyle(rc);
    renderInlineStyleAttribute(context, rc, column, style);

    if (colSpan > 1)
      rw.writeAttribute("colspan", IntegerUtils.getString(colSpan), null);

    if (rowSpan == 0)
      rowSpan = colData.getHeaderRowSpan();
    if (rowSpan > 1)
      rw.writeAttribute("rowspan", IntegerUtils.getString(rowSpan), null);

    String sortOnclick = "";
    if (supportsScripting(rc))
View Full Code Here

    _setParentNode(tContext, currentNode);

    // "Render" the children to execute their "compute mode"
    _renderChildren(context, component, currentNode);

    ColumnData colData = tContext.getColumnData();
    if (areWeRoot)
    {
      colData.setHeaderRowSpan(currentNode.rows);
      int cols = currentNode.cols + colData.getColumnCount() - 1;
      colData.setColumnCount(cols);
    }
    else
    {
      int rows = currentNode.rows+1;
      if (parentNode.rows < rows)
View Full Code Here

   */
  protected String getSortableHeaderStyleClass(
    TableRenderingContext tContext,
    int                   sortability)
  {
    ColumnData colData = tContext.getColumnData();
    // if we are a columnGroup header, then we must be centered:
    if (colData.isColumnGroupHeader())
    {
      return SkinSelectors.AF_COLUMN_HEADER_ICON_STYLE;
    }

    switch (sortability)
View Full Code Here

    physicalColumnIndex = super.renderSpecialColumns(context,
                                                     arc,
                                                     tContext,
                                                     component,
                                                     physicalColumnIndex);
    final ColumnData colData = tContext.getColumnData();
    TreeTableRenderingContext ttrc = (TreeTableRenderingContext) tContext;
    if (ttrc.isFocusColumnVisible())
    {
      colData.setColumnIndex(physicalColumnIndex++,
                             ColumnData.SPECIAL_COLUMN_INDEX);
      SpecialColumnRenderer focusRenderer = getFocusColumnRenderer();
      UIComponent column = focusRenderer.getSpecialColumn();
      delegateRenderer(context, arc, column,
                       getFacesBean(column), focusRenderer);
    }

    // render the object hierarchy column:
    colData.setColumnIndex(physicalColumnIndex++,
                           ColumnData.SPECIAL_COLUMN_INDEX);
    UIComponent treeNodeColumn = ttrc.getTreeNodeStamp();
    delegateRenderer(context, arc, treeNodeColumn,
                     getFacesBean(treeNodeColumn), _TREE_NODE);
View Full Code Here

    FacesContext          context,
    RenderingContext   arc,
    TableRenderingContext tContext,
    UIComponent           component) throws IOException
  {
    ColumnData colData = tContext.getColumnData();
    if (colData.getColumnCount() <= 0)
    {
      // see bug 2633464
      if (_LOG.isWarning())
        _LOG.warning("TABLE_HAS_NO_VISIABLE_COLUMN", tContext.getTableId());
View Full Code Here

    int                   physicalColumnIndex)
    throws IOException
  {
    // renders a whole bunch of <TH>...</TH> elements, or <TD>..</TD> elements
    // depending on the RenderStage
    final ColumnData colData = tContext.getColumnData();
    int[] hidden = tContext.getHiddenColumns();
    List<UIComponent> children = treeTable.getChildren();
    int colCount  = children.size();
    for (int i = 0;  i < colCount;  i++)
    {
      if (hidden[i] != TableRenderingContext.NORMAL_COLUMN)
        continue;
     
      UIComponent child = children.get(i);
      if (!(child instanceof UIXColumn))
        continue;

      UIXColumn column = (UIXColumn) child;
      boolean isRowHeader = Boolean.TRUE.equals(
            column.getAttributes().get(CoreColumn.ROW_HEADER_KEY.getName()));
      if (isRowHeader)
      {
        colData.setColumnIndex(physicalColumnIndex, i);
        encodeChild(context, column);
        // ColumnBeans automatically increment the physical and logical
        // column indices (these may be increase by more than one, if
        // there are columnGroups). So we must not increment the column
        // indices here
        physicalColumnIndex = colData.getPhysicalColumnIndex();
      }
      else
        break;
    }

    // special case... render the selection column
    if (tContext.hasSelection())
    {
      colData.setColumnIndex(physicalColumnIndex, ColumnData.SPECIAL_COLUMN_INDEX);

      _renderSelectionColumn(context, arc, tContext);
      physicalColumnIndex++;
    }
    // special case... render the detail column
    UIComponent detail = tContext.getDetail();
    if (detail != null)
    {
      colData.setColumnIndex(physicalColumnIndex, ColumnData.SPECIAL_COLUMN_INDEX);
      _renderDetailColumn(context, arc);

      physicalColumnIndex++;
    }
View Full Code Here

  {
    // renders <TR> followed by a whole bunch of <TD>..</TD>, followed by
    // </TR>
    ResponseWriter writer = context.getResponseWriter();
    writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
    final ColumnData colData = tContext.getColumnData();
    int physicalColumn = 0;

    int objectNameColumnIndex = colData.getObjectNameColumnIndex();
    for (int i = 0, sz = Math.max(specialColumnCount, objectNameColumnIndex);  i < sz;  i++)
    {
      _renderEmptyCell(context, arc, tContext, physicalColumn++, null, 1);
    }

    int totalCols = tContext.getActualColumnCount();
    UIComponent table = tContext.getTable();
    FacesBean bean = getFacesBean(table);

    if (emptyTextRenderer == null)
    {
      _renderEmptyCell(context, arc, tContext, physicalColumn,
                       getEmptyText(bean), totalCols - physicalColumn);
      physicalColumn++;
    }
    else
    {
      delegateRenderer(context, arc, table, bean,  emptyTextRenderer);
      while (physicalColumn < totalCols)
      {
        _renderEmptyCell(context, arc, tContext, physicalColumn++, null, 1);
      }
    }
    // clear the current header id
    colData.setCurrentHeaderID(null);
    writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
  }
View Full Code Here

    TableRenderingContext tContext,
    int physicalColumn,
    String text,
    int    colspan) throws IOException
  {
    ColumnData colData = tContext.getColumnData();
    ResponseWriter writer = context.getResponseWriter();
    // root columns only, so headerID is singleton
    // rather than space-separated list
    String colID = colData.getHeaderID(physicalColumn);
    colData.setCurrentHeaderID(colID);
    colData.setColumnIndex(physicalColumn, ColumnData.SPECIAL_COLUMN_INDEX);
    writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
    renderCellFormatAttributes(context, arc, tContext);
    if (colspan > 1)
      writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, colspan, null);
    if (text != null)
View Full Code Here

TOP

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

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.