Class HistoryModel

java.lang.Object
javax.swing.AbstractListModel
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:
  • Constructor Details

    • HistoryModel

      public HistoryModel(String name)
      Creates a new history list. Calling this is normally not necessary.
  • Method Details

    • 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:
      insertElementAt in interface MutableListModel
      Overrides:
      insertElementAt in class DefaultListModel
    • 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:
      removeElement in interface MutableListModel
      Overrides:
      removeElement in class DefaultListModel
    • clear

      public void clear()
      Deprecated.
      Call removeAllElements() instead.
      Overrides:
      clear in class DefaultListModel
    • removeAllElements

      public void removeAllElements()
      Overrides:
      removeAllElements in class DefaultListModel
    • 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)