use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.
the class SwingRadioButton method select.
/**
* Select radio button
*
* @throws VerificationException if the element doesn't exist
*/
@PublicAtsApi
public void select() {
new SwingElementState(this).waitToBecomeExisting();
((JRadioButtonFixture) SwingElementLocator.findFixture(this)).check();
}
use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.
the class SwingSpinner method clickNext.
/**
* Click next/increment spinner button
* @param times number of times to click. Must be greater than 0
* @throws VerificationException if the element doesn't exist
*/
@PublicAtsApi
public void clickNext(int times) {
if (times <= 0) {
throw new UiElementException("The number of times to click must be greater than 0", this);
}
new SwingElementState(this).waitToBecomeExisting();
((JSpinnerFixture) SwingElementLocator.findFixture(this)).increment(times);
}
use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.
the class SwingSpinner method enterText.
/**
* Enter text in the spinner text field without committing the value.
* @throws VerificationException if the element doesn't exist
*/
@PublicAtsApi
public void enterText(String text) {
new SwingElementState(this).waitToBecomeExisting();
JSpinnerFixture spinnerFixture = (JSpinnerFixture) SwingElementLocator.findFixture(this);
int delayBetweenEvents = spinnerFixture.robot.settings().delayBetweenEvents();
try {
// enterText() method sets the text value using the Robot, so we will speed it up
spinnerFixture.robot.settings().delayBetweenEvents(10);
spinnerFixture.enterText(text);
} finally {
spinnerFixture.robot.settings().delayBetweenEvents(delayBetweenEvents);
}
}
use of com.axway.ats.uiengine.utilities.swing.SwingElementState in project ats-framework by Axway.
the class SwingTable method clickHeader.
/**
* Click table header by column name
*
* @param columnName the column name
* @throws VerificationException if the table element doesn't exist
*/
@PublicAtsApi
public void clickHeader(String columnName) {
new SwingElementState(this).waitToBecomeExisting();
JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
JTableHeaderFixture tableHeaderFixture = tableFixture.tableHeader();
try {
tableHeaderFixture.clickColumn(columnName);
} catch (Exception e) {
throw new UiElementException(e.getMessage(), this);
}
}
use of com.axway.ats.uiengine.utilities.swing.SwingElementState 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;
}
Aggregations