コード例 #1
0
 /**
  * Looks if value exists in the Column.
  *
  * @param adapter the table adapter working on.
  * @param implCol the implementation column of the cell.
  * @param value the cell text to verify.
  * @param operator The operation used to verify.
  * @param searchType searchType Determines where the search begins ("relative" or "absolute")
  * @return <code>true</code> it the value exists in the column
  */
 private boolean isValueExisting(
     TreeTableOperationContext adapter,
     int implCol,
     String value,
     String operator,
     final String searchType) {
   final int rowCount = adapter.getRowCount();
   for (int i = getStartingRowIndex(searchType); i < rowCount; ++i) {
     if (MatchUtil.getInstance().match(getCellText(i, implCol), value, operator)) {
       return true;
     }
   }
   if (adapter.isHeaderVisible()) {
     String header = adapter.getColumnHeaderText(implCol);
     if (MatchUtil.getInstance().match(header, value, operator)) {
       return true;
     }
   }
   return false;
 }
コード例 #2
0
  /**
   * Finds the first row which contains the value <code>value</code> in column <code>col</code> and
   * selects this row.
   *
   * @param col the column
   * @param colOperator the column header operator
   * @param value the value
   * @param regexOp the regex operator
   * @param extendSelection Should this selection be part of a multiple selection
   * @param searchType Determines where the search begins ("relative" or "absolute")
   * @param co the clickOptions to use
   */
  protected void selectRowByValue(
      String col,
      String colOperator,
      final String value,
      final String regexOp,
      final String extendSelection,
      final String searchType,
      ClickOptions co) {
    TreeTableOperationContext adapter = getContext();
    final int implCol = adapter.getColumnFromString(col, colOperator, true);
    Integer implRow = null;
    final int rowCount = adapter.getRowCount();

    for (int i = getStartingRowIndex(searchType); i < rowCount; ++i) {
      if (MatchUtil.getInstance().match(getCellText(i, implCol), value, regexOp)) {

        implRow = new Integer(i);
        break;
      }
    }
    if (implRow == null) {
      String header = adapter.getColumnHeaderText(implCol);
      if (MatchUtil.getInstance().match(header, value, regexOp)) {
        implRow = new Integer(-1);
      }
    }

    if (implRow == null) {
      throw new StepExecutionException(
          "no such row found", //$NON-NLS-1$
          EventFactory.createActionError(TestErrorEvent.NOT_FOUND));
    }

    String userIdxRow = new Integer(IndexConverter.toUserIndex(implRow.intValue())).toString();
    String userIdxCol = new Integer(IndexConverter.toUserIndex(implCol)).toString();

    selectCell(userIdxRow, MatchUtil.EQUALS, userIdxCol, colOperator, co, extendSelection);
  }
コード例 #3
0
 /**
  * Checks if the passed row and column are inside the bounds of the Table.
  *
  * @param row The row
  * @param column The column
  * @throws StepExecutionException If the row or the column is outside of the Table's bounds.
  */
 protected void checkRowColBounds(int row, int column) throws StepExecutionException {
   TreeTableOperationContext adapter = getContext();
   checkBounds(row, adapter.getRowCount());
   checkBounds(column, adapter.getColumnCount());
 }