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_CommandLines
the history of commandlines - used for determining whether object has already been added.protected Class
m_Superclass
the superclass.static int
MAX_LINE_CHARS
the 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 void
add(Object obj)
Adds the object to the history.void
clear()
Clears the history.protected Object
copy(Object obj)
Creates a copy of the object.void
customizePopupMenu(JPopupMenu menu, Object current, HistorySelectionListener listener)
Adds a menu item with the history to the popup menu.protected String
generateMenuItemCaption(Object obj)
Generates an HTML caption for the an entry in the history menu.protected void
initialize()
Initializes members.protected boolean
load()
Loads the history from disk.protected boolean
save()
Saves the history to disk.void
setSuperclass(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:
initialize
in classAbstractPersistentHistory<Object>
-
clear
public void clear()
Clears the history.- Overrides:
clear
in 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:
copy
in classAbstractHistory<Object>
- Parameters:
obj
- the object to copy
-
add
public void add(Object obj)
Adds the object to the history.- Overrides:
add
in 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:
save
in classAbstractPersistentHistory<Object>
- Returns:
- true if successfully saved
-
load
protected boolean load()
Loads the history from disk.- Specified by:
load
in classAbstractPersistentHistory<Object>
- Returns:
- true if successfully loaded
-
-