Package com.rs.seagull.emulator.api
Interface Table
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
Modifier and TypeInterfaceDescriptionstatic interface
A Row represents one entry in a Table, consisting of a list of Fields.static interface
A RowVisitor is called for each row.static interface
A Scroll action is invoked when a table iterator (e.g.static interface
A StopCondition is a Condition that returns true from its isTrue method when a table iterator (e.g.static interface
A 'wait for' condition. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a row to the table.void
Add a row to the table.int
Find a row by the given search criteria.int
Find a row by the given search criteria.Returns the names of the table's columns.Returns the ScrollAction for moving forward through the pages of the Table.getRows
(boolean includeBlankRows) Retrieve all the rows of the table.Returns the StopCondition for the Table.void
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 Details
-
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
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
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.
-
findRow
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. For each page, a Runnable is executed.- Parameters:
searchCriteria
- The content to find.eachPage
- the Runnable to execute for every page- Returns:
- The zero-based index of the found row within the current page. -1 if not found.
-
addRow
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.
-
addRow
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. For each page, a Runnable is executed.- 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.eachPage
- the Runnable to execute for every page
-
updateRow
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
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.
-