コード例 #1
0
  /**
   * Selects the cell of the Table.<br>
   * With the xPos, yPos, xUnits and yUnits the click position inside the cell can be defined.
   *
   * @param row The row of the cell.
   * @param rowOperator The row header operator
   * @param col The column of the cell.
   * @param colOperator The column header operator
   * @param clickCount The number of clicks with the right mouse button
   * @param xPos what x position
   * @param xUnits should x position be pixel or percent values
   * @param yPos what y position
   * @param yUnits should y position be pixel or percent values
   * @param extendSelection Should this selection be part of a multiple selection
   * @param button what mouse button should be used
   * @throws StepExecutionException If the row or the column is invalid
   */
  public void rcSelectCell(
      final String row,
      final String rowOperator,
      final String col,
      final String colOperator,
      final int clickCount,
      final int xPos,
      final String xUnits,
      final int yPos,
      final String yUnits,
      final String extendSelection,
      int button)
      throws StepExecutionException {
    TreeTableOperationContext adapter = getContext();
    final int implRow = adapter.getRowFromString(row, rowOperator);
    final int implCol = adapter.getColumnFromString(col, colOperator, implRow != -1);
    final boolean isExtendSelection = extendSelection.equals(ValueSets.BinaryChoice.yes.rcValue());
    if (log.isDebugEnabled()) {
      log.debug("Selecting row, col: " + row + ", " + col); // $NON-NLS-1$//$NON-NLS-2$
    }

    Rectangle cellBounds;
    Object source = getRealComponent();
    // if row is header and col is existing
    if (implRow == -1 && implCol > -1) {
      cellBounds = adapter.getHeaderBounds(implCol);
      source = adapter.getTableHeader();
    } else {
      cellBounds = adapter.scrollCellToVisible(implRow, implCol);
    }
    ClickOptions clickOptions = ClickOptions.create();
    clickOptions.setClickCount(clickCount).setScrollToVisible(false);
    clickOptions.setMouseButton(button);
    try {
      if (isExtendSelection) {
        getRobot().keyPress(getRealComponent(), getExtendSelectionModifier());
      }
      getRobot()
          .click(
              source,
              cellBounds,
              clickOptions,
              xPos,
              xUnits.equalsIgnoreCase(ValueSets.Unit.pixel.rcValue()),
              yPos,
              yUnits.equalsIgnoreCase(ValueSets.Unit.pixel.rcValue()));
    } finally {
      if (isExtendSelection) {
        getRobot().keyRelease(getRealComponent(), getExtendSelectionModifier());
      }
    }
  }
コード例 #2
0
  /**
   * Action to read the value of the passed cell of the table to store it in a variable in the
   * Client
   *
   * @param variable the name of the variable
   * @param row the row to select
   * @param rowOperator the row header operator
   * @param col the column to select
   * @param colOperator the column header operator
   * @return the text value.
   */
  public String rcReadValue(
      String variable, String row, String rowOperator, String col, String colOperator) {
    TreeTableOperationContext adapter = getContext();
    final int implRow = adapter.getRowFromString(row, rowOperator);
    final int implCol = adapter.getColumnFromString(col, colOperator, implRow != -1);

    // if row is header and column is existing
    if (implRow == -1 && implCol > -1) {
      return adapter.getColumnHeaderText(implCol);
    }
    checkRowColBounds(implRow, implCol);
    adapter.scrollCellToVisible(implRow, implCol);
    return getCellText(implRow, implCol);
  }
コード例 #3
0
  /**
   * Verifies the rendered text inside the passed cell.
   *
   * @param row The row of the cell.
   * @param rowOperator The row header operator
   * @param col The column of the cell.
   * @param colOperator The column header operator
   * @param text The cell text to verify.
   * @param operator The operation used to verify
   * @throws StepExecutionException If the row or the column is invalid, or if the rendered text
   *     cannot be extracted.
   */
  public void rcVerifyText(
      String text,
      String operator,
      final String row,
      final String rowOperator,
      final String col,
      final String colOperator)
      throws StepExecutionException {
    TreeTableOperationContext adapter = getContext();
    final int implRow = adapter.getRowFromString(row, rowOperator);
    final int implCol = adapter.getColumnFromString(col, colOperator, implRow != -1);
    String current;
    // if row is header and column is existing
    if (implRow == -1 && implCol > -1) {
      current = adapter.getColumnHeaderText(implCol);
    } else {
      checkRowColBounds(implRow, implCol);
      adapter.scrollCellToVisible(implRow, implCol);
      current = getCellText(implRow, implCol);
    }

    Verifier.match(current, text, operator);
  }