Esempio n. 1
0
  public void getRowData(int firstRow, int numRows, ValueTable.Cell[][] rowData) {
    Model model = getModel();
    TestException[] results = model.getResults();
    int numPass = model.getPass();
    int numFail = model.getFail();
    TestVector vec = model.getVector();
    int columns = vec.columnName.length;
    String msg[] = new String[columns];
    Value[] altdata = new Value[columns];
    String passMsg = Strings.get("passStatus");
    String failMsg = Strings.get("failStatus");

    for (int i = firstRow; i < firstRow + numRows; i++) {
      int row = model.sortedIndex(i);
      Value[] data = vec.data.get(row);
      String rowmsg = null;
      String status = null;
      boolean failed = false;
      if (row < numPass + numFail) {
        TestException err = results[row];
        if (err != null && err instanceof FailException) {
          failed = true;
          for (FailException e = (FailException) err; e != null; e = e.getMore()) {
            int col = e.getColumn();
            msg[col] =
                StringUtil.format(
                    Strings.get("expectedValueMessage"),
                    e.getExpected().toDisplayString(getColumnValueRadix(col + 1)));
            altdata[col] = e.getComputed();
          }
        } else if (err != null) {
          failed = true;
          rowmsg = err.getMessage();
        }
        status = failed ? failMsg : passMsg;
      }

      rowData[i - firstRow][0] =
          new ValueTable.Cell(status, rowmsg != null ? failColor : null, null, rowmsg);

      for (int col = 0; col < columns; col++) {
        rowData[i - firstRow][col + 1] =
            new ValueTable.Cell(
                altdata[col] != null ? altdata[col] : data[col],
                msg[col] != null ? failColor : null,
                null,
                msg[col]);
        msg[col] = null;
        altdata[col] = null;
      }
    }
  }
Esempio n. 2
0
 public static String get(String key, String arg) {
   return StringUtil.format(source.get(key), arg);
 }