|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.qfs.lib.config.ConfigWrapper
A ConfigWrapper implements the Configurable interface by wrapping itself around a client Object, getting and setting its state when needed.
Standard ConfigWrappers can be constructed dynamically by passing
the object to wrap to the factory method makeWrapper
.
This will return a ConfigWrapper for the most derived class or baseclass
of the object, for which a wrapper is available, e.g.:
JFrame frame = new JFrame (); ConfigWrapper wrapper = ConfigWrapper.makeWrapper(frame, "name");will create a JFrameConfigWrapper.
You can make ConfigWrappers available in a package different from
de.qfs.lib.config
by calling addPackage
.
Constructor Summary | |
protected |
ConfigWrapper()
Create a new ConfigWrapper. |
Method Summary | |
static void |
addPackage(java.lang.String packagename)
Add a package to be searched for ConfigWrappers. |
java.lang.String |
getConfigurableName()
Get the receiver's configuration name. |
java.util.Properties |
getConfigurableState()
Get the Configurable's state. |
static ConfigWrapper |
makeWrapper(java.lang.Object client)
A factory method that dynamically creates a ConfigWrapper for the most derived class or baseclass of the client, for which a wrapper is available. |
static ConfigWrapper |
makeWrapper(java.lang.Object client,
java.lang.String name)
A factory method that dynamically creates a ConfigWrapper for the most derived class or baseclass of the client, for which a wrapper is available. |
void |
registrationChanged(Configuration config,
java.lang.String name,
boolean registered,
boolean valuesKept)
This callback is used to notify the Configurable whenever it is registered with or unregistered from the Configuration, so it can decide whether to notify the Configuration when its state changes. |
protected void |
setClient(java.lang.Object client)
Set the client object for the ConfigWrapper. |
void |
setConfigurableName(java.lang.String name)
Set the receiver's configuration name. |
void |
setConfigurableState(java.util.Properties state)
Set the Configurable's state. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ConfigWrapper()
Method Detail |
public static ConfigWrapper makeWrapper(java.lang.Object client, java.lang.String name)
client
- The object to wrap.name
- The name to give the new ConfigWrapper.public static ConfigWrapper makeWrapper(java.lang.Object client)
client
- The object to wrap.public static void addPackage(java.lang.String packagename)
packagename
- The name of the package to add.protected void setClient(java.lang.Object client)
client
- The client object to set. Ignored.public void setConfigurableName(java.lang.String name)
setConfigurableName
in interface Configurable
name
- The name to set.public java.lang.String getConfigurableName()
getConfigurableName
in interface Configurable
public java.util.Properties getConfigurableState()
getConfigurableState
in interface Configurable
public void setConfigurableState(java.util.Properties state)
setConfigurableState
in interface Configurable
state
- The state to set. Ignored.public void registrationChanged(Configuration config, java.lang.String name, boolean registered, boolean valuesKept)
registrationChanged
in interface Configurable
config
- The affected Configuration.name
- The registration name of the Configurable which may
be different from the Configurable's name.registered
- True if the Configurable was just registered,
false if it was unregistered.valuesKept
- Whether the Configurable's values were kept, if
it was just unregistered.
|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |