org.eclipse.swtbot.swt.finder.widgets
Class SWTBotTable

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot<Table>
      extended by org.eclipse.swtbot.swt.finder.widgets.SWTBotTable

public class SWTBotTable
extends AbstractSWTBot<Table>

Version:
$Id$
Author:
Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>

Field Summary
 
Fields inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
description, display, log, widget
 
Constructor Summary
SWTBotTable(Table table)
          Constructs a new instance of this object.
SWTBotTable(Table table, SelfDescribing description)
          Constructs a new instance of this object.
 
Method Summary
protected  void assertIsLegalCell(int row, int column)
          Asserts that the row and column are legal for this instance of the table.
 String cell(int row, int column)
          Gets the cell data for the given row/column index.
 String cell(int row, String columnName)
          Gets the cell data for the given row and column label.
 void click(int row, int column)
          Click on the table on given cell.
 int columnCount()
          Gets the column count.
 List<String> columns()
          Gets the columns in this table.
 boolean containsItem(String item)
           
 void doubleClick(int row, int column)
          Click on the table on given cell.
 SWTBotTableItem getTableItem(int row)
          Gets the table item matching the given row number.
 SWTBotTableItem getTableItem(String itemText)
          Gets the table item matching the given name.
 SWTBotTableColumn header(String label)
          Gets the column matching the given label.
 int indexOf(String item)
          Gets the index of the item matching the given item.
 int indexOf(String item, int column)
          Gets the index of the item matching the given item and the given column.
 int indexOf(String item, String column)
          Gets the index of the item matching the given item and the given column.
 int indexOfColumn(String column)
           
protected  void notifySelect()
          Notifies the selection.
 int rowCount()
          Gets the row count.
 void select(int... indices)
          Selects the given index items.
 void select(String... items)
          Sets the selection to the given items.
 TableCollection selection()
          Gets the selected items.
 int selectionCount()
          Gets the selected item count.
 void unselect()
          Unselect all selections.
 
Methods inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
absoluteLocation, assertEnabled, asyncExec, backgroundColor, click, click, clickXY, contextMenu, contextMenu, createEvent, createMouseEvent, createSelectionEvent, doubleClickXY, foregroundColor, getId, getText, getToolTipText, hasStyle, isActive, isEnabled, isEnabledInternal, isVisible, keyboard, notify, notify, notify, pressShortcut, pressShortcut, pressShortcut, rightClick, rightClick, setFocus, sleep, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, toString, traverse, waitForEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SWTBotTable

public SWTBotTable(Table table)
            throws WidgetNotFoundException
Constructs a new instance of this object.

Parameters:
table - the widget.
Throws:
WidgetNotFoundException - if the widget is null or widget has been disposed.

SWTBotTable

public SWTBotTable(Table table,
                   SelfDescribing description)
            throws WidgetNotFoundException
Constructs a new instance of this object.

Parameters:
table - the widget.
description - the description of the widget, this will be reported by AbstractSWTBot.toString()
Throws:
WidgetNotFoundException - if the widget is null or widget has been disposed.
Method Detail

rowCount

public int rowCount()
Gets the row count.

Returns:
the number of rows in the table

columnCount

public int columnCount()
Gets the column count.

Returns:
the number of columns in the table

columns

public List<String> columns()
Gets the columns in this table.

Returns:
the list of columns in the table.

indexOfColumn

public int indexOfColumn(String column)
Parameters:
column - the text on the column.
Returns:
the index of the specified column.
Since:
1.3

header

public SWTBotTableColumn header(String label)
                         throws WidgetNotFoundException
Gets the column matching the given label.

Parameters:
label - the header text.
Returns:
the header of the table.
Throws:
WidgetNotFoundException - if the header is not found.

cell

public String cell(int row,
                   int column)
Gets the cell data for the given row/column index.

Parameters:
row - the row in the table.
column - the column in the table.
Returns:
the cell at the location specified by the row and column

cell

public String cell(int row,
                   String columnName)
Gets the cell data for the given row and column label.

Parameters:
row - the row in the table
columnName - the column title.
Returns:
the cell in the table at the specified row and columnheader

selectionCount

public int selectionCount()
Gets the selected item count.

Returns:
the number of selected items.

selection

public TableCollection selection()
Gets the selected items.

Returns:
the selection in the table

select

public void select(String... items)
Sets the selection to the given items.

Parameters:
items - the items to select in the table.
Since:
1.0

indexOf

public int indexOf(String item)
Gets the index of the item matching the given item.

Parameters:
item - the item in the table.
Returns:
the index of the specified item in the table, or -1 if the item does not exist in the table.
Since:
1.0

containsItem

public boolean containsItem(String item)
Parameters:
item - the item in the table.
Returns:
true if the table contains the specified item, false otherwise.

indexOf

public int indexOf(String item,
                   int column)
Gets the index of the item matching the given item and the given column.

Parameters:
item - the index of the item in the table, or -1 if the item does not exist in the table.
column - the column for which to get the index of.
Returns:
the index of the specified item and of the specified column in the table.
Since:
1.3

indexOf

public int indexOf(String item,
                   String column)
Gets the index of the item matching the given item and the given column.

Parameters:
item - the index of the item in the table, or -1 if the item does not exist in the table.
column - the column for which to get the index of.
Returns:
the index of the specified item and of the specified column in the table.
Since:
1.3

unselect

public void unselect()
Unselect all selections.


select

public void select(int... indices)
Selects the given index items.

Parameters:
indices - the row indices to select in the table.

notifySelect

protected void notifySelect()
Notifies the selection.


click

public void click(int row,
                  int column)
Click on the table on given cell. This can be used to activate a cellEditor on a cell.

Parameters:
row - the row in the table.
column - the column in the table.
Since:
1.2

doubleClick

public void doubleClick(int row,
                        int column)
Click on the table on given cell. This can be used to activate a cellEditor on a cell.

Parameters:
row - the row in the table.
column - the column in the table.
Since:
1.2

assertIsLegalCell

protected void assertIsLegalCell(int row,
                                 int column)
Asserts that the row and column are legal for this instance of the table.

Parameters:
row - the row number
column - the column number
Since:
1.2

getTableItem

public SWTBotTableItem getTableItem(String itemText)
                             throws WidgetNotFoundException
Gets the table item matching the given name.

Parameters:
itemText - the text on the node.
Returns:
the table item with the specified text.
Throws:
WidgetNotFoundException - if the node was not found.
Since:
1.3

getTableItem

public SWTBotTableItem getTableItem(int row)
                             throws WidgetNotFoundException
Gets the table item matching the given row number.

Parameters:
row - the row number.
Returns:
the table item with the specified row.
Throws:
WidgetNotFoundException - if the node was not found.
Since:
2.0