use of org.fest.swing.data.TableCell in project ats-framework by Axway.
the class SwingTable method clickCell.
/**
* Click table cell
*
* @param row the row number
* @param column the column number
* @throws VerificationException if the table element doesn't exist
*/
@PublicAtsApi
public void clickCell(int row, int column) {
new SwingElementState(this).waitToBecomeExisting();
JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
try {
tableFixture.cell(new TableCell(row, column) {
}).click();
} catch (Exception e) {
throw new UiElementException(e.getMessage(), this);
}
}
use of org.fest.swing.data.TableCell in project ats-framework by Axway.
the class SwingTable method drag.
/**
* Simulates a user dragging a cell from this table
*
* @param row the row number
* @param column the column number
*/
@PublicAtsApi
public void drag(int row, int column) {
new SwingElementState(this).waitToBecomeExisting();
((JTableFixture) SwingElementLocator.findFixture(this)).drag(new TableCell(row, column) {
});
}
use of org.fest.swing.data.TableCell in project ats-framework by Axway.
the class SwingTable method getCellBackgroundColors.
/**
* Gets table cell backgrounds (as {@link Color}) of all table cells.
*
* @return array of java.awt.Color objects one for each cell. First index is
* table row and second is the column in this row.
*/
@PublicAtsApi
public Color[][] getCellBackgroundColors() {
new SwingElementState(this).waitToBecomeExisting();
final JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
int rowCount = tableFixture.rowCount();
// SwingUtilities.
int columnCount = GuiActionRunner.execute(new GuiQuery<Integer>() {
@Override
protected Integer executeInEDT() throws Throwable {
return tableFixture.component().getColumnCount();
}
});
Color[][] resultArr = new Color[rowCount][columnCount];
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
resultArr[i][j] = tableFixture.backgroundAt(new TableCell(i, j) {
}).target();
}
}
return resultArr;
}
use of org.fest.swing.data.TableCell in project ats-framework by Axway.
the class SwingTable method doubleClickCell.
/**
* Double click table cell
*
* @param row the row number
* @param column the column number
* @throws VerificationException if the element doesn't exist
*/
@PublicAtsApi
public void doubleClickCell(int row, int column) {
new SwingElementState(this).waitToBecomeExisting();
JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
try {
tableFixture.cell(new TableCell(row, column) {
}).doubleClick();
} catch (Exception e) {
throw new UiElementException(e.getMessage(), this);
}
}
use of org.fest.swing.data.TableCell in project ats-framework by Axway.
the class SwingTable method setFieldValue.
/**
* 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) {
};
// if the cell coordinates are wrong, the exception will be thrown
tableFixture.selectCell(tableCell);
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);
}
}
Aggregations