public method O2GMessagesTable.getNextGenericRow
Brief
Gets the next row from a table.
| Declaration | ||||
|
||||
| Parameters | |
iterator |
An instance of the table iterator. |
Details
If the row is not found, the method returns null.
If you develop a GUI application based on the ForexConnect API, the method is useful for drawing rows of any table.
Note: The returned row contains the current values of fields. The values are not automatically updated. To monitor
changes, use IO2GTableListener.onChanged.
The row interface is thread-safe. One can use the returned row in different threads without synchronization.
Example
Show complete rows of Accounts and Trades Tables [hide]
// Get tables, create iterator, call printTable method
if (tableManager.getStatus() == O2GTableManagerStatus.TABLES_LOADED) {
O2GAccountsTable accountsTable = (O2GAccountsTable)tableManager.getTable(O2GTableType.ACCOUNTS);
O2GTradesTable tradesTable = (O2GTradesTable)tableManager.getTable(O2GTableType.TRADES);
O2GTableIterator iterator = new O2GTableIterator();
printTable(accountsTable, iterator);
printTable(tradesTable, iterator);
}
// Print table using getNextGenericRow
public static void printTable(O2GTable table, O2GTableIterator iterator) {
O2GTableType tableType = table.getType();
if (table.size() == 0)
System.out.println("Table " + tableType + " is empty!");
else {
O2GRow row = table.getNextGenericRow(iterator);
while (row != null) {
System.out.println("\nPrinting a row from the " + tableType + " table.\n");
O2GTableColumnCollection collection = row.getColumns();
for (int i = 0; i < collection.size(); i++) {
O2GTableColumn column = collection.get(i);
System.out.print(column.getId() + "=" + row.getCell(i) + ";");
}
System.out.println();
row = table.getNextGenericRow(iterator);
}
}
}
Declared in O2GTable