/** * Verifies, whether value exists in row.. * * @param row The row of the cell. * @param rowOperator the row header operator * @param value The cell text to verify. * @param operator The operation used to verify * @param searchType Determines where the search begins ("relative" or "absolute") * @param exists true if value exists, false otherwise * @throws StepExecutionException If the row or the column is invalid, or if the rendered text * cannot be extracted. */ public void rcVerifyValueInRow( final String row, final String rowOperator, final String value, final String operator, final String searchType, boolean exists) throws StepExecutionException { final TreeTableOperationContext adapter = getContext(); final int implRow = adapter.getRowFromString(row, rowOperator); boolean valueIsExisting = false; // if row is header if (implRow == -1) { for (int i = getStartingColIndex(searchType); i < adapter.getColumnCount(); ++i) { if (MatchUtil.getInstance().match(adapter.getColumnHeaderText(i), value, operator)) { valueIsExisting = true; break; } } } else { for (int i = getStartingColIndex(searchType); i < adapter.getColumnCount(); ++i) { if (MatchUtil.getInstance().match(getCellText(implRow, i), value, operator)) { valueIsExisting = true; break; } } } Verifier.equals(exists, valueIsExisting); }
/** * Finds the first column which contains the value <code>value</code> in the given row and selects * the cell. * * @param row the row * @param rowOperator the row header operator * @param value the value * @param regex search using regex * @param extendSelection Should this selection be part of a multiple selection * @param searchType Determines where the search begins ("relative" or "absolute") * @param co the click options to use */ protected void selectCellByColValue( String row, String rowOperator, final String value, final String regex, final String extendSelection, final String searchType, ClickOptions co) { TreeTableOperationContext adapter = getContext(); final int implRow = adapter.getRowFromString(row, rowOperator); int colCount = adapter.getColumnCount(); Integer implCol = null; if (implRow == -1) { for (int i = getStartingColIndex(searchType); i < colCount; ++i) { if (MatchUtil.getInstance().match(adapter.getColumnHeaderText(i), value, regex)) { implCol = new Integer(i); break; } } } else { for (int i = getStartingColIndex(searchType); i < colCount; ++i) { if (MatchUtil.getInstance().match(getCellText(implRow, i), value, regex)) { implCol = new Integer(i); break; } } } if (implCol == null) { throw new StepExecutionException( "no such cell found", EventFactory //$NON-NLS-1$ .createActionError(TestErrorEvent.NOT_FOUND)); } String usrIdxRowStr = new Integer(IndexConverter.toUserIndex(implRow)).toString(); String usrIdxColStr = new Integer(IndexConverter.toUserIndex(implCol.intValue())).toString(); selectCell(usrIdxRowStr, rowOperator, usrIdxColStr, MatchUtil.EQUALS, co, extendSelection); }
/** * 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()); }