Пример #1
0
  public DataVisitResult process(FacesContext facesContext, Object rowKey, Object argument) {
    RowHolderBase holder = (RowHolderBase) argument;
    Row row = holder.getRow();
    row.setRowKey(facesContext, rowKey);

    try {
      ResponseWriter writer = facesContext.getResponseWriter();
      encodeRow(writer, facesContext, holder);
    } catch (IOException e) {
      throw new FacesException(e);
    }

    holder.nextCell();
    return DataVisitResult.CONTINUE;
  }
Пример #2
0
  @Override
  protected void doCleanup(FacesContext context, RowHolderBase rowHolder) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    AbstractDataGrid dataGrid = (AbstractDataGrid) rowHolder.getRow();

    int cell = rowHolder.getProcessCell();
    int columns = dataGrid.getColumns();
    int rest = columns - cell;

    for (int i = 0; i < rest; i++) {
      writer.startElement(HtmlConstants.TD_ELEM, dataGrid);
      writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg-c", null);
      writer.endElement(HtmlConstants.TD_ELEM);
    }
    writer.endElement(HtmlConstants.TR_ELEMENT);
  }
Пример #3
0
 @Override
 public void encodeFakeRow(FacesContext facesContext, RowHolderBase rowHolder) throws IOException {
   UIComponent component = (UIComponent) rowHolder.getRow();
   ResponseWriter writer = facesContext.getResponseWriter();
   writer.startElement(HtmlConstants.TR_ELEMENT, component);
   writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "display:none", null);
   writer.startElement(HtmlConstants.TD_ELEM, component);
   writer.endElement(HtmlConstants.TD_ELEM);
   writer.endElement(HtmlConstants.TR_ELEMENT);
 }
Пример #4
0
  @Override
  public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder)
      throws IOException {
    AbstractDataGrid dataGrid = (AbstractDataGrid) rowHolder.getRow();

    int columns = dataGrid.getColumns();
    int processCell = rowHolder.getProcessCell();

    if (columns > 0 && (processCell % columns == 0)) {
      if (processCell != 0) {
        writer.endElement(HtmlConstants.TR_ELEMENT);
        rowHolder.resetProcessCell();
      }
      writer.startElement(HtmlConstants.TR_ELEMENT, dataGrid);
      writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg-r", null);
      rowHolder.nextRow();
    }

    writer.startElement(HtmlConstants.TD_ELEM, dataGrid);
    writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg-c", null);
    renderChildren(facesContext, dataGrid);
    writer.endElement(HtmlConstants.TD_ELEM);
  }