Search in sources :

Example 26 with JTableFixture

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

the class BuildVariantsToolWindowFixture method selectVariantForModule.

@NotNull
public BuildVariantsToolWindowFixture selectVariantForModule(@NotNull final String module, @NotNull String variant) {
    activate();
    Content[] contents = myToolWindow.getContentManager().getContents();
    assertThat(contents.length).isAtLeast(1);
    Content content = contents[0];
    JTable variantsTable = myRobot.finder().findByType(content.getComponent(), JTable.class, true);
    final String moduleColumnText = "Module: '" + module + "'";
    JTableFixture table = new JTableFixture(myRobot, variantsTable);
    JTableCellFixture moduleCell = table.cell((jTable, cellReader) -> {
        int rowCount = jTable.getRowCount();
        for (int i = 0; i < rowCount; i++) {
            int moduleColumnIndex = 0;
            String currentModule = cellReader.valueAt(jTable, i, moduleColumnIndex);
            if (moduleColumnText.equals(currentModule)) {
                return row(i).column(moduleColumnIndex);
            }
        }
        throw new AssertionError("Failed to find module '" + module + "' in 'Build Variants' view");
    });
    TableCell variantCellCoordinates = row(moduleCell.row()).column(1);
    String selectedVariant = table.valueAt(variantCellCoordinates);
    if (!variant.equals(selectedVariant)) {
        // Attempt to select variant if it is not already selected.
        JTableCellFixture variantCell = table.cell(variantCellCoordinates);
        variantCell.enterValue(variant);
        myProjectFrame.waitForBuildToFinish(BuildMode.SOURCE_GEN);
    }
    return this;
}
Also used : JTableCellFixture(org.fest.swing.fixture.JTableCellFixture) JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) Content(com.intellij.ui.content.Content) NotNull(org.jetbrains.annotations.NotNull)

Example 27 with JTableFixture

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

the class ModulesToImportDialogFixture method getSelectedModuleList.

@NotNull
public ImmutableList<String> getSelectedModuleList() {
    JTableFixture moduleTable = getModuleTable();
    int size = moduleTable.rowCount();
    String[][] contents = moduleTable.contents();
    ImmutableList.Builder<String> result = ImmutableList.builder();
    for (int i = 0; i < size; i++) {
        if ("true".equals(contents[i][0])) {
            result.add(contents[i][1]);
        }
    }
    return result.build();
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) ImmutableList(com.google.common.collect.ImmutableList) NotNull(org.jetbrains.annotations.NotNull)

Example 28 with JTableFixture

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

the class ModulesToImportDialogFixture method setSelected.

@NotNull
public ModulesToImportDialogFixture setSelected(@NotNull String moduleName, boolean selected) {
    JTableFixture moduleTable = getModuleTable();
    JTableCellFixture cell = moduleTable.cell(moduleName);
    moduleTable.enterValue(TableCell.row(cell.row()).column(0), String.valueOf(selected));
    return this;
}
Also used : JTableCellFixture(org.fest.swing.fixture.JTableCellFixture) JTableFixture(org.fest.swing.fixture.JTableFixture) NotNull(org.jetbrains.annotations.NotNull)

Example 29 with JTableFixture

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

the class ModulesToImportDialogFixture method getModuleList.

@NotNull
public ImmutableList<String> getModuleList() {
    JTableFixture moduleTable = getModuleTable();
    int size = moduleTable.rowCount();
    String[][] contents = moduleTable.contents();
    ImmutableList.Builder<String> result = ImmutableList.builder();
    for (int i = 0; i < size; i++) {
        result.add(contents[i][1]);
    }
    return result.build();
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) ImmutableList(com.google.common.collect.ImmutableList) 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