/** * Simulates a user double-clicking this fixture's table cell. * * @return this fixture. * @throws IllegalStateException if this fixture's {@code JTable} is disabled. * @throws IllegalStateException if this fixture's {@code JTable} is not showing on the screen. */ @Override @Nonnull public JTableCellFixture doubleClick() { table.click(cell(), LEFT_BUTTON, 2); return this; }
/** * Returns the {@code String} representation of the value of this fixture's table cell. This method uses the * {@link org.assertj.swing.cell.JTableCellReader} from the {@link JTableFixture} that created this fixture. * * @return the {@code String} representation of the value of this fixture's table cell. * @see JTableFixture#replaceCellReader(org.assertj.swing.cell.JTableCellReader) * @see org.assertj.swing.cell.JTableCellReader */ @Override @Nullable public String value() { return table.valueAt(cell()); }
/** * Returns a fixture that verifies the foreground color of this fixture's table cell. This method uses the * {@link org.assertj.swing.cell.JTableCellReader} from the {@link JTableFixture} that created this fixture. * * @return a fixture that verifies the foreground color of this fixture's table cell. * @see JTableFixture#replaceCellReader(org.assertj.swing.cell.JTableCellReader) * @see org.assertj.swing.cell.JTableCellReader */ @Nonnull public ColorFixture foreground() { return table.foregroundAt(cell()); }
/** * Asserts that this fixture's table cell is not editable. * * @return this fixture. * @throws AssertionError if this fixture's table cell is editable. */ @Nonnull public JTableCellFixture requireNotEditable() { table.requireNotEditable(cell()); return this; }
/** * Simulates a user dragging this fixture's table cell. * * @return this fixture. */ @Override @Nonnull public JTableCellFixture drag() { table.drag(cell()); return this; }
/** * Simulates a user selecting this fixture's table cell. * * @return this fixture. * @throws IllegalStateException if this fixture's {@code JTable} is disabled. * @throws IllegalStateException if this fixture's {@code JTable} is not showing on the screen. */ @Override @Nonnull public JTableCellFixture select() { table.selectCell(cell()); return this; }
/** * Simulates a user unselecting this fixture's table cell. * * @return this fixture. * @throws IllegalStateException if this fixture's {@code JTable} is disabled. * @throws IllegalStateException if this fixture's {@code JTable} is not showing on the screen. */ @Nonnull public JTableCellFixture unselect() { table.unselectCell(cell()); return this; }
/** * Shows a pop-up menu using this fixture's table cell as the invoker of the pop-up menu. * * @return a fixture that manages the displayed pop-up menu. * @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found. */ @Override @Nonnull public JPopupMenuFixture showPopupMenu() { return table.showPopupMenuAt(cell()); }
/** * Simulates a user clicking this fixture's table cell. * * @return this fixture. * @throws IllegalStateException if this fixture's {@code JTable} is disabled. * @throws IllegalStateException if this fixture's {@code JTable} is not showing on the screen. */ @Override @Nonnull public JTableCellFixture click() { table.click(cell(), LEFT_BUTTON); return this; }
/** * Asserts that the value of this fixture's table cell matches the given value. * * @param value the expected value of this fixture's table cell. It can be a regular expression. * @return this fixture. * @throws AssertionError if the value of this fixture's table cell does not match the expected one. */ @Nonnull public JTableCellFixture requireValue(@Nullable String value) { table.requireCellValue(cell(), value); return this; }
/** * Returns a fixture that verifies the font of this fixture's table cell. This method uses the * {@link org.assertj.swing.cell.JTableCellReader} from the {@link JTableFixture} that created this fixture. * * @return a fixture that verifies the font of this fixture's table cell. * @see JTableFixture#replaceCellReader(org.assertj.swing.cell.JTableCellReader) * @see org.assertj.swing.cell.JTableCellReader */ public FontFixture font() { return table.fontAt(cell()); }
/** * Returns a fixture that verifies the background color of this fixture's table cell. This method uses the * {@link org.assertj.swing.cell.JTableCellReader} from the {@link JTableFixture} that created this fixture. * * @return a fixture that verifies the background color of this fixture's table cell. * @see JTableFixture#replaceCellReader(org.assertj.swing.cell.JTableCellReader) * @see org.assertj.swing.cell.JTableCellReader */ @Nonnull public ColorFixture background() { return table.backgroundAt(cell()); }
/** * Simulates a user dropping into this fixture's table cell. * * @return this fixture. */ @Override @Nonnull public JTableCellFixture drop() { table.drop(cell()); return this; }
/** * Asserts that this fixture's table cell is editable. * * @return this fixture. * @throws AssertionError if this fixture's table cell is not editable. */ @Nonnull public JTableCellFixture requireEditable() { table.requireEditable(cell()); return this; }
/** * Asserts that the value of this fixture's table cell matches the given regular expression pattern. * * @param pattern the regular expression pattern to match. * @return this fixture. * @throws NullPointerException if the given regular expression pattern is {@code null}. * @throws AssertionError if the value of this fixture's table cell does not match the expected the given regular * expression pattern. */ @Nonnull public JTableCellFixture requireValue(@Nonnull Pattern pattern) { table.requireCellValue(cell(), pattern); return this; }
/** * Simulates a user clicking this fixture's table cell. * * @param mouseClickInfo specifies the button to click and the times the button should be clicked. * @return this fixture. * @throws NullPointerException if the given {@code MouseClickInfo} is {@code null}. * @throws IllegalStateException if this fixture's {@code JTable} is disabled. * @throws IllegalStateException if this fixture's {@code JTable} is not showing on the screen. */ @Override @Nonnull public JTableCellFixture click(@Nonnull MouseClickInfo mouseClickInfo) { table.click(cell(), mouseClickInfo); return this; }
/** * Simulates a user clicking a cell in this fixture's table cell once, using the specified mouse button. * * @param button the mouse button to use. * @return this fixture. * @throws NullPointerException if the given {@code MouseButton} is {@code null}. * @throws IllegalStateException if this fixture's {@code JTable} is disabled. * @throws IllegalStateException if this fixture's {@code JTable} is not showing on the screen. */ @Override @Nonnull public JTableCellFixture click(@Nonnull MouseButton button) { table.click(cell(), button); return this; }
/** * Starts editing this fixture's table cell. This method should be called <strong>before</strong> manipulating the * {@code Component} returned by {@link #editor()}. * <p> * This method uses the {@link org.assertj.swing.cell.JTableCellWriter} from the {@link JTableFixture} that created * this fixture. * </p> * * @return this fixture. * @throws IllegalStateException if this fixture's {@code JTable} is disabled. * @throws IllegalStateException if this fixture's {@code JTable} is not showing on the screen. * @throws IllegalStateException if this cell is not editable. * @throws IndexOutOfBoundsException if any of the indices (row and column) is out of bounds. * @throws org.assertj.swing.exception.ActionFailedException if this writer is unable to handle the underlying cell * editor. * @see JTableFixture#replaceCellWriter(org.assertj.swing.cell.JTableCellWriter) * @see org.assertj.swing.cell.JTableCellWriter * @see #editor() */ @Nonnull public JTableCellFixture startEditing() { driver.startCellEditing(target, cell()); return this; }
/** * Stops editing this fixture's table cell. This method should be called <strong>after</strong> manipulating the * {@code Component} returned by {@link #editor()}. * <p> * This method uses the {@link org.assertj.swing.cell.JTableCellWriter} from the {@link JTableFixture} that created * this fixture. * </p> * * @return this fixture. * @throws IllegalStateException if this fixture's {@code JTable} is disabled. * @throws IllegalStateException if this fixture's {@code JTable} is not showing on the screen. * @throws IllegalStateException if this cell is not editable. * @throws IndexOutOfBoundsException if any of the indices (row and column) is out of bounds. * @throws org.assertj.swing.exception.ActionFailedException if this writer is unable to handle the underlying cell * editor. * @see JTableFixture#replaceCellWriter(org.assertj.swing.cell.JTableCellWriter) * @see org.assertj.swing.cell.JTableCellWriter * @see #editor() */ @Nonnull public JTableCellFixture stopEditing() { driver.stopCellEditing(target, cell()); return this; }
/** * Returns the editor of this fixture's table cell. To manipulate the editor (e.g. wrapping it with a * {@code ComponentFixture}), the method {@link #startEditing()} should be called first. To apply any changes back to * the table cell(), the method {@link #stopEditing()} should be called. This method uses the * {@link org.assertj.swing.cell.JTableCellWriter} from the {@link JTableFixture} that created this fixture. * <p> * Example: * </p> * * <pre> * TableCellFixture cell = table.cell(row(6).column(8)); * Component editor = cell.editor(); * // assume editor is a JTextField * JTextComponentFixture editorFixture = new JTextComponentFixture(robot, (JTextField) editor); * cell.{@link #startEditing()}; * editorFixture.enterText("Hello"); * cell.{@link #stopEditing()}; * </pre> * * @return the editor of this fixture's table cell. * @see JTableFixture#replaceCellWriter(org.assertj.swing.cell.JTableCellWriter) * @see org.assertj.swing.cell.JTableCellWriter */ public Component editor() { return driver.cellEditor(target, cell()); }