Class SnmpTableImpl<IC extends SnmpProxyIndexColumn,C extends SnmpProxyColumn,IT,T,R extends SnmpProxyRow<IT,T>>

java.lang.Object
javax.swing.table.AbstractTableModel
org.snmp4j.model.snmp.proxy.impl.SnmpTableImplRO<C,IC,IT,T,R>
org.snmp4j.model.snmp.proxy.impl.SnmpTableImpl<IC,C,IT,T,R>
Type Parameters:
C - the proxy column type fo the table proxy.
IC - the index proxy column type for the table proxy.
IT - the model value type for index columns.
T - the model value type for the columnar model values.
R - the proxy row type for the rows of the table.
All Implemented Interfaces:
Serializable, Iterable<R>, Collection<R>, TableModel, MutableSnmpProxy, SnmpCommitListener, SnmpProxyObject, SnmpTable<C,IC,IT,T,R>, SnmpTableRO<IC,C,IT,T,R>, SnmpTableUpdateListener<R>

public class SnmpTableImpl<IC extends SnmpProxyIndexColumn,C extends SnmpProxyColumn,IT,T,R extends SnmpProxyRow<IT,T>> extends SnmpTableImplRO<C,IC,IT,T,R> implements SnmpTable<C,IC,IT,T,R>
The SnmpTableImpl class implements a writable SNMP table that implements the Java TableModel.
Author:
Frank Fock
See Also:
  • Constructor Details

    • SnmpTableImpl

      public SnmpTableImpl(org.snmp4j.smi.OID tableEntryOID, org.snmp4j.smi.OctetString context, SnmpProxyCommitter snmpProxyCommitter, SnmpProxyRowFactory<R,IT,T> rowFactory, List<IC> indexColumns, List<C> columns, int pageSize)
      Creates a proxy table implementation based on the SNMP table entry object identifier and lists with the index and regular column proxy objects as well as a page size to support paged table models.
      Parameters:
      tableEntryOID - the OID of the SNMP table Entry object (thus the table OID inclusive the entry suffix .1).
      context - the SNMP context associated with this proxy object.
      snmpProxyCommitter - the proxy committer used to commit changes to model values to the associated target SNMP entity.
      rowFactory - the factory for new model rows.
      indexColumns - the index proxy column objects.
      columns - the proxy column objects.
      pageSize - the page size for paged table models. A zero (or less) size disables paging.
  • Method Details

    • getCommitter

      public SnmpProxyCommitter getCommitter()
      Specified by:
      getCommitter in interface MutableSnmpProxy
    • setValueAt

      public void setValueAt(Object aValue, int rowIndex, int columnIndex)
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class AbstractTableModel
    • getCellUpdateListener

      public SnmpCellUpdateListener getCellUpdateListener()
      Description copied from interface: SnmpTable
      Gets the cell update listener associated with this table.
      Specified by:
      getCellUpdateListener in interface SnmpTable<IC extends SnmpProxyIndexColumn,C extends SnmpProxyColumn,IT,T,R extends SnmpProxyRow<IT,T>>
      Returns:
      the cell update listener of this table.
    • setCellUpdateListener

      public void setCellUpdateListener(SnmpCellUpdateListener cellUpdateListener)
      Description copied from interface: SnmpTable
      Sets the cell update listener associated with this table.
      Specified by:
      setCellUpdateListener in interface SnmpTable<IC extends SnmpProxyIndexColumn,C extends SnmpProxyColumn,IT,T,R extends SnmpProxyRow<IT,T>>
      Parameters:
      cellUpdateListener - the new cell update listener for this table.
    • cellUpdateValidationFailure

      protected void cellUpdateValidationFailure(int row, int column, SnmpValueChange change)
    • cellUpdated

      protected void cellUpdated(int row, int column, SnmpValueChange change)
    • isCellEditable

      public boolean isCellEditable(int rowIndex, int columnIndex)
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class AbstractTableModel
    • getCellOID

      public org.snmp4j.smi.OID getCellOID(int column, org.snmp4j.smi.OID index)
    • insertRow

      public void insertRow(R newRow)
      Description copied from interface: SnmpTable
      Insert a new row into the table. This adds a new change set to the SnmpCommitListener.
      Specified by:
      insertRow in interface SnmpTable<IC extends SnmpProxyIndexColumn,C extends SnmpProxyColumn,IT,T,R extends SnmpProxyRow<IT,T>>
      Parameters:
      newRow - the new proxy row.
    • removeRow

      public R removeRow(int rowIndex)
      Removes a row from the model without changing the associated SNMP table.
      Parameters:
      rowIndex - the zero based row index.
      Returns:
      the removed row.
    • removeRow

      public R removeRow(org.snmp4j.smi.OID rowIndex)
      Removes a row from the model without changing the associated SNMP table.
      Parameters:
      rowIndex - the SNMP row index (i.e., the OID suffix that identifies the row in the table).
      Returns:
      the removed row or null if such a row could not be found.
    • clear

      public void clear()
      Description copied from interface: SnmpTable
      Remove all rows of the proxy table without changing the target SNMP table at all.
      Specified by:
      clear in interface Collection<IC extends SnmpProxyIndexColumn>
      Specified by:
      clear in interface SnmpTable<IC extends SnmpProxyIndexColumn,C extends SnmpProxyColumn,IT,T,R extends SnmpProxyRow<IT,T>>
      Overrides:
      clear in class SnmpTableImplRO<C extends SnmpProxyColumn,IC extends SnmpProxyIndexColumn,IT,T,R extends SnmpProxyRow<IT,T>>
    • commitSuccess

      public void commitSuccess(List<SnmpValuesChangeSet> committedChanges)
      Description copied from interface: SnmpCommitListener
      Indication of a successful commit.
      Specified by:
      commitSuccess in interface SnmpCommitListener
      Parameters:
      committedChanges - the list of successfully committed change sets (each change set was committed atomically for itself).
    • commitFailure

      public void commitFailure(List<SnmpValuesChangeSet> failedChanges, SnmpErrorStatus errorStatus, int errorIndex)
      Description copied from interface: SnmpCommitListener
      Indicates a failed commit operation.
      Specified by:
      commitFailure in interface SnmpCommitListener
      Parameters:
      failedChanges - the changes that failed to commit (none of the changes within a single change set must have been committed, if the change set was small enough to be committed atomically).
      errorStatus - the SNMP error status of the first failed change set.
      errorIndex - the index in the original list of changes committed that failed (zero based).
    • reload

      public TaskId reload(SnmpService snmpService, org.snmp4j.Target target, VariableBindingMapper variableBindingMapper, SnmpProxyReloadListener reloadListener)
      Description copied from interface: SnmpProxyObject
      Reload the model content of the proxy object from the target SNMP entity asynchronously in the background.
      Specified by:
      reload in interface SnmpProxyObject
      Overrides:
      reload in class SnmpTableImplRO<C extends SnmpProxyColumn,IC extends SnmpProxyIndexColumn,IT,T,R extends SnmpProxyRow<IT,T>>
      Parameters:
      snmpService - the SNMP service to use.
      target - the SNMP target (i.e., address, timeouts, etc.) to use.
      variableBindingMapper - the variable binding mapper that maps the retrieved SNMP values to model values (based on SNMP types or specific OID based mappings).
      reloadListener - a callback listener that is informed about the reloading status.
      Returns:
      the task ID for the background task.
    • getRowNumber

      public int getRowNumber(org.snmp4j.smi.OID rowIndex)
      Gets the row number for the specified SNMP row index value.
      Specified by:
      getRowNumber in interface SnmpTableRO<IC extends SnmpProxyIndexColumn,C extends SnmpProxyColumn,IT,T,R extends SnmpProxyRow<IT,T>>
      Overrides:
      getRowNumber in class SnmpTableImplRO<C extends SnmpProxyColumn,IC extends SnmpProxyIndexColumn,IT,T,R extends SnmpProxyRow<IT,T>>
      Parameters:
      rowIndex - a SNMP row index (i.e., the OID suffix that identifies a row in the target table).
      Returns:
      the row number the is associated with the given SNMP row index or a negative number whose abstract value identifies where such a row could be inserted in the row model.
    • doChange

      public boolean doChange(SnmpValuesChangeSet changeSet)
      Description copied from interface: MutableSnmpProxy
      Perform a change by adding it to the committer queue.
      Specified by:
      doChange in interface MutableSnmpProxy
      Parameters:
      changeSet - the change to perform atomically.
      Returns:
      true if the change passed validation and thus was successfully added to the queue.
    • doChange

      public boolean doChange(SnmpValuesChangeSet changeSet, boolean addToCommitter)
      Performs a change by validating it using the SnmpProxyCommitter. Optionally the change is then also added the the proxy committer queue.
      Parameters:
      changeSet - a SnmpValuesChangeSet that contains changes to model objects that refer to cells of this proxy table.
      addToCommitter - if true, the changes will also be added to the proxy committer change queue for committing the changes to the target SNMP table.
      Returns:
      true if the change set was valid. If not, no changes to the model and the target SNMP table are performed.
    • undoChange

      public boolean undoChange(SnmpValuesChangeSet changeSet)
      Description copied from interface: MutableSnmpProxy
      Undo a change by adding the compensation change to the committer queue.
      Specified by:
      undoChange in interface MutableSnmpProxy
      Parameters:
      changeSet - the change to undo atomically.
      Returns:
      true if the undo change passed validation and thus was successfully added to the queue.