public class JTableCellFixture extends Object implements ItemFixture
JTable
s:
Example:
// import static org.fest.swing.data.TableCell.row;JTableCellFixture
cell = dialog.table
("records").cell(row
(3).column(0)); cell.select().showPopupMenu();
TableCell
Modifier | Constructor and Description |
---|---|
protected |
JTableCellFixture(JTableFixture table,
TableCell cell)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
ColorFixture |
background()
Returns a fixture that verifies the background color of this fixture's table cell.
|
JTableCellFixture |
cancelEditing()
Cancels editing this fixture's table cell.
|
JTableCellFixture |
click()
Simulates a user clicking this fixture's table cell.
|
JTableCellFixture |
click(MouseButton button)
Simulates a user clicking a cell in this fixture's table cell once, using the specified mouse button.
|
JTableCellFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's table cell.
|
int |
column()
Returns the column index of this fixture's table cell.
|
JTableCellFixture |
doubleClick()
Simulates a user double-clicking this fixture's table cell.
|
JTableCellFixture |
drag()
Simulates a user dragging this fixture's table cell.
|
JTableCellFixture |
drop()
Simulates a user dropping into this fixture's table cell.
|
Component |
editor()
Returns the editor of this fixture's table cell.
|
JTableCellFixture |
enterValue(String value)
Enters the given value to this fixture's table cell.
|
FontFixture |
font()
Returns a fixture that verifies the font of this fixture's table cell.
|
ColorFixture |
foreground()
Returns a fixture that verifies the foreground color of this fixture's table cell.
|
JTableCellFixture |
requireEditable()
Asserts that this fixture's table cell is editable.
|
JTableCellFixture |
requireNotEditable()
Asserts that this fixture's table cell is not editable.
|
JTableCellFixture |
requireValue(Pattern pattern)
Asserts that the value of this fixture's table cell matches the given regular expression pattern.
|
JTableCellFixture |
requireValue(String value)
Asserts that the value of this fixture's table cell matches the given value.
|
JTableCellFixture |
rightClick()
Simulates a user right-clicking this fixture's table cell.
|
int |
row()
Returns the row index of this fixture's table cell.
|
JTableCellFixture |
select()
Simulates a user selecting this fixture's table cell.
|
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's table cell as the invoker of the pop-up menu.
|
JTableCellFixture |
startEditing()
Starts editing this fixture's table cell.
|
JTableCellFixture |
stopEditing()
Stops editing this fixture's table cell.
|
String |
value()
Returns the
String representation of the value of this fixture's table cell. |
protected JTableCellFixture(JTableFixture table, TableCell cell)
JTableCellFixture
.table
- handles the JTable
containing the cell in this fixture.cell
- row and column indices of the table cell to be managed by this fixture.NullPointerException
- if table
is null
.NullPointerException
- if cell
is null
.public JTableCellFixture select()
select
in interface ItemFixture
IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.public JTableCellFixture click()
click
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.public JTableCellFixture click(MouseClickInfo mouseClickInfo)
click
in interface MouseInputSimulationFixture
mouseClickInfo
- specifies the button to click and the times the button should be clicked.NullPointerException
- if the given MouseClickInfo
is null
.IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.public JTableCellFixture doubleClick()
doubleClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.public JTableCellFixture rightClick()
rightClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.public JTableCellFixture click(MouseButton button)
click
in interface MouseInputSimulationFixture
button
- the mouse button to use.NullPointerException
- if the given MouseButton
is null
.IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.public JTableCellFixture startEditing()
Component
returned by editor()
.
This method uses the
from the JTableCellWriter
that
created this fixture.
JTableFixture
IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.IllegalStateException
- if this cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.ActionFailedException
- if this writer is unable to handle the underlying cell editor.JTableFixture.cellWriter(JTableCellWriter)
,
JTableCellWriter
,
editor()
public JTableCellFixture stopEditing()
Component
returned by editor()
.
This method uses the
from the JTableCellWriter
that
created this fixture.
JTableFixture
IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.IllegalStateException
- if this cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.ActionFailedException
- if this writer is unable to handle the underlying cell editor.JTableFixture.cellWriter(JTableCellWriter)
,
JTableCellWriter
,
editor()
public JTableCellFixture cancelEditing()
Component
returned by editor()
.
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.startEditing()
;
editorFixture.enterText("Hello");
// discard any entered value
cell.cancelEditing();
This method uses the
from the JTableCellWriter
that
created this fixture.
JTableFixture
IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.IllegalStateException
- if this cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.ActionFailedException
- if this writer is unable to handle the underlying cell editor.JTableFixture.cellWriter(JTableCellWriter)
,
JTableCellWriter
,
editor()
public Component editor()
ComponentFixture
,) the method startEditing()
should be called first. To
apply any changes back to the table cell, the method stopEditing()
should be called. This
method uses the JTableCellWriter
from the JTableFixture
that created
this fixture.
Example:
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.startEditing()
; editorFixture.enterText("Hello"); cell.stopEditing()
;
JTableFixture.cellWriter(JTableCellWriter)
,
JTableCellWriter
public JTableCellFixture enterValue(String value)
editor()
.
This method uses the
from the JTableCellWriter
that
created this fixture.
JTableFixture
value
- the value to enter in the cell.IllegalStateException
- if this fixture's JTable
is disabled.IllegalStateException
- if this fixture's JTable
is not showing on the screen.IllegalStateException
- if this cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.ActionFailedException
- if this driver's JTableCellValueReader
is unable to enter the given
value.JTableFixture.cellWriter(JTableCellWriter)
,
JTableCellWriter
public JTableCellFixture requireValue(String value)
value
- the expected value of this fixture's table cell. It can be a regular expression.AssertionError
- if the value of this fixture's table cell does not match the expected one.public JTableCellFixture requireValue(Pattern pattern)
pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the value of this fixture's table cell does not match the expected the given regular
expression pattern.public FontFixture font()
JTableCellReader
from the JTableFixture
that created this fixture.JTableFixture.cellReader(JTableCellReader)
,
JTableCellReader
public ColorFixture background()
JTableCellReader
from the JTableFixture
that created this fixture.JTableFixture.cellReader(JTableCellReader)
,
JTableCellReader
public ColorFixture foreground()
JTableCellReader
from the JTableFixture
that created this fixture.JTableFixture.cellReader(JTableCellReader)
,
JTableCellReader
public String value()
String
representation of the value of this fixture's table cell. This method uses the
JTableCellReader
from the JTableFixture
that created this fixture.value
in interface ItemFixture
String
representation of the value of this fixture's table cell.JTableFixture.cellReader(JTableCellReader)
,
JTableCellReader
public JTableCellFixture drag()
drag
in interface ItemFixture
public JTableCellFixture drop()
drop
in interface ItemFixture
public JPopupMenuFixture showPopupMenu()
showPopupMenu
in interface ItemFixture
ComponentLookupException
- if a pop-up menu cannot be found.public JTableCellFixture requireEditable()
AssertionError
- if this fixture's table cell is not editable.public JTableCellFixture requireNotEditable()
AssertionError
- if this fixture's table cell is editable.public int row()
public int column()
Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.