dsto.dfc.swing.list
Interface DfcListModel

All Superinterfaces:
ListModel
All Known Implementing Classes:
AbstractDfcListModel, ListModelAdapter, SortedListModelAdapter

public interface DfcListModel
extends ListModel

Extension of Swing ListModel to support row add/remove/replace.

Version:
$Revision$
Author:
Matthew Phillips

Method Summary
 void addEntry(Object entry, int row)
          Add an entry can at a given row.
 boolean canAddEntry(Object entry, int row)
          Test if an entry can be added at a given row.
 boolean canRemoveEntry(int row)
          Test if an entry can be removed.
 boolean canReplaceEntry(Object entry, int row)
          Test if an entry can be replaced.
 int indexOf(Object entry)
          Find the first occurrence of an entry and return its index.
 boolean isMutable()
          Test if this model is mutable (can be changed).
 Object removeEntry(int row)
          Remove an entry at a given row.
 Object replaceEntry(Object entry, int row)
          Replace an entry can at a given row.
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
 

Method Detail

isMutable

boolean isMutable()
Test if this model is mutable (can be changed).

Returns:
True if the list can be changed.

indexOf

int indexOf(Object entry)
Find the first occurrence of an entry and return its index.

Returns:
The index of entry or -1 if not found.

canReplaceEntry

boolean canReplaceEntry(Object entry,
                        int row)
Test if an entry can be replaced.

Parameters:
entry - The entry to add.
row - The row to overwrite.
Returns:
True if entry can be replaced.
See Also:
replaceEntry(java.lang.Object, int)

replaceEntry

Object replaceEntry(Object entry,
                    int row)
                    throws IndexOutOfBoundsException,
                           UnsupportedOperationException
Replace an entry can at a given row.

Parameters:
entry - The entry to add.
row - The row to overwrite.
Returns:
The old value at row.
Throws:
IndexOutOfBoundsException - if row is out of bounds.
UnsupportedOperationException - if entry is not allowed to be replaced.
See Also:
canReplaceEntry(java.lang.Object, int)

canAddEntry

boolean canAddEntry(Object entry,
                    int row)
Test if an entry can be added at a given row.

Parameters:
entry - The entry to add.
row - The row to add the new entry.
Returns:
True if entry can be added at row.
See Also:
addEntry(java.lang.Object, int)

addEntry

void addEntry(Object entry,
              int row)
              throws IndexOutOfBoundsException,
                     UnsupportedOperationException
Add an entry can at a given row.

Parameters:
entry - The entry to add.
row - The row to add the new entry.
Throws:
IndexOutOfBoundsException - if row is out of bounds.
UnsupportedOperationException - if entry is not allowed to be added.
See Also:
canAddEntry(java.lang.Object, int)

canRemoveEntry

boolean canRemoveEntry(int row)
Test if an entry can be removed.

Parameters:
row - The row to be removed.
Returns:
True if row can be removed.
See Also:
removeEntry(int)

removeEntry

Object removeEntry(int row)
                   throws IndexOutOfBoundsException,
                          UnsupportedOperationException
Remove an entry at a given row.

Parameters:
row - The row to remove.
Returns:
The entry that was removed.
Throws:
IndexOutOfBoundsException - if row is out of bounds.
UnsupportedOperationException - if entry is not allowed to be removed.
See Also:
canRemoveEntry(int)


Copyright © 2008 Commonwealth of Australia