Package com.rs.seagull.emulator.api
Interface Table
-
public interface Table extends Control
A Table represents a collection of rows and columns, often spanning multiple 'pages'. The primary retrieval APIs are visitRows and getRows. TODO Discuss pros/cons of nesting a bunch of interfaces in here rather than exposing them at the top level of the package. I like having them in here because (1) they are specific to Table, I don't think they are useful outside of Table, and (2) they keep the top level from getting too cluttered.- Version:
- $Id$
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Table.Row
A Row represents one entry in a Table, consisting of a list of Fields.static interface
Table.RowVisitor
A RowVisitor is called for each row.static interface
Table.ScrollAction
A Scroll action is invoked when a table iterator (e.g.static interface
Table.StopCondition
A StopCondition is a Condition that returns true from its isTrue method when a table iterator (e.g.static interface
Table.WaitForCondition
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addRow(List<String> columnNames, List<String> rowData)
Add a row to the table.void
addRow(List<String> columnNames, List<String> rowData, Runnable eachPage)
int
findRow(Map<String,String> searchCriteria)
Find a row by the given search criteria.int
findRow(Map<String,String> searchCriteria, Runnable eachPage)
List<String>
getColumnNames()
Returns the names of the table's columns.Table.ScrollAction
getNextPageScrollAction()
Returns the ScrollAction for moving forward through the pages of the Table.List<Table.Row>
getRows(boolean includeBlankRows)
Retrieve all the rows of the table.Table.StopCondition
getStopCondition()
Returns the StopCondition for the Table.void
updateRow(List<String> columnNames, List<String> rowData, int rowNumber)
Update a row of the table.void
visitRows(Table.RowVisitor visitor, boolean includeBlankRows, boolean forUpdate, Runnable eachPage)
Call the RowVisitor for each row in the table.void
visitRows(Table.RowVisitor visitor, boolean includeBlankRows, Runnable eachPage)
Call the RowVisitor for each row in the table.
-
-
-
Method Detail
-
visitRows
void visitRows(Table.RowVisitor visitor, boolean includeBlankRows, Runnable eachPage) throws NoSuchFieldException, TableScrollException
Call the RowVisitor for each row in the table. Continue until either RowVisitor>visit returns false or to the end of the table.- Parameters:
visitor
- method to call for each rowincludeBlankRows
- obviouseachPage
- an optional method that will be called once for each page- Throws:
NoSuchFieldException
- if one of the columns does not exist on the screenTableScrollException
- if the screen changes during the visit.
-
visitRows
void visitRows(Table.RowVisitor visitor, boolean includeBlankRows, boolean forUpdate, Runnable eachPage) throws NoSuchFieldException, TableScrollException
Call the RowVisitor for each row in the table. Continue until either RowVisitor>visit returns false or to the end of the table.- Parameters:
visitor
- method to call for each rowincludeBlankRows
- obviouseachPage
- an optional method that will be called once for each pageforUpdate
- set to true if you are going to be updating the rows, default is false.- Throws:
NoSuchFieldException
- if one of the columns does not exist on the screenTableScrollException
- if the screen changes during the visit.
-
getRows
List<Table.Row> getRows(boolean includeBlankRows) throws NoSuchFieldException
Retrieve all the rows of the table. Impl note: This just calls visitRows collecting all the rows.- Parameters:
includeBlankRows
- a flag to indicate whether or not to include blank rows- Returns:
- all the rows
- Throws:
NoSuchFieldException
- if one of the columns does not exist on the screen
-
findRow
int findRow(Map<String,String> searchCriteria)
Find a row by the given search criteria. The searchCriteria entries are fieldName => fieldValue. The table is scrolled as needed. The value returned is a zero-based index within the current page.- Parameters:
searchCriteria
- The content to find.- Returns:
- The zero-based index of the found row within the current page. -1 if not found.
-
addRow
void addRow(List<String> columnNames, List<String> rowData)
Add a row to the table. First, the table is searched to find an empty row, scrolling forward if needed, then the given data is inserted into that row.- Parameters:
columnNames
- The names of the column fields that the rowData goes into.rowData
- A value to insert into each table cell in the row, corresponding to the columnNames.
-
updateRow
void updateRow(List<String> columnNames, List<String> rowData, int rowNumber)
Update a row of the table. The given data is inserted into the given zero-based rowNumber.- Parameters:
columnNames
- The names of the column fields that the rowData goes into.rowData
- A value to insert into each table cell in the row, corresponding to the columnNames.rowNumber
- The row to update.
-
getColumnNames
List<String> getColumnNames()
Returns the names of the table's columns.- Returns:
- the names of the table's columns.
-
getStopCondition
Table.StopCondition getStopCondition()
Returns the StopCondition for the Table.- Returns:
- the StopCondition for the Table.
-
getNextPageScrollAction
Table.ScrollAction getNextPageScrollAction()
Returns the ScrollAction for moving forward through the pages of the Table.- Returns:
- the ScrollAction for moving forward through the pages of the Table.
-
-