Agent System POND 1.2 (28.2.2002)

FIM.Util.GUI
Class NamedListModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--FIM.Util.GUI.NamedListModel
All Implemented Interfaces:
ListModel, Serializable
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

Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
NamedListModel()
           
 
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 javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedListModel

public NamedListModel()
Method Detail

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.
Overrides:
getSize in class AbstractListModel
Returns:
number of elements in the list

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.
Overrides:
getElementAt in class AbstractListModel
Parameters:
index - the index of the element to return
Returns:
the elements at the index or null if the index is out of range

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

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.