public class SwingSession extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SwingSession.Action |
static class |
SwingSession.RestoreStateAction |
static class |
SwingSession.SaveStateAction |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
autoSave |
protected File |
file |
protected Set<Component> |
registeredComponent |
protected Map<Class,State> |
stateManager
State object registered to get and set State.
|
protected Map<String,State> |
states
state of all component added with add method.
|
| Constructor and Description |
|---|
SwingSession(File file,
boolean autoSave) |
SwingSession(File file,
boolean autoSave,
Map<Class,State> additionalStates) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Component c) |
void |
add(Component c,
boolean replace) |
void |
addToStateManager(Class component,
State state) |
protected void |
finalize() |
protected String |
getComponentName(Component c) |
File |
getFile() |
State |
getStateManager(Class clazz) |
State |
getStates(String path) |
void |
loadSafeStates()
Loads safely the states from the
file. |
Map<String,State> |
loadStates(File file)
Loads the states from the file
|
static SwingSession |
newSession(File file,
boolean autoSave)
Deprecated.
since 2.10, the default behaviour is now to safely load the incoming file
|
static SwingSession |
newSession(File file,
boolean autoSave,
Map<Class,State> additionalStates)
Deprecated.
since 2.10, the default behaviour is now to safely load the incoming file
|
void |
remove(Component c)
Remove component from component to save
|
void |
save() |
void |
setFile(File file) |
void |
setStates(String path,
State state) |
void |
updateState() |
protected void |
walkThrowComponent(String path,
Collection<Component> roots,
SwingSession.Action action) |
protected File file
protected final boolean autoSave
protected final Map<Class,State> stateManager
public SwingSession(File file, boolean autoSave)
@Deprecated public static SwingSession newSession(File file, boolean autoSave)
@Deprecated public static SwingSession newSession(File file, boolean autoSave, Map<Class,State> additionalStates)
public File getFile()
public void setFile(File file)
public void loadSafeStates()
file.
If could not read the internal file, then will try to delete it.protected void finalize()
throws Throwable
public void save()
throws IOException
IOExceptionpublic Map<String,State> loadStates(File file) throws IOException
IOExceptionpublic void updateState()
public void add(Component c)
public void add(Component c, boolean replace)
public void remove(Component c)
c - protected void walkThrowComponent(String path, Collection<Component> roots, SwingSession.Action action)
Copyright © 2008–2017 Ultreia.io. All rights reserved.