Search in sources :

Example 6 with JTableFixture

use of org.fest.swing.fixture.JTableFixture 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);
    }
}
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) NotSupportedOperationException(com.axway.ats.uiengine.exceptions.NotSupportedOperationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 7 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 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 8 with JTableFixture

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

the class SwingTable method selectCells.

/**
     * Select table cells
     *
     * @param cells the cells coordinates (eg. new int[][]{ { 1, 1 }, { 1, 2 }, { 2, 2 } )
     * @throws VerificationException if the element doesn't exist
     */
@PublicAtsApi
public void selectCells(int[][] cells) {
    new SwingElementState(this).waitToBecomeExisting();
    JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
    try {
        TableCell[] cellsToSelect = new TableCell[cells.length];
        for (int i = 0; i < cells.length; i++) {
            int row = cells[i][0];
            int column = cells[i][1];
            cellsToSelect[i] = new TableCell(row, column) {
            };
        }
        tableFixture.selectCells(cellsToSelect);
    } 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 9 with JTableFixture

use of org.fest.swing.fixture.JTableFixture in project android by JetBrains.

the class TranslationsEditorTest method enteringTextInTranslationTextFieldUpdatesTableCell.

@Test
public void enteringTextInTranslationTextFieldUpdatesTableCell() {
    JTableFixture table = myTranslationsEditor.getTable();
    TableCell cell = TableCell.row(2).column(3);
    table.selectCell(cell);
    myTranslationsEditor.getTranslationTextField().enterText("cancel_en");
    // Make the Translation text field lose focus
    myTranslationsEditor.getKeyTextField().focus();
    assertEquals("cancel_en", table.valueAt(cell));
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) Test(org.junit.Test)

Example 10 with JTableFixture

use of org.fest.swing.fixture.JTableFixture in project android by JetBrains.

the class ChooseSystemImageStepFixture method selectSystemImage.

@NotNull
public ChooseSystemImageStepFixture selectSystemImage(@NotNull String releaseName, @NotNull String apiLevel, @NotNull String abiType, @NotNull String targetName) {
    final TableView systemImageList = robot().finder().findByType(target(), TableView.class, true);
    JTableFixture systemImageListFixture = new JTableFixture(robot(), systemImageList);
    JTableCellFixture cell = systemImageListFixture.cell(rowWithValue(releaseName, apiLevel, abiType, targetName).column(0));
    cell.select();
    return this;
}
Also used : JTableCellFixture(org.fest.swing.fixture.JTableCellFixture) JTableFixture(org.fest.swing.fixture.JTableFixture) TableView(com.intellij.ui.table.TableView) NotNull(org.jetbrains.annotations.NotNull)

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