Class HistoryModel
- java.lang.Object
-
- javax.swing.AbstractListModel<E>
-
- javax.swing.DefaultListModel
-
- org.bidib.wizard.mvc.common.view.text.HistoryModel
-
- All Implemented Interfaces:
Serializable,ListModel,MutableListModel
public class HistoryModel extends 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.- Version:
- $Id: HistoryModel.java 12504 2008-04-22 23:12:43Z ezust $
- Author:
- Slava Pestov
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description HistoryModel(String name)Creates a new history list.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddItem(String text)Adds an item to the end of this history list, trimming the list to the maximum number of items if necessary.voidclear()Deprecated.CallremoveAllElements()instead.StringgetItem(int index)Returns an item from the history list.static HistoryModelgetModel(String name)Returns a named model.StringgetName()Returns the name of this history list.voidinsertElementAt(Object obj, int index)static voidloadHistory()voidremoveAllElements()booleanremoveElement(Object obj)static voidsaveHistory()static voidsetMax(int max)static voidsetSaver(HistoryModelSaver saver)-
Methods inherited from class javax.swing.DefaultListModel
add, addAll, addAll, 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(String name)
Creates a new history list. Calling this is normally not necessary.
-
-
Method Detail
-
addItem
public void addItem(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(Object obj, int index)
- Specified by:
insertElementAtin interfaceMutableListModel- Overrides:
insertElementAtin classDefaultListModel
-
getItem
public String getItem(int index)
Returns an item from the history list.- Parameters:
index- The index
-
removeElement
public boolean removeElement(Object obj)
- Specified by:
removeElementin interfaceMutableListModel- Overrides:
removeElementin classDefaultListModel
-
clear
public void clear()
Deprecated.CallremoveAllElements()instead.- Overrides:
clearin classDefaultListModel
-
removeAllElements
public void removeAllElements()
- Overrides:
removeAllElementsin classDefaultListModel
-
getName
public String getName()
Returns the name of this history list. This can be passed to the HistoryTextField constructor.
-
getModel
public static HistoryModel getModel(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()
-
setMax
public static void setMax(int max)
-
setSaver
public static void setSaver(HistoryModelSaver saver)
-
-