Search in sources :

Example 26 with SwingElementState

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();
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) JRadioButtonFixture(org.fest.swing.fixture.JRadioButtonFixture) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 27 with SwingElementState

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);
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) JSpinnerFixture(org.fest.swing.fixture.JSpinnerFixture) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 28 with SwingElementState

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);
    }
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) JSpinnerFixture(org.fest.swing.fixture.JSpinnerFixture) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 29 with SwingElementState

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);
    }
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) JTableHeaderFixture(org.fest.swing.fixture.JTableHeaderFixture) VerifyNotEqualityException(com.axway.ats.uiengine.exceptions.VerifyNotEqualityException) VerifyEqualityException(com.axway.ats.uiengine.exceptions.VerifyEqualityException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) NotSupportedOperationException(com.axway.ats.uiengine.exceptions.NotSupportedOperationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 30 with SwingElementState

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;
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) Color(java.awt.Color) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)60 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)60 UiElementException (com.axway.ats.uiengine.exceptions.UiElementException)16 JTableFixture (org.fest.swing.fixture.JTableFixture)16 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)12 TableCell (org.fest.swing.data.TableCell)12 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)11 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)11 VerifyEqualityException (com.axway.ats.uiengine.exceptions.VerifyEqualityException)10 JTreeFixture (org.fest.swing.fixture.JTreeFixture)8 JListFixture (org.fest.swing.fixture.JListFixture)7 JPopupMenuFixture (org.fest.swing.fixture.JPopupMenuFixture)5 JSpinnerFixture (org.fest.swing.fixture.JSpinnerFixture)4 ArrayList (java.util.ArrayList)2 ComponentDragAndDrop (org.fest.swing.core.ComponentDragAndDrop)2 JCheckBoxFixture (org.fest.swing.fixture.JCheckBoxFixture)2 JFileChooserFixture (org.fest.swing.fixture.JFileChooserFixture)2 JMenuItemFixture (org.fest.swing.fixture.JMenuItemFixture)2 JTabbedPaneFixture (org.fest.swing.fixture.JTabbedPaneFixture)2 JTableHeaderFixture (org.fest.swing.fixture.JTableHeaderFixture)2