Пример #1
0
  protected void encodeRegularTable(FacesContext context, DataTable table) throws IOException {
    ResponseWriter writer = context.getResponseWriter();

    writer.startElement("div", null);
    writer.writeAttribute("class", DataTable.TABLE_WRAPPER_CLASS, null);

    writer.startElement("table", null);
    writer.writeAttribute("role", "grid", null);
    if (table.getTableStyle() != null) writer.writeAttribute("style", table.getTableStyle(), null);
    if (table.getTableStyleClass() != null)
      writer.writeAttribute("class", table.getTableStyleClass(), null);
    if (table.getSummary() != null) writer.writeAttribute("summary", table.getSummary(), null);

    encodeThead(context, table);
    encodeTFoot(context, table);
    encodeTbody(context, table, false);

    writer.endElement("table");
    writer.endElement("div");
  }
Пример #2
0
  protected void encodeScrollBody(
      FacesContext context, DataTable table, String tableStyle, String tableStyleClass)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String scrollHeight = table.getScrollHeight();

    writer.startElement("div", null);
    writer.writeAttribute("class", DataTable.SCROLLABLE_BODY_CLASS, null);
    if (scrollHeight != null && scrollHeight.indexOf("%") == -1) {
      writer.writeAttribute("style", "height:" + scrollHeight + "px", null);
    }
    writer.startElement("table", null);
    writer.writeAttribute("role", "grid", null);

    if (tableStyle != null) writer.writeAttribute("style", tableStyle, null);
    if (table.getTableStyleClass() != null) writer.writeAttribute("class", tableStyleClass, null);

    encodeColGroup(context, table);
    encodeTbody(context, table, false);

    writer.endElement("table");
    writer.endElement("div");
  }