Esempio n. 1
0
 public Table addColumn(String headerName, String attrs, List<Object> values) {
   Table t = new Table();
   t.startHeaders().addCell(headerName, attrs).endHeaders();
   for (Object val : values) {
     t.startRow().addCell(val).endRow();
   }
   return this.addTable(t);
 }
Esempio n. 2
0
  public Table addTable(Table t2) {
    Table t1 = this;
    Table t = new Table();

    t.startHeaders();

    for (Cell c : t1.getHeaders()) {
      t.addCell(c);
    }

    for (Cell c : t2.getHeaders()) {
      t.addCell(c);
    }

    t.endHeaders();

    if (t1.rows.size() != t2.rows.size()) {
      StringBuilder sb = new StringBuilder();
      sb.append("cannot add a table with ");
      sb.append(t2.rows.size());
      sb.append(" rows to table with ");
      sb.append(t1.rows.size());
      sb.append(" rows");
      throw new ElasticSearchIllegalArgumentException(sb.toString());
    }

    for (int i = 0; i < t1.rows.size(); i++) {
      t.startRow();
      for (Cell c : t1.rows.get(i)) {
        t.addCell(c);
      }
      for (Cell c : t2.rows.get(i)) {
        t.addCell(c);
      }
      t.endRow(false);
    }

    return t;
  }