torero.gui
Class AttributeListModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--torero.gui.AttributeListModel
All Implemented Interfaces:
ListModel, Serializable

public class AttributeListModel
extends AbstractListModel

ListModel used by the JLists in the AttributeTool. Contained objects are sorted according to their compareTo() methods in ascending order, using the Collection.sort() method.

See Also:
AttributeTool, Serialized Form

Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
AttributeListModel()
           
 
Method Summary
 void fire()
          Causes the displaying JList to refresh its content.
 Object getElementAt(int at)
          Get the Element on position at.
 int getIndexOf(Object o)
          Get the index of the given attribute.
 int getSize()
          Returns the number of attributes in this model.
 void reload()
          Reloads the listmodel's content from the actual GrammarModel.
 
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

AttributeListModel

public AttributeListModel()
Method Detail

reload

public void reload()
Reloads the listmodel's content from the actual GrammarModel.

getSize

public int getSize()
Returns the number of attributes in this model.
Overrides:
getSize in class AbstractListModel
Returns:
number of attributes in this model.

getElementAt

public Object getElementAt(int at)
Get the Element on position at.
Overrides:
getElementAt in class AbstractListModel
Parameters:
at - index of the attribute
Returns:
attribute at the given index at.

getIndexOf

public int getIndexOf(Object o)
Get the index of the given attribute.
Parameters:
at - attribute
Returns:
the index of the giben attribute.

fire

public void fire()
Causes the displaying JList to refresh its content. Due to a Swing bug there are some situations where the JList doesn't recognize that the underlying model has changed. Therefore this method should be called after reload().