FIM.Util.GUI
Class NamedListModel
java.lang.Object
|
+--javax.swing.AbstractListModel
|
+--FIM.Util.GUI.NamedListModel
- Direct Known Subclasses:
- CertificateModel, KeyPairModel
- public abstract class NamedListModel
- extends AbstractListModel
A model for a list consisting of objects which are represented through names instead of themselves.
Abstract class; subclasses must return the name of the object in the list, so will be mostly
lists of one type of element.
- Version:
- 1.0, 1.7.2000
- Author:
- Michael Sonntag
- See Also:
- Serialized Form
Method Summary |
void |
addData(Object id)
Adds an element after the last entry. |
Object |
getDataAt(int index)
Retrieve the element at a specified index. |
Object |
getElementAt(int index)
Retrieve the element at a certain index.
|
abstract String |
getName(int index)
Returns the name of the element at a certain index. |
int |
getSize()
Retrieve the number of elements in the list.
|
void |
insertData(Object id)
Inserts an element before the first entry. |
void |
removeElement(int index)
Removes an element at a certain index from the list.
|
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
NamedListModel
public NamedListModel()
insertData
public void insertData(Object id)
- Inserts an element before the first entry.
- Parameters:
id
- the object to insert
addData
public void addData(Object id)
- Adds an element after the last entry.
- Parameters:
id
- the object to add
getDataAt
public Object getDataAt(int index)
- Retrieve the element at a specified index.
- Parameters:
index
- the index of the element to return- Returns:
- the element at the provided index or
null
if the index is out of range
getName
public abstract String getName(int index)
- Returns the name of the element at a certain index. Subclasses must provide an implementation.
- Parameters:
index
- the index of the element whose name should be retrieved- Returns:
- the name of the element at the provided index
getSize
public int getSize()
- Retrieve the number of elements in the list.
Equals the number of entries in this model.
- Returns:
- number of elements in the list
- Overrides:
- getSize in class AbstractListModel
getElementAt
public Object getElementAt(int index)
- Retrieve the element at a certain index.
Returns here the name of the element at this index only, not the element itself.
- Parameters:
index
- the index of the element to return- Returns:
- the elements at the index or
null
if the index is out of range - Overrides:
- getElementAt in class AbstractListModel
removeElement
public void removeElement(int index)
- Removes an element at a certain index from the list.
Deletes also the data in this model.
- Parameters:
index
- the index of the element to remove
Submit a bug
Copyright 2000 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.