Package adams.gui.flow
Class FlowViewStateManager
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.gui.flow.FlowViewStateManager
-
- All Implemented Interfaces:
LoggingLevelHandler
,LoggingSupporter
,SizeOfHandler
,Serializable
public class FlowViewStateManager extends CustomLoggingLevelObject
Manages the view state of flows.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILENAME
the props file.protected LRUCache<String,com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>>>
m_Cache
the cache.protected int
m_MaxStates
the maximum number of view states to keep.protected static Properties
m_Properties
the properties.protected static FlowViewStateManager
m_Singleton
the singleton.protected PlaceholderFile
m_StateFile
the output file.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FlowViewStateManager()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(File file, com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>> state)
Adds a view state to the cache.void
add(String filename, com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>> state)
Adds a view state to the cache.com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>>
get(File file)
Returns the state for the flow.com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>>
get(String filename)
Returns the state for the flow.static Properties
getProperties()
Returns the properties that define the manager.static FlowViewStateManager
getSingleton()
Returns the singleton of the manager.boolean
has(File file)
Checks whether a state is available for the flow.boolean
has(String filename)
Checks whether a state is available for the flow.protected void
load()
Loads the cache from disk.protected void
save()
Saves the cache to disk.-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the props file.- See Also:
- Constant Field Values
-
m_Singleton
protected static FlowViewStateManager m_Singleton
the singleton.
-
m_Properties
protected static Properties m_Properties
the properties.
-
m_StateFile
protected PlaceholderFile m_StateFile
the output file.
-
m_MaxStates
protected int m_MaxStates
the maximum number of view states to keep.
-
-
Method Detail
-
add
public void add(File file, com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>> state)
Adds a view state to the cache.- Parameters:
file
- the file of the flowstate
- the associated state
-
add
public void add(String filename, com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>> state)
Adds a view state to the cache.- Parameters:
filename
- the file name of the flowstate
- the associated state
-
has
public boolean has(File file)
Checks whether a state is available for the flow.- Parameters:
file
- the file of the flow- Returns:
- true if state available
-
has
public boolean has(String filename)
Checks whether a state is available for the flow.- Parameters:
filename
- the file name of the flow- Returns:
- true if state available
-
get
public com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>> get(File file)
Returns the state for the flow.- Parameters:
file
- the file of the flow- Returns:
- the state, null if none available
-
get
public com.github.fracpete.javautils.struct.Struct2<List<String>,List<String>> get(String filename)
Returns the state for the flow.- Parameters:
filename
- the file name of the flow- Returns:
- the state, null if none available
-
load
protected void load()
Loads the cache from disk.
-
save
protected void save()
Saves the cache to disk.
-
getSingleton
public static FlowViewStateManager getSingleton()
Returns the singleton of the manager.- Returns:
- the singleton
-
getProperties
public static Properties getProperties()
Returns the properties that define the manager.- Returns:
- the properties
-
-