Search in sources :

Example 1 with JTableFixture

use of org.fest.swing.fixture.JTableFixture in project ats-framework by Axway.

the class SwingTable method clickHeader.

/**
     * Click table header by column index
     *
     * @param columnIndex the column index
     * @throws VerificationException if the table element doesn't exist
     */
@PublicAtsApi
public void clickHeader(int columnIndex) {
    new SwingElementState(this).waitToBecomeExisting();
    JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
    JTableHeaderFixture tableHeaderFixture = tableFixture.tableHeader();
    try {
        tableHeaderFixture.clickColumn(columnIndex);
    } 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 2 with JTableFixture

use of org.fest.swing.fixture.JTableFixture 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);
    }
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) 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 3 with JTableFixture

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

Example 4 with JTableFixture

use of org.fest.swing.fixture.JTableFixture 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)

Example 5 with JTableFixture

use of org.fest.swing.fixture.JTableFixture 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);
    }
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) 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)

Aggregations

JTableFixture (org.fest.swing.fixture.JTableFixture)29 PublicAtsApi (com.axway.ats.common.PublicAtsApi)16 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)16 TableCell (org.fest.swing.data.TableCell)15 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)11 UiElementException (com.axway.ats.uiengine.exceptions.UiElementException)11 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)10 VerifyEqualityException (com.axway.ats.uiengine.exceptions.VerifyEqualityException)10 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)10 NotNull (org.jetbrains.annotations.NotNull)7 JTableCellFixture (org.fest.swing.fixture.JTableCellFixture)6 TableView (com.intellij.ui.table.TableView)4 JPopupMenuFixture (org.fest.swing.fixture.JPopupMenuFixture)3 ImmutableList (com.google.common.collect.ImmutableList)2 JTableHeaderFixture (org.fest.swing.fixture.JTableHeaderFixture)2 ElementNotFoundException (com.axway.ats.uiengine.exceptions.ElementNotFoundException)1 SwingDriverInternal (com.axway.ats.uiengine.internal.driver.SwingDriverInternal)1 HyperlinkLabel (com.intellij.ui.HyperlinkLabel)1 Content (com.intellij.ui.content.Content)1 Color (java.awt.Color)1