org.snmp4j.agent.mo
Class DefaultMOMutableTableModel

java.lang.Object
  extended by org.snmp4j.agent.mo.DefaultMOTableModel
      extended by org.snmp4j.agent.mo.DefaultMOMutableTableModel
All Implemented Interfaces:
MOMutableTableModel, MOTableModel, MOTableRowFactory
Direct Known Subclasses:
UsmMIB.UsmTableModel

public class DefaultMOMutableTableModel
extends DefaultMOTableModel
implements MOMutableTableModel


Nested Class Summary
 class DefaultMOMutableTableModel.FilteredRowIterator
           
 
Field Summary
protected  MOTableRowFactory rowFactory
           
 
Fields inherited from class org.snmp4j.agent.mo.DefaultMOTableModel
columnCount, rows
 
Constructor Summary
DefaultMOMutableTableModel()
           
 
Method Summary
 void addMOTableModelListener(MOTableModelListener l)
           
 MOTableRow addRow(MOTableRow row)
          Adds a row to the table.
 void clear()
          Removes all rows.
 void clear(MOTableRowFilter filter)
          Remove all rows that do not match the given filter criteria from the model.
 MOTableRow createRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values)
          Create a new row and return it.
protected  void fireTableModelChanged(MOTableModelEvent event)
           
 void freeRow(MOTableRow row)
          Frees resources associated with the supplied row which is to be deleted.
 MOTableRowFactory getRowFactory()
           
 java.util.List getRows(org.snmp4j.smi.OID lowerBound, org.snmp4j.smi.OID upperBoundEx)
          Returns a lexicographic ordered list of the rows in the specified index range.
 java.util.List getRows(org.snmp4j.smi.OID lowerBound, org.snmp4j.smi.OID upperBoundEx, MOTableRowFilter filter)
          Returns a lexicographic ordered list of the rows in the specified index range that match the supplied filter.
 java.util.Iterator iterator(MOTableRowFilter filter)
          Returns an iterator over all rows in this table that pass the given filter.
 void removeMOTableModelListener(MOTableModelListener l)
           
 MOTableRow removeRow(org.snmp4j.smi.OID index)
          Removes the row with the specified index from the table and returns it.
 void removeRows(org.snmp4j.smi.OID lowerBoundIncl, org.snmp4j.smi.OID upperBoundExcl)
           
 void setColumnCount(int columnCount)
           
 void setRowFactory(MOTableRowFactory rowFactory)
          Sets the factory instance to be used for creating rows for this model.
 
Methods inherited from class org.snmp4j.agent.mo.DefaultMOTableModel
containsRow, firstIndex, firstRow, getColumnCount, getRow, getRowCount, iterator, lastIndex, lastRow, tailIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.snmp4j.agent.mo.MOTableModel
containsRow, firstIndex, firstRow, getColumnCount, getRow, getRowCount, iterator, lastIndex, lastRow, tailIterator
 

Field Detail

rowFactory

protected MOTableRowFactory rowFactory
Constructor Detail

DefaultMOMutableTableModel

public DefaultMOMutableTableModel()
Method Detail

getRowFactory

public MOTableRowFactory getRowFactory()

getRows

public java.util.List getRows(org.snmp4j.smi.OID lowerBound,
                              org.snmp4j.smi.OID upperBoundEx)
Returns a lexicographic ordered list of the rows in the specified index range.

Parameters:
lowerBound - the lower bound index (inclusive) for the rows in the returned list.
upperBoundEx - the upper bound index (exclusive) for the rows in the returned list.
Returns:
the possibly empty lexicographically ordered List of rows of this table model in the specified index range. Modifications to the list will not affect the underlying table model, although modifications to the row elements will.

getRows

public java.util.List getRows(org.snmp4j.smi.OID lowerBound,
                              org.snmp4j.smi.OID upperBoundEx,
                              MOTableRowFilter filter)
Returns a lexicographic ordered list of the rows in the specified index range that match the supplied filter.

Parameters:
lowerBound - the lower bound index (inclusive) for the rows in the returned list.
upperBoundEx - the upper bound index (exclusive) for the rows in the returned list.
filter - the filter to exclude rows in the range from the returned
Returns:
the possibly empty lexicographically ordered List of rows of this table model in the specified index range. Modifications to the list will not affect the underlying table model, although modifications to the row elements will.

removeRow

public MOTableRow removeRow(org.snmp4j.smi.OID index)
Description copied from interface: MOMutableTableModel
Removes the row with the specified index from the table and returns it.

Specified by:
removeRow in interface MOMutableTableModel
Parameters:
index - the row index of the row to remove.
Returns:
the removed row or null if the table did not contain such a row.

removeRows

public void removeRows(org.snmp4j.smi.OID lowerBoundIncl,
                       org.snmp4j.smi.OID upperBoundExcl)

clear

public void clear()
Description copied from interface: MOMutableTableModel
Removes all rows.

Specified by:
clear in interface MOMutableTableModel

clear

public void clear(MOTableRowFilter filter)
Remove all rows that do not match the given filter criteria from the model.

Specified by:
clear in interface MOMutableTableModel
Parameters:
filter - the MOTableRowFilter that filters out the rows to delete.

iterator

public java.util.Iterator iterator(MOTableRowFilter filter)
Returns an iterator over all rows in this table that pass the given filter. If the table might be modified while the iterator is used, it is recommended to synchronize on this model while iterating.

Parameters:
filter - a MOTableRowFilter instance that defines the rows to return.
Returns:
an Iterator.

createRow

public MOTableRow createRow(org.snmp4j.smi.OID index,
                            org.snmp4j.smi.Variable[] values)
                     throws java.lang.UnsupportedOperationException
Create a new row and return it. The new row will not be added to the table. To add it to the model use the addRow(org.snmp4j.agent.mo.MOTableRow) method. If this mutable table does not support row creation, it should throw an UnsupportedOperationException.

Specified by:
createRow in interface MOTableRowFactory
Parameters:
index - the index OID for the new row.
values - the values to be contained in the new row.
Returns:
the created MOTableRow.
Throws:
java.lang.UnsupportedOperationException - if the specified row cannot be created.

setRowFactory

public void setRowFactory(MOTableRowFactory rowFactory)
Description copied from interface: MOMutableTableModel
Sets the factory instance to be used for creating rows for this model.

Specified by:
setRowFactory in interface MOMutableTableModel
Parameters:
rowFactory - a MOTableRowFactory instance or null to disable row creation.

setColumnCount

public void setColumnCount(int columnCount)

freeRow

public void freeRow(MOTableRow row)
Description copied from interface: MOTableRowFactory
Frees resources associated with the supplied row which is to be deleted.

Specified by:
freeRow in interface MOTableRowFactory
Parameters:
row - a MOTableRow that has been created using this factory and is now to be deleted (removed from the associated table).

addMOTableModelListener

public void addMOTableModelListener(MOTableModelListener l)

removeMOTableModelListener

public void removeMOTableModelListener(MOTableModelListener l)

fireTableModelChanged

protected void fireTableModelChanged(MOTableModelEvent event)

addRow

public MOTableRow addRow(MOTableRow row)
Description copied from interface: MOMutableTableModel
Adds a row to the table. If a row with the same index already exists it will be replaced and returned.

Specified by:
addRow in interface MOMutableTableModel
Overrides:
addRow in class DefaultMOTableModel
Parameters:
row - the MOTableRow instance to add.
Returns:
the previous row with the specified index or null if it did not have one.

Copyright 2005-2008 Frank Fock (SNMP4J.org)