|
"WEBNMS_5 API Docs" | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface NmsClientTableModel
NmsClientTableModel is the core interface which represents the customized TableModel for WebNMS Client. This client model is the one which interacts with its server-side counterpart model. The updates occuring on the server are communicated to the client model by its counterpart server-side model. The updates received by the NmsClientTableModel are then routed to its listeners.
One could register with this model for updates. He/she could do so using the following method of javax.swing.table.TableModel (which this interface extends)
void addTableModelListener(javax.swing.event.TableModelListener l)The listener class you give should implement javax.swing.event.TableModelListener which just has one method in it of the following prototype.
void tableChanged(TableModelEvent e).
The tableChanged method of the listener class you write will be called
whenever an update is received. An important thing to be noted here is that the event object received as the parameter to tableChanged will be an instance of NmsClientTableModelEvent. So, updates are thrown in the form of NmsClientTableModelEvent to the registered listeners. Now you could type cast the received TableModelEvent to NmsClientTableModelEvent and leverage the info embedded in it.
The implementation of this NmsClientTableModel interface could be used in two ways.
One, as an iterator to fetch the data from the WebNMS Server. And the other is that it could be directly set as the TableModel for the JTable component.
(Note that this interface extends javax.swing.table.TableModel). The second option would be of much use if the WebNMS client implementation opts to use JTable as the UI component to display the data.
When NmsClientTableModel is set as the model directly for the JTable, the JTable (himself being a TableModelListener) registers with the model passed to him. JTable decodes the TableModelEvent passed to him and updates its User Interface accordingly after querying the model about the data involved in the update. But JTable is ignorant of the fact that the event received is of type NmsClientTableModelEvent. By the time JTable receives the event and comes back to the model to retrieve the data and update its user interface, the model would have updated its local cache with the data embedded in the event so that it could give the data to the JTable. (i.e) The NmsClientTableModel implementation, being a listener to its server-side counterpart, receives the event from the server and updates it in its local cache and only then it forwards the event to its listeners. So, when JTable comes back to get the data, the client model would retrieve it from the local cache and give it.
An instance of the implementation of this interface is returned by the createCustomView methods of the Client API's (For example, the com.adventnet.nms.topoui.ClientTopoAPIImpl).
com.adventnet.nms.topoui.ClientTopoAPIImpl,
NmsClientTableModelEvent| Method Summary | |
|---|---|
boolean |
changeCriteriaProperties(java.util.Properties p)
Changes the criteria of the custom view model. |
boolean |
changeName(java.lang.String newName)
Deprecated. since changing of the viewID of a Custom View is not supported. |
boolean |
getAllProperties(boolean getAll)
Option to set whether the model would fetch all the properties of the object(say Event) or just those specified through setDisplayFields method. |
java.util.Vector |
getBottom()
Fetches the last set of current increment number of objects. |
java.util.Vector |
getBottom(int num)
Fetches the last set of num number of objects. |
java.util.Vector |
getCacheData()
This method will return entire data from the client table model. |
java.util.Properties |
getCriteriaProperties()
Returns the criteria properties based on which the objects are fetched. |
java.lang.String[] |
getDisplayFields()
Returns the current setting of the displayFields. |
java.lang.String[] |
getDisplayLabels()
Returns the setting of the displayLabels. |
int |
getEndIndex()
Returns the current end Index of the view range represented by the client model. |
int |
getIncrement()
Returns the current increment value set. |
java.lang.String |
getKey(int index)
Gets the key of the object at the particular index. |
java.lang.String |
getKeyFieldName()
Returns the key field name of the objects retrieved. |
java.lang.String |
getName()
Returns the name assigned to the Model. |
java.util.Vector |
getNext()
Fetches the next set of data based on the current increment value set. |
java.util.Vector |
getNext(int num)
Fetches the next set of data based on the given increment value. |
java.util.Vector |
getNext(int num,
boolean sameStart)
Fetches a set of data based on the given increment value and the boolean argument sameStart. |
java.lang.String |
getOrderByColumn()
getOrderByColumn method returns the name of the column by which the data should be ordered. |
java.util.Vector |
getPrevious()
Fetches the previous set of data based on the current increment value set. |
java.util.Vector |
getPrevious(int num)
Fetches the previous set of data based on the given increment value. |
java.util.Vector |
getPrevious(int num,
boolean sameEnd)
Fetches a set of data based on the given increment value and the boolean argument sameEnd. |
java.util.Properties |
getRow(int index)
Gets the Properties of the object at the particular index. |
int |
getStartIndex()
Returns the current start Index of the view range represented by the client model. |
java.util.Vector |
getTop()
Fetches the first set of current increment number of objects. |
java.util.Vector |
getTop(int num)
Fetches the first set of num number of objects. |
int |
getTotalRowCount()
Gets the total number of objects. |
boolean |
isAscendingOrder()
isAscendingOrder method returns whether the data is sorted
by ascending order based on orderByColumn. |
boolean |
isBottomEnabled()
Returns the current state of the subsequent getBottom operation. |
boolean |
isNextEnabled()
Returns the current state of the subsequent getNext operation. |
boolean |
isPreviousEnabled()
Returns the current state of the subsequent getPrevious operation. |
boolean |
isShowLatest()
Can be used to know whether showLatest is set to true or not. |
boolean |
isTopEnabled()
Returns the current state of the subsequent getTop operation. |
java.util.Vector |
refreshModel()
This method update the table model with whatever properties have been set for the table mdel. |
boolean |
registerForUpdates()
registerForUpdates method registers this table model for receiving updates from FE. |
boolean |
setDisplayFields(java.lang.String[] names)
Sets the displayFields value. |
boolean |
setDisplayFields(java.lang.String[] names,
java.lang.String[] labels)
Sets the displayFields and the display labels that are to be shown in the JTable. |
boolean |
setIncrement(int num)
Sets the increment or the window size by which the getNext and getPrevious methods would retrieve the data. |
boolean |
setKeyFieldName(java.lang.String key)
Used for internal purposes only. |
boolean |
setOrderByColumn(java.lang.String columnName,
boolean sortByAscendingOrder)
setOrderByColumn orders the data based on the column name and refetches the data. |
boolean |
setViewRange(int startIndex,
int endIndex)
This method can be used to change the view range of a custom view dynamically. |
boolean |
showLatest(boolean showlatest)
To set the showLatest mode. |
boolean |
unRegisterForUpdates()
unRegisterForUpdates method un-registers this table model (if already registered) to stop receiving updates from FE. |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt |
| Method Detail |
|---|
boolean setIncrement(int num)
num - the window size.boolean getAllProperties(boolean getAll)
The default value for this option is false. (i.e) by default only a standard set of fields of the object will be retrieved. You need to set this option explicitly to retrieve all the properties of the object. This option overides the behaviour of setDisplayFields. (i.e) setting this option to true would fetch all the properties irrespective of the setting of displayFields. But anyhow the TableModel methods like getValueAt, getColumnName, etc would only be dependent on the displayFields value.
setDisplayFields(String[]),
setDisplayFields(String[], String[])int getTotalRowCount()
TableModel.getRowCount()java.util.Vector getNext()
java.util.Vector getNext(int num)
java.util.Vector getNext(int num,
boolean sameStart)
When sameStart is true it fetches next num number of objects from the startIndex.
When sameStart is false it fetches next num number of objects from the endIndex which is same as the getNext(int) method.
Returns null when the iteration has reached the end.
java.util.Vector getPrevious()
java.util.Vector getPrevious(int num)
java.util.Vector getPrevious(int num,
boolean sameEnd)
When sameEnd is true it fetches previous num number of objects from the endIndex.
When sameEnd is false it fetches previous num number of objects from the startIndex which is same as the getPrevious(int) method.
Returns null when the iteration has reached the end.
java.util.Vector getTop()
java.util.Vector getTop(int num)
Returns a Vector of no elements when there is no data .
java.util.Vector getBottom()
Returns a Vector of no elements when there is no data .
java.util.Vector getBottom(int num)
Returns a Vector of no elements when there is no data .
java.lang.String getName()
boolean changeName(java.lang.String newName)
java.util.Properties getCriteriaProperties()
boolean changeCriteriaProperties(java.util.Properties p)
java.lang.String[] getDisplayFields()
java.lang.String[] getDisplayLabels()
boolean setDisplayFields(java.lang.String[] names)
When this method is used the displayLabels will get the same value as displayFields.
Need to call refreshModel() to update the table model for notifying the change. Returns true on successfully changing the displayFields.
boolean setDisplayFields(java.lang.String[] names,
java.lang.String[] labels)
Need to call refreshModel() to update the table model for notifying the change. Returns true on successfully changing the displayFields.
java.lang.String getKey(int index)
java.util.Properties getRow(int index)
boolean setKeyFieldName(java.lang.String key)
java.lang.String getKeyFieldName()
int getStartIndex()
int getEndIndex()
int getIncrement()
boolean isNextEnabled()
boolean isPreviousEnabled()
boolean isTopEnabled()
boolean isBottomEnabled()
boolean showLatest(boolean showlatest)
For example, assume that the current view length is 20. And the view range is 41 to 50. And also the table is showing last page of data. ie, total count of model data is 50.
Now suppose if a new row is added as 51 th row, 41 st row will be removed and new row will be appended at the end of the table if showLatest is true.
The default value is false.
Presently this feature supports only for Events.
boolean isShowLatest()
boolean setViewRange(int startIndex,
int endIndex)
The new increment value will be calculated from the two arguments as follows.
ViewLength = endIndex - startIndex;
refreshModel method should be called after setting the view range
to retrieve the new set of objects.
java.util.Vector refreshModel()
java.util.Vector getCacheData()
boolean registerForUpdates()
registerForUpdates method registers this table model for receiving updates from FE.
boolean value on whether the request was successfull.boolean unRegisterForUpdates()
unRegisterForUpdates method un-registers this table model (if already registered) to stop receiving updates from FE.
boolean value on whether the request was successfull.
boolean setOrderByColumn(java.lang.String columnName,
boolean sortByAscendingOrder)
setOrderByColumn orders the data based on the column name and refetches the data.
columnName - a String value of a valid column present in this view.sortByAscendingOrder - a boolean value of whether to order the rows in ascending order or not.
boolean valuejava.lang.String getOrderByColumn()
getOrderByColumn method returns the name of the column by which the data should be ordered.
String value of column by which the data should be sort.boolean isAscendingOrder()
isAscendingOrder method returns whether the data is sorted
by ascending order based on orderByColumn.
true if data should be sorted in ascending
order based on orderByColumn, false
otherwise.
|
"WEBNMS_5 API Docs" | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||