コード例 #1
0
ファイル: Renderers.java プロジェクト: rhastings/molgenis
 @Override
 public void export(
     MolgenisRequest request,
     String fileName,
     TupleTable tupleTable,
     int totalPages,
     int currentPage)
     throws TableException, IOException {
   final JQGridResult result =
       JQGridView.buildJQGridResults(tupleTable.getCount(), totalPages, currentPage, tupleTable);
   final PrintWriter pout = new PrintWriter(request.getResponse().getOutputStream());
   String json = new Gson().toJson(result);
   // System.out.println("printing JSON: " + json);
   pout.print(json);
   pout.close();
 }
コード例 #2
0
  public JQGridConfiguration(
      Database db, String id, String idField, String url, String caption, TupleTable tupleTable)
      throws TableException {
    if (tupleTable instanceof DatabaseTupleTable) {
      ((DatabaseTupleTable) tupleTable).setDb(db);
    }

    this.id = id;
    this.pager = "#" + id + "_pager";
    this.url = url;
    this.editurl = url;
    this.caption = caption;
    this.totalColumnCount = tupleTable.getColCount();
    this.colOffset = tupleTable.getColOffset();
    this.colLimit = tupleTable.getColLimit();
    this.firstColumnFixed = tupleTable.isFirstColumnFixed();

    // "{repeatitems: false, id: \"Code\"}"
    jsonReader.put("repeatitems", false);
    jsonReader.put("id", idField);

    this.hiddenColumns = tupleTable.getHiddenColumnNames();

    if (tupleTable instanceof FilterableTupleTable) {
      // sortable = true;
      settings.setSearch(true);
    }

    if (tupleTable instanceof EditableTupleTable) {
      settings.setAdd(true);
      settings.setEdit(true);
      settings.setDel(true);
    }

    // set col names
    for (final Field f : tupleTable.getColumns()) {
      colModel.add(new JQGridColModel(f));
    }
  }