Пример #1
0
  public void encode(FacesContext context, DataTableRenderer renderer, DataTable table)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    Map<String, String> params = context.getExternalContext().getRequestParameterMap();
    String clientId = table.getClientId(context);
    String[] cellInfo = params.get(clientId + "_cellInfo").split(",");
    int rowIndex = Integer.parseInt(cellInfo[0]);
    int cellIndex = Integer.parseInt(cellInfo[1]);
    int i = -1;
    UIColumn column = null;
    for (UIColumn col : table.getColumns()) {
      if (col.isRendered()) {
        i++;

        if (i == cellIndex) {
          column = col;
          break;
        }
      }
    }

    table.setRowIndex(rowIndex);

    if (column.isDynamic()) {
      DynamicColumn dynamicColumn = (DynamicColumn) column;
      dynamicColumn.applyStatelessModel();
    }

    if (table.isCellEditEscapeRequest(context)) {
      column.getCellEditor().getFacet("input").encodeAll(context);
    } else {
      column.getCellEditor().getFacet("output").encodeAll(context);
    }

    if (column.isDynamic()) {
      ((DynamicColumn) column).cleanStatelessModel();
    }
  }
Пример #2
0
 public boolean shouldEncode(FacesContext context, DataTable table) {
   return context
       .getExternalContext()
       .getRequestParameterMap()
       .containsKey(table.getClientId(context) + "_cellInfo");
 }