| java.lang.Object org.uispec4j.AbstractUIComponent org.uispec4j.Table
Table | public class Table extends AbstractUIComponent (Code) | | Wrapper for JTable components.
The contents of the underlying table can be usually checked with String or Boolean values,
as in the following example:
assertTrue(table.contentEquals(new String[]{
{"Bart", "Simpson"},
{"Marge", "Simpson"}
}));
The conversion between the values (Strings) given in the test and the values
actually displayed by the table renderer is performed by a dedicated
TableCellValueConverter , which retrieves the graphical component that draws
the table cells and determines the displayed value accordingly.
A
DefaultTableCellValueConverter is used by default by the Table component.
|
Inner Class :public class Cell extends Panel | |
Inner Class :public class Header | |
Method Summary | |
public void | addRowToSelection(int row) | public Assertion | backgroundEquals(Object[][] colors) | public Assertion | borderEquals(Border[][] borders) | public Assertion | cellIsEditable(int rowIndex, int columnIndex) | public Assertion | cellIsSelected(int rowIndex, int columnIndex) | public void | clearSelection() | public void | click(int row, int column) | public void | click(int row, int column, Key.Modifier modifier) | public Assertion | columnEquals(int columnIndex, Object[] expectedColumn) | public Assertion | columnIsEditable(int columnIndex, boolean isEditable) | public Assertion | columnIsEditable(String columnName, boolean shouldBeEditable) | public Assertion | columnSizeEquals(String columnName, int expectedWidth) | public Assertion | columnSizeEquals(int columnIndex, int expectedWidth) | public Assertion | contentEquals(Object[][] expected) | public Assertion | contentEquals(String[] columnNames, Object[][] expected) Checks the values displayed in the table for a given set of columns. | public void | doubleClick(int row, int column) | public Cell | editCell(int row, int column) | public void | editCell(int row, int column, String value, boolean validateChange) Inputs some text in a given cell.
This method only works when the underlying editor is a JTextField or a JComboBox -
it will throw an exception if this is not the case, or if the cell is not editable. | public Assertion | foregroundEquals(Object[][] colors) | public Component | getAwtComponent() | public int | getColumnCount() | public Object | getContentAt(int row, int column) Returns the object (String or Boolean) displayed in a given cell.
The returned object is that returned by the current TableCellValueConverter
used by the table. | public Object | getContentAt(int row, int column, TableCellValueConverter converter) Returns the displayed in a given cell using a specific converter. | public String | getDescriptionTypeName() | public Header | getHeader() Returns a helper interface which gives access to the table header. | public JTable | getJTable() | public int | getRowCount() | public Component | getSwingEditorComponentAt(int row, int column) | public Assertion | hasHeader() Checks that no header is displayed for this table. | public Assertion | isEditable(boolean[][] expected) | public Assertion | isEmpty() | public void | removeRowFromSelection(int row) | public void | resizeColumn(String columnName, int width) | public void | rightClick(int row, int column) | public Assertion | rowEquals(int rowIndex, Object[] expectedRow) | public Assertion | rowEquals(int rowIndex, String[] columnNames, Object[] expected) | public Assertion | rowIsSelected(int rowIndex) | public Assertion | rowsAreSelected(int[] rowIndexes) | public void | selectBlock(int top, int left, int bottom, int right) | public void | selectCell(int row, int column) | public void | selectRow(int row) | public void | selectRows(int[] rowIndexes) | public void | selectRows(int start, int end) | public Assertion | selectionEquals(boolean[][] expected) Checks the selection on a cell-by-cell basis. | public Assertion | selectionIsEmpty() | public void | setCellValueConverter(int column, TableCellValueConverter tableCellValueConverter) Sets a new converter for analyzing the cells of a given column. | public void | setDefaultCellValueConverter(TableCellValueConverter cellValueConverter) Sets a new converter for analyzing the table cells content. | public String | toString() | public Trigger | triggerClick(int row, int column, Key.Modifier modifier) | public Trigger | triggerDoubleClick(int row, int column) | public Trigger | triggerRightClick(int row, int column) |
SWING_CLASSES | final public static Class[] SWING_CLASSES(Code) | | |
addRowToSelection | public void addRowToSelection(int row)(Code) | | |
cellIsEditable | public Assertion cellIsEditable(int rowIndex, int columnIndex)(Code) | | |
cellIsSelected | public Assertion cellIsSelected(int rowIndex, int columnIndex)(Code) | | |
clearSelection | public void clearSelection()(Code) | | |
click | public void click(int row, int column)(Code) | | |
columnIsEditable | public Assertion columnIsEditable(int columnIndex, boolean isEditable)(Code) | | |
columnSizeEquals | public Assertion columnSizeEquals(int columnIndex, int expectedWidth)(Code) | | |
contentEquals | public Assertion contentEquals(Object[][] expected)(Code) | | Checks the values displayed in the table.
Sample usage:
assertTrue(table.contentEquals(new Object[][]{
{"a", Boolean.TRUE, "3"},
{"c", Boolean.FALSE, "4"}
}));
The conversion between the displayed values and the objects to
be given in the array can be customized with
Table.setCellValueConverter(int,TableCellValueConverter) |
doubleClick | public void doubleClick(int row, int column)(Code) | | |
editCell | public Cell editCell(int row, int column)(Code) | | Returns a
Cell object for interacting with the content of an individual table cell.
Sample usage:
ComboBox comboBox = table.editCell(0, 0).getComboBox();
assertTrue(comboBox.contentEquals(choices));
comboBox.select("b");
|
editCell | public void editCell(int row, int column, String value, boolean validateChange)(Code) | | Inputs some text in a given cell.
This method only works when the underlying editor is a JTextField or a JComboBox -
it will throw an exception if this is not the case, or if the cell is not editable.
Please refer to
Table.editCell(int,int) for a more flexible edition method.
|
getColumnCount | public int getColumnCount()(Code) | | |
getDescriptionTypeName | public String getDescriptionTypeName()(Code) | | |
getHeader | public Header getHeader()(Code) | | Returns a helper interface which gives access to the table header.
|
getRowCount | public int getRowCount()(Code) | | |
getSwingEditorComponentAt | public Component getSwingEditorComponentAt(int row, int column)(Code) | | |
hasHeader | public Assertion hasHeader()(Code) | | Checks that no header is displayed for this table.
|
removeRowFromSelection | public void removeRowFromSelection(int row)(Code) | | |
resizeColumn | public void resizeColumn(String columnName, int width)(Code) | | |
rightClick | public void rightClick(int row, int column)(Code) | | |
selectBlock | public void selectBlock(int top, int left, int bottom, int right)(Code) | | |
selectCell | public void selectCell(int row, int column)(Code) | | |
selectRow | public void selectRow(int row)(Code) | | |
selectRows | public void selectRows(int[] rowIndexes)(Code) | | |
selectRows | public void selectRows(int start, int end)(Code) | | |
selectionEquals | public Assertion selectionEquals(boolean[][] expected)(Code) | | Checks the selection on a cell-by-cell basis.
|
setCellValueConverter | public void setCellValueConverter(int column, TableCellValueConverter tableCellValueConverter)(Code) | | Sets a new converter for analyzing the cells of a given column.
|
setDefaultCellValueConverter | public void setDefaultCellValueConverter(TableCellValueConverter cellValueConverter)(Code) | | Sets a new converter for analyzing the table cells content.
|
triggerDoubleClick | public Trigger triggerDoubleClick(int row, int column)(Code) | | |
triggerRightClick | public Trigger triggerRightClick(int row, int column)(Code) | | |
|
|