org.gjt.sp.jedit.gui
Class HistoryModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by javax.swing.DefaultListModel
          extended by org.gjt.sp.jedit.gui.HistoryModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.ListModel, MutableListModel

public class HistoryModel
extends javax.swing.DefaultListModel
implements MutableListModel

A history list. One history list can be used by several history text fields. Note that the list model implementation is incomplete; no events are fired when the history model changes.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
HistoryModel(java.lang.String name)
          Creates a new history list.
 
Method Summary
 void addItem(java.lang.String text)
          Adds an item to the end of this history list, trimming the list to the maximum number of items if necessary.
 void clear()
          Deprecated. Call removeAllElements() instead.
 java.lang.String getItem(int index)
          Returns an item from the history list.
static HistoryModel getModel(java.lang.String name)
          Returns a named model.
 java.lang.String getName()
          Returns the name of this history list.
 void insertElementAt(java.lang.Object obj, int index)
           
static void loadHistory()
           
static void propertiesChanged()
           
 void removeAllElements()
           
 boolean removeElement(java.lang.Object obj)
           
static void saveHistory()
           
 
Methods inherited from class javax.swing.DefaultListModel
add, addElement, capacity, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, get, getElementAt, getSize, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeElementAt, removeRange, set, setElementAt, setSize, size, toArray, toString, trimToSize
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
 

Constructor Detail

HistoryModel

public HistoryModel(java.lang.String name)
Creates a new history list. Calling this is normally not necessary.

Method Detail

addItem

public void addItem(java.lang.String text)
Adds an item to the end of this history list, trimming the list to the maximum number of items if necessary.

Parameters:
text - The item

insertElementAt

public void insertElementAt(java.lang.Object obj,
                            int index)
Specified by:
insertElementAt in interface MutableListModel
Overrides:
insertElementAt in class javax.swing.DefaultListModel

getItem

public java.lang.String getItem(int index)
Returns an item from the history list.

Parameters:
index - The index

removeElement

public boolean removeElement(java.lang.Object obj)
Specified by:
removeElement in interface MutableListModel
Overrides:
removeElement in class javax.swing.DefaultListModel

clear

public void clear()
Deprecated. Call removeAllElements() instead.

Overrides:
clear in class javax.swing.DefaultListModel

removeAllElements

public void removeAllElements()
Overrides:
removeAllElements in class javax.swing.DefaultListModel

getName

public java.lang.String getName()
Returns the name of this history list. This can be passed to the HistoryTextField constructor.


getModel

public static HistoryModel getModel(java.lang.String name)
Returns a named model. If the specified model does not already exist, it will be created.

Parameters:
name - The model name

loadHistory

public static void loadHistory()

saveHistory

public static void saveHistory()

propertiesChanged

public static void propertiesChanged()