Example #1
0
  protected void exportRow(DataTable table, Writer writer, int rowIndex) throws IOException {
    String var = table.getVar().toLowerCase();
    table.setRowIndex(rowIndex);

    if (!table.isRowAvailable()) {
      return;
    }

    writer.write("\t<" + var + ">\n");
    exportCells(table, writer);
    writer.write("\t</" + var + ">\n");
  }
Example #2
0
  public void exportSelectionOnly(FacesContext context, DataTable table, Writer writer)
      throws IOException {
    Object selection = table.getSelection();
    String var = table.getVar();

    if (selection != null) {
      Map<String, Object> requestMap = context.getExternalContext().getRequestMap();

      if (selection.getClass().isArray()) {
        int size = Array.getLength(selection);

        for (int i = 0; i < size; i++) {
          requestMap.put(var, Array.get(selection, i));

          exportCells(table, writer);
        }
      } else {
        requestMap.put(var, selection);

        exportCells(table, writer);
      }
    }
  }