public method O2GTable.isCellChanged

Brief

Checks whether the value of a cell has changed on not.

Declaration
Java
boolean  isCellChanged (int row, int column)

Parameters
row

The index of a row. The index must be between 0 and size() - 1.

column

The index of a column. The index must be between 0 and O2GTableColumnCollection.size() - 1.

Details

The possible return values are:

true

The cell value in a table has changed since the previous update.

false

The cell value in a table has not changed since the previous update.

If you develop a GUI application based on the ForexConnect API, the method is useful for redrawing cells with a changed value.

Example

Checking if cell value has changed [hide]

    // Get tables, call printTable method
    if (tableManager.getStatus() == O2GTableManagerStatus.TABLES_LOADED) {
        O2GAccountsTable accountsTable = (O2GAccountsTable)tableManager.getTable(O2GTableType.ACCOUNTS);
        O2GTradesTable tradesTable = (O2GTradesTable)tableManager.getTable(O2GTableType.TRADES);
        printTable(accountsTable);
        printTable(tradesTable);
    }
 
     Check if cell value has changed
    public static void printTable(O2GTable table) {
        int columnsCount = 0;
        boolean bIsCellChanged = false;
        O2GTableType tableType = table.getType();
        if (table.size() == 0) {
            System.out.println("Table " + tableType + " is empty!");
        } else {
            O2GTableColumnCollection columns = table.getColumns();
            columnsCount = columns.size();
            for (int j = 0; j < columnsCount; j++) {
                O2GTableColumn column = columns.get(j);
                System.out.println("" + column.getId() + " " + column.getType());
                for (int i = 0; i < table.size(); i++) {
                    Object value = table.getCell(i, j);
                    bIsCellChanged = table.isCellChanged(i, j);
                    System.out.println("Value: " + value + " Changed: " + bIsCellChanged);
                }
            }
        }
    }

Declared in O2GTable

back