示例#1
0
 /** @return */
 private RowType[] getTableData(TableType table, BigInteger[] cids) {
   final RowType[] tableData = new RowType[table.getRow().size()];
   for (int i = 0; i < tableData.length; i++) {
     final RowType row = table.getRow().get(i);
     tableData[i] = new RowType();
     if (row.getOid() != null) {
       tableData[i].setOid(row.getOid());
     }
     for (final BigInteger cid : cids) {
       boolean exists = false;
       for (final CellType cell : row.getCell()) {
         if (cell.getCid().equals(cid)) {
           tableData[i].getCell().add(cell);
           exists = true;
           break;
         }
       }
       if (!exists) {
         final CellType newCell = new CellType();
         newCell.setCid(cid);
         newCell.setValue(ILMLCoreConstants.QM);
         tableData[i].getCell().add(newCell);
       }
     }
   }
   return tableData;
 }
示例#2
0
  /**
   * Get the table with color information added
   *
   * @param gid ID of the table layout
   * @return rows with color information added
   */
  public Row[] getTableDataWithColor(String gid, boolean addColor) {
    final BigInteger[] cids = getCids(gid);
    final TableType table = getTable(gid);
    if (table == null) {
      return new Row[0];
    }
    final List<Row> tableData = new ArrayList<Row>();
    for (int i = 0; i < table.getRow().size(); i++) {
      final RowType rowType = table.getRow().get(i);
      final Row row = new Row();
      row.setOid(rowType.getOid());
      if (addColor) {
        row.setColor(lguiItem.getOIDToObject().getColorById(rowType.getOid()));
      }

      final BigInteger jobIdIndex = getColumnIndex(table, ILguiItem.JOB_ID);
      final Cell[] tableDataRow = new Cell[cids.length];
      String jobId = null;
      for (int j = 0; j < cids.length; j++) {
        for (final CellType cell : rowType.getCell()) {
          if (cell.getCid() != null && cell.getCid().equals(cids[j])) {
            tableDataRow[j] = new Cell(cell.getValue(), row);
            break;
          }
        }
        if (tableDataRow[j] == null) {
          tableDataRow[j] = new Cell(ILMLCoreConstants.QM, row);
        }
        if (cids[j].equals(jobIdIndex)) {
          jobId = tableDataRow[j].value;
        }
      }
      row.setCells(tableDataRow);
      if (jobId != null) {
        JobStatusData status = lguiItem.getUserJob(jobId);
        if (status == null) {
          final String queueName = getCellValue(table, rowType, ILguiItem.JOB_QUEUE_NAME);
          final String owner = getCellValue(table, rowType, ILguiItem.JOB_OWNER);
          final String state = getCellValue(table, rowType, ILguiItem.JOB_STATUS);
          final String[][] attrs = {
            {JobStatusData.MONITOR_ID_ATTR, lguiItem.getName()},
            {JobStatusData.QUEUE_NAME_ATTR, queueName},
            {JobStatusData.OWNER_ATTR, owner},
            {JobStatusData.STATE_ATTR, state}
          };
          status = new JobStatusData(jobId, attrs);
        } else if (status.isRemoved()) {
          /*
           * Skip rows that have been marked as "removed"
           */
          continue;
        }
        row.setJobStatusData(status);
      }
      tableData.add(row);
    }
    return tableData.toArray(new Row[tableData.size()]);
  }
示例#3
0
 public String getCellValue(TableType table, RowType row, String colName) {
   final BigInteger index = getColumnIndex(table, colName);
   if (index != null) {
     for (final CellType cell : row.getCell()) {
       if (cell.getCid() != null && cell.getCid().equals(index)) {
         return cell.getValue();
       }
     }
   }
   return null;
 }
示例#4
0
 public String setCellValue(TableType table, RowType row, String colName, String value) {
   final BigInteger index = getColumnIndex(table, colName);
   if (index != null) {
     for (final CellType cell : row.getCell()) {
       if (cell.getCid().equals(index)) {
         final String oldVal = cell.getValue();
         cell.setValue(value);
         return oldVal;
       }
     }
   }
   return null;
 }