public class PreferenceSaver extends Object
Component.setName(String)
) have their
properties written/read.
New components can be supported by implementing a new Saver to the list
SAVERS
.Modifier and Type | Class and Description |
---|---|
private static class |
PreferenceSaver.AbstractButtonSaver |
private static interface |
PreferenceSaver.Saver<C extends Component>
Every Component class has its own Saver class.
|
private static class |
PreferenceSaver.SplitPaneSaver
Splitpanes store the location of the divider.
|
private static class |
PreferenceSaver.TabbedPaneSaver
tabbed panes store the index of the selected pane.
|
private static class |
PreferenceSaver.WindowSaver
Windows get their bounding box stored.
|
Modifier and Type | Field and Description |
---|---|
private Preferences |
prefs
do the storing/loading from this object
|
private static PreferenceSaver.Saver<?>[] |
SAVERS
PreferenceSaver.Saver s knwon to the system. |
Constructor and Description |
---|
PreferenceSaver(Preferences prefs)
Create a new instance allowing to store and load UI properties from the
user's preferences.
|
Modifier and Type | Method and Description |
---|---|
void |
flush() |
private Component[] |
getChildren(Component component) |
private static <C extends Component> |
getSaver(C component)
get a saver for a component.
|
void |
load(Component component)
Load the properties of the argument and all its children (in depth).
|
private void |
loadChildren(Component component) |
private <C extends Component> |
loadComponent(C component) |
void |
save(Component component)
Save the properties of the argument and all its children (in depth).
|
private void |
saveChildren(Component component) |
private <C extends Component> |
saveComponent(C component) |
private static PreferenceSaver.Saver<?>[] SAVERS
PreferenceSaver.Saver
s knwon to the system.private final Preferences prefs
public PreferenceSaver(Preferences prefs)
prefs
- a non-null preference object.private static <C extends Component> PreferenceSaver.Saver<C> getSaver(C component)
public void save(Component component)
component
- component to store.BackingStoreException
- possibly thrown by Preferences
.private <C extends Component> void saveComponent(C component)
private void saveChildren(Component component)
public void load(Component component)
component
- component to load.private <C extends Component> void loadComponent(C component)
private void loadChildren(Component component)
public void flush() throws BackingStoreException
BackingStoreException