AdventNet Web NMS 4 API Specification

com.adventnet.nms.client
Class NmsClientTableModelEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--javax.swing.event.TableModelEvent
              |
              +--com.adventnet.nms.client.NmsClientTableModelEvent
All Implemented Interfaces:
java.io.Serializable

public class NmsClientTableModelEvent
extends javax.swing.event.TableModelEvent

NmsClientTableModelEvent class serves as the Event object which encapsulates the various neccessary details of an update in the client table model (NmsClientTableModel). The NmsClientTableModel being a listener to the corresponding table model on the server receives the events from the server in the form of NmsTableModelEvent and converts them into NmsClientTableModelEvent before forwarding it to its listeners. The only thing the client side code needs to worry about is the NmsClientTableModelEvent and it doesn't need to do anything about NmsTableModelEvent.

Note that NmsClientTableModelEvent extends javax.swing.event.TableModelEvent so that when the NmsClientTableModel is directly being used as the model for javax.swing.JTable, the JTable could understand the updates. When the implementation instance of NmsClientTableModel, returned on creation of custom view using the ClientAPI's ( for example ClientEventAPI ) method createCustomView, is set as the model for a JTable instance, the JTable registers as a TableModelListener with the NmsClientTableModel instance. So, updates to the JTable in the form of events (NmsClientTableModelEvent) are fired to the JTable as and when they are received from the server.

  For example, lets assume the following...
    (i)      Say the custom view you create results in some 100 objects matching the 
 criteria. 
    (ii)     And say your iterator is currently in the view range of some 80 to 99 (totally
 20, both inclusive ) with the increment value (window size) set to 50. 
    (iii)    Then say five new objects with indices 100 to 104 get added. 
 
 Now the update received in the form of NmsClientTableModelEvent would have the
 values of its fields as follows.
      properties -- Vector of five elements. Each element being a java.util.Properties
                    object. The contents of the Properties object depends on the setting
                    of getAllProperties and displayFields of NmsClientTableModel.
      rowIndexesOfServerTableModel     --  [100,101,102,103,104]
      rowIndexesOfClientTableModel     --  [20,21,22,23,24]
      totalRowCount                    --  105.
      startIndex                       --  80.
      endIndex                         --  104.
      enableNext, enablePrev, enableTop, enableBottom -- corresponding boolean values 
                                                             to indicate their states.
      type                     		 --  TableModelEvent.INSERT
      firstRow                         --  20
      lastRow                          --  24
      column                           --  TableModelEvent.ALL_COLUMNS
 
 
The update mechanism is the same as that of javax.swing.event.TableModelEvent. The value of type would be TableModelEvent.INSERT when some objects get added, TableModelEvent.DELETE when some objects get deleted and TableModelEvent.UPDATE when an update of the objects happen. The startIndex, endIndex, etc will have their values set accordingly.

See Also:
TableModelEvent, Serialized Form

Field Summary
protected  boolean enableBottom
          This boolean indicates whether you could do a successful subsequent getBottom operation.
protected  boolean enableNext
          This boolean indicates whether you could do a successful subsequent getNext operation.
protected  boolean enablePrev
          This boolean indicates whether you could do a successful subsequent getPrevious operation.
protected  boolean enableTop
          This boolean indicates whether you could do a successful subsequent getTop operation.
protected  int endIndex
          The endIndex value after this update.
protected  java.util.Vector properties
          The vector of java.util.Properties of the objects for which the update event is received.
protected  int[] rowIndexesOfClientTableModel
          Holds rowids of affected rows as per client table model.
protected  int[] rowIndexesOfServerTableModel
          Holds actual rowids of affected rows as per server table model.
protected  int startIndex
          The startIndex value after this update.
static int STATE_CHANGE
          The type of this event can take this value when the received event doesn't carry any data and is just indicating a change in the state variables like totalRowCount, enableNext, enablePrev, enableTop, enableBottom.
protected  int totalRowCount
          The totalRowCount value after this update.
 
Fields inherited from class javax.swing.event.TableModelEvent
ALL_COLUMNS, column, DELETE, firstRow, HEADER_ROW, INSERT, lastRow, type, UPDATE
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
NmsClientTableModelEvent(javax.swing.table.TableModel source, com.adventnet.nms.client.NmsTableModelEvent evt, boolean showlatest)
          Constructor which gets all the values from the NmsTableModelEvent received from the server remote table model.
 
Method Summary
 int getEndIndex()
          Gets the endIndex value after this update.
 java.util.Vector getProperties()
          Gets the vector of Properties associated with this event.
 int[] getRowIndexesOfClientTableModel()
          Returns an array of int, which contains rowids of affected rows with respect to client table model corresponding to actual rowids of server table model.
 int[] getRowIndexesOfServerTableModel()
          Returns an array of int, which contains actual rowids of affected rows as per the server table model.
 int getStartIndex()
          Gets the startIndex value after this update.
 int getTotalRowCount()
          Gets the totalRowCount.
 boolean isBottomEnabled()
          This boolean indicates whether you could do a successful subsequent getBottom operation after this update.
 boolean isNextEnabled()
          This boolean indicates whether you could do a successful subsequent getNext operation after this update.
 boolean isPreviousEnabled()
          This boolean indicates whether you could do a successful subsequent getPrevious operation after this update.
 boolean isTopEnabled()
          This boolean indicates whether you could do a successful subsequent getTop operation after this update.
 
Methods inherited from class javax.swing.event.TableModelEvent
getColumn, getFirstRow, getLastRow, getType
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

properties

protected java.util.Vector properties
The vector of java.util.Properties of the objects for which the update event is received. The size of the vector will be equal to (lastRow - firstRow + 1) where lastRow and firstRow are fields of javax.swing.event.TableModelEvent.

rowIndexesOfServerTableModel

protected int[] rowIndexesOfServerTableModel
Holds actual rowids of affected rows as per server table model.

rowIndexesOfClientTableModel

protected int[] rowIndexesOfClientTableModel
Holds rowids of affected rows as per client table model.

totalRowCount

protected int totalRowCount
The totalRowCount value after this update. The totalRowCount value could have decreased or increased or even may not have any change depending on the type of update.

startIndex

protected int startIndex
The startIndex value after this update. The startIndex value could have decreased or increased or even may not have any change depending on the type of update.

endIndex

protected int endIndex
The endIndex value after this update. The endIndex value could have decreased or increased or even may not have any change depending on the type of update.

enableNext

protected boolean enableNext
This boolean indicates whether you could do a successful subsequent getNext operation.

enablePrev

protected boolean enablePrev
This boolean indicates whether you could do a successful subsequent getPrevious operation.

enableTop

protected boolean enableTop
This boolean indicates whether you could do a successful subsequent getTop operation.

enableBottom

protected boolean enableBottom
This boolean indicates whether you could do a successful subsequent getBottom operation.

STATE_CHANGE

public static final int STATE_CHANGE
The type of this event can take this value when the received event doesn't carry any data and is just indicating a change in the state variables like totalRowCount, enableNext, enablePrev, enableTop, enableBottom.
Constructor Detail

NmsClientTableModelEvent

public NmsClientTableModelEvent(javax.swing.table.TableModel source,
                                com.adventnet.nms.client.NmsTableModelEvent evt,
                                boolean showlatest)
Constructor which gets all the values from the NmsTableModelEvent received from the server remote table model.
Method Detail

getProperties

public java.util.Vector getProperties()
Gets the vector of Properties associated with this event. Returns null when the event is of type STATE_CHANGE.

getRowIndexesOfClientTableModel

public int[] getRowIndexesOfClientTableModel()
Returns an array of int, which contains rowids of affected rows with respect to client table model corresponding to actual rowids of server table model.

getRowIndexesOfServerTableModel

public int[] getRowIndexesOfServerTableModel()
Returns an array of int, which contains actual rowids of affected rows as per the server table model.

getTotalRowCount

public int getTotalRowCount()
Gets the totalRowCount.

getStartIndex

public int getStartIndex()
Gets the startIndex value after this update. The startIndex value could have decreased or increased or even may not have any change depending on the type of update.

getEndIndex

public int getEndIndex()
Gets the endIndex value after this update. The endIndex value could have decreased or increased or even may not have any change depending on the type of update.

isNextEnabled

public boolean isNextEnabled()
This boolean indicates whether you could do a successful subsequent getNext operation after this update.

isPreviousEnabled

public boolean isPreviousEnabled()
This boolean indicates whether you could do a successful subsequent getPrevious operation after this update.

isTopEnabled

public boolean isTopEnabled()
This boolean indicates whether you could do a successful subsequent getTop operation after this update.

isBottomEnabled

public boolean isBottomEnabled()
This boolean indicates whether you could do a successful subsequent getBottom operation after this update.

AdventNet Web NMS 4 API Specification