Package adams.gui.goe
Class PersistentObjectHistory
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.AbstractHistory<T>
-
- adams.core.AbstractPersistentHistory<Object>
-
- adams.gui.goe.PersistentObjectHistory
-
- All Implemented Interfaces:
LoggingSupporter,SizeOfHandler,Serializable
public class PersistentObjectHistory extends AbstractPersistentHistory<Object>
A helper class for maintaining a history of objects selected in the GOE.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>m_CommandLinesthe history of commandlines - used for determining whether object has already been added.protected Classm_Superclassthe superclass.static intMAX_LINE_CHARSthe maximum number of characters per line for a single setup.-
Fields inherited from class adams.core.AbstractPersistentHistory
m_HistoryFile
-
Fields inherited from class adams.core.AbstractHistory
m_History, MAX_HISTORY_COUNT, MAX_HISTORY_LENGTH
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description PersistentObjectHistory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Object obj)Adds the object to the history.voidclear()Clears the history.protected Objectcopy(Object obj)Creates a copy of the object.voidcustomizePopupMenu(JPopupMenu menu, Object current, HistorySelectionListener listener)Adds a menu item with the history to the popup menu.protected StringgenerateMenuItemCaption(Object obj)Generates an HTML caption for the an entry in the history menu.protected voidinitialize()Initializes members.protected booleanload()Loads the history from disk.protected booleansave()Saves the history to disk.voidsetSuperclass(Class value)Sets the superclass to use.-
Methods inherited from class adams.core.AbstractPersistentHistory
getHistoryFile, setHistoryFile
-
Methods inherited from class adams.core.AbstractHistory
getHistory, size
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
MAX_LINE_CHARS
public static final int MAX_LINE_CHARS
the maximum number of characters per line for a single setup.- See Also:
- Constant Field Values
-
m_Superclass
protected Class m_Superclass
the superclass.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes members.- Overrides:
initializein classAbstractPersistentHistory<Object>
-
clear
public void clear()
Clears the history.- Overrides:
clearin classAbstractPersistentHistory<Object>
-
setSuperclass
public void setSuperclass(Class value)
Sets the superclass to use.- Parameters:
value- the class
-
copy
protected Object copy(Object obj)
Creates a copy of the object.- Specified by:
copyin classAbstractHistory<Object>- Parameters:
obj- the object to copy
-
add
public void add(Object obj)
Adds the object to the history.- Overrides:
addin classAbstractPersistentHistory<Object>- Parameters:
obj- the object to add
-
generateMenuItemCaption
protected String generateMenuItemCaption(Object obj)
Generates an HTML caption for the an entry in the history menu.- Parameters:
obj- the object to create the caption for- Returns:
- the generated HTML captiopn
-
customizePopupMenu
public void customizePopupMenu(JPopupMenu menu, Object current, HistorySelectionListener listener)
Adds a menu item with the history to the popup menu.- Parameters:
menu- the menu to add the history tocurrent- the current objectlistener- the listener to attach to the menu items' ActionListener
-
save
protected boolean save()
Saves the history to disk.- Specified by:
savein classAbstractPersistentHistory<Object>- Returns:
- true if successfully saved
-
load
protected boolean load()
Loads the history from disk.- Specified by:
loadin classAbstractPersistentHistory<Object>- Returns:
- true if successfully loaded
-
-