use of org.fest.swing.data.TableCell 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;
}
Aggregations