public method IO2GTableListener.onChanged
Brief
Processes a notification about the row change in a table.
Declaration | ||||
|
Parameters | |
rowID |
The identifier of a row. The parameter has the value of the row identifier for a specific trading table. For example, for the Accounts table, it has the value of the AccountID field. The complete list of the identifiers is shown below. |
rowData |
The object representing a row of a table. In order to process the parameter, you need to know what table it belongs to. It can be accomplished by calling
the |
Details
Table name |
|
Cast |
Casting syntax |
AccountID |
|
||
OfferID |
|
||
TradeID |
|
||
TradeID |
|
||
OrderID |
|
||
MsgID |
|
||
OfferID |
|
To get notifications about row changes in a specific table, an instance of the class implementing the
IO2GTableListener interface must be subscribed to the Update
operation of this table.
It is accomplished by calling the O2GTable
.subscribeUpdate
method with the O2GTableUpdateType
.Update
parameter.
For example, if you want to get notifications about the updates of the Trades table, write the following line:
tradesTable.subscribeUpdate(O2GTableUpdateType.Update, tableListener);
In case the update has been received from the server, the parameter contains a new instance of the object. In case the cause of the update is calculated fields, the instance of the object is equal to the previous call of this method, but calculated fields contain new values.
One can use O2GRow.isCellChanged
to find out if fields have been changed.
For the implementation details, see the example below: Example
Process a notification about updates of the Trades table [hide]
// Create session which uses table manager mSession = O2GTransport.createSession(); mSession.useTableManager(O2GTableManagerMode.Yes, null); //... // After the login, get instances of the table manager and Trades table O2GTableManager tableManager = mSession.getTableManager(); O2GTradesTable tradesTable = (O2GTradesTable)tableManager.getTable(O2GTableType.Trades); // ... // Subscribe listener, listen to updates of the Trades table, unsubscribe listener TableListener tableListener = new TableListener(); tradesTable.subscribeUpdate(O2GTableUpdateType.Update, tableListener); Thread.Sleep(1000); offersTable.unsubscribeUpdate(O2GTableUpdateType.Update, tableListener); // Implementation of IO2GTableListener interface public method onChanged public void onChanged(String rowID, O2GRow rowData) { O2GTradeTableRow trade = (O2GTradeTableRow)(rowData); Console.WriteLine("Trade information changed " + rowID); Console.WriteLine("TradeID: " + trade.TradeID + " Close = " + trade.Close); }
Declared in IO2GTableListener