@Override protected Integer executeInEDT() throws Throwable { return tableFixture.component().getColumnCount(); }
/** * Get selected rows in the table * * @return an array with the selected rows * @throws VerificationException if the table element doesn't exist */ @PublicAtsApi public int[] getSelectedRows() { new SwingElementState(this).waitToBecomeExisting(); JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this); try { return tableFixture.component().getSelectedRows(); } catch (Exception e) { throw new UiElementException(e.getMessage(), this); } }
/** * Set table field value * * @param value the value to set * @param row the row number * @param column the column number * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public void setFieldValue( String value, int row, int column ) { new SwingElementState(this).waitToBecomeExisting(); JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this); try { TableCell tableCell = new TableCell(row, column) {}; tableFixture.selectCell(tableCell); // if the cell coordinates are wrong, the exception will be thrown if (tableFixture.component().isCellEditable(row, column)) { tableFixture.enterValue(tableCell, value); } else { throw new NotSupportedOperationException("The table cell [" + row + "," + column + "] is not editable. " + toString()); } } catch (IndexOutOfBoundsException ioobe) { throw new UiElementException(ioobe.getMessage(), this); } }