@RunsInEDT static void close(final @Nonnull JInternalFrame internalFrame) { execute( new GuiTask() { @Override protected void executeInEDT() { internalFrame.doDefaultCloseAction(); } }); }
/** * Validates that the given table cell is non {@code null} and its indices are not out of bounds. * * @param table the target {@code JTable}. * @param cell to validate. * @throws NullPointerException if the cell is {@code null}. * @throws IndexOutOfBoundsException if any of the indices (row and column) is out of bounds. */ @RunsInEDT public void checkCellIndicesInBounds(final @Nonnull JTable table, final @Nonnull TableCell cell) { execute( new GuiTask() { @Override protected void executeInEDT() { JTableCellPreconditions.checkCellIndicesInBounds(table, cell); } }); }
@RunsInEDT public static void selectRow(final @Nonnull JTree tree, final int row) { execute( new GuiTask() { @Override protected void executeInEDT() { tree.setSelectionRow(row); } }); }
@Override protected void onSetUp() { JFrame frame = GuiActionRunner.execute( new GuiQuery<JFrame>() { @Override protected JFrame executeInEDT() { return new TableFrame(); } }); window = new FrameFixture(robot(), frame); window.show(); }
@RunsInEDT private static void selectRows(final JTable table, final int from, final int to) { execute( new GuiTask() { @Override protected void executeInEDT() { if (from != to) { table.setSelectionMode(MULTIPLE_INTERVAL_SELECTION); } table.setRowSelectionInterval(from, to); } }); }
@RunsInEDT private static void assertNoSelection(final @Nonnull JTable table) { execute( new GuiTask() { @Override protected void executeInEDT() { if (!hasSelection(table)) { return; } String format = "[%s] expected no selection but was:<rows=%s, columns=%s>"; String msg = String.format( format, propertyName(table, SELECTION_PROPERTY).value(), format(selectedRowsOf(table)), format(table.getSelectedColumns())); fail(msg); } }); }
@RunsInEDT static void setRootVisible(final @Nonnull JTree tree, final boolean visible) { execute(() -> tree.setRootVisible(visible)); }
@RunsInEDT private static void ignore(final WindowFilter filter, final Component c) { execute(() -> filter.ignore(c)); }
@RunsInEDT private static void setClosable(final JInternalFrame internalFrame, final boolean closeable) { execute(() -> internalFrame.setClosable(closeable)); }
@Override protected void onSetUp() { SampleFrame frame = GuiActionRunner.execute(() -> new SimpleFrame()); window = new FrameFixture(robot(), frame); window.show(); }