public abstract class ALcyPreferencesAddOn extends ALcyAddOn
ALcyAddOn
that is equipped with a TLcyPreferencesTool
to read
its preferences from the set configuration file.
The configured preferences are available through getPreferences()
.Modifier | Constructor and Description |
---|---|
protected |
ALcyPreferencesAddOn(String aLongPrefix,
String aShortPrefix)
Creates a new
ALcyPreferencesAddOn . |
Modifier and Type | Method and Description |
---|---|
protected TLcyPreferencesTool |
createPreferencesTool()
Creates the
TLcyPreferencesTool to be used by this add-on. |
String |
getLongPrefix()
Returns the long prefix of this add-on.
|
ILcyLucyEnv |
getLucyEnv()
Returns the Lucy environment into which this add-on was plugged.
|
ALcyProperties |
getPreferences()
Convenience method that returns the composite workspace preferences of this add-on's
preferences tool.
|
TLcyPreferencesTool |
getPreferencesTool()
Returns the preferences tool used by the add-on.
|
String |
getShortPrefix()
Returns the short prefix of this add-on.
|
void |
plugInto(ILcyLucyEnv aLucyEnv)
Creates and plugs in the add-on's preferences tool.
|
void |
unplugFrom(ILcyLucyEnv aLucyEnv)
Unplugs the add-on's preferences tool.
|
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
protected ALcyPreferencesAddOn(String aLongPrefix, String aShortPrefix)
ALcyPreferencesAddOn
.
Typically this constructor is called as follows:
public class MyAddOn extends ALcyPreferencesAddOn{
public MyAddOn(){
super(ALcyTool.getLongPrefix(MyAddOn.class),
ALcyTool.getShortPrefix(MyAddOn.class)
}
//...
}
Note that the code above won't work when multiple add-ons are located in the same package as
the long prefix won't be unique.
In that case, you could use the ALcyTool.getLongPrefixWithClassName(Class)
instead:
public class MyAddOn extends ALcyPreferencesAddOn{
public MyAddOn(){
super(ALcyTool.getLongPrefixWithClassName(MyAddOn.class),
ALcyTool.getShortPrefix(MyAddOn.class)
}
//...
}
aLongPrefix
- The long prefix. This prefix must be globally unique. It is stored in
workspace files, so if backward compatibility is a concern (e.g. read an
old workspace file), this prefix must never change.aShortPrefix
- The short prefix, see also TLcyPreferencesTool
. It might be
stored in workspace files, so if backward compatibility is a concern (e.g.
read an old workspace file), this prefix must never change.public String getLongPrefix()
public String getShortPrefix()
public ILcyLucyEnv getLucyEnv()
plugInto(com.luciad.lucy.ILcyLucyEnv)
public TLcyPreferencesTool getPreferencesTool()
public ALcyProperties getPreferences()
Convenience method that returns the composite workspace preferences of this add-on's preferences tool. These preferences include the configured preferences of the add-on.
TLcyPreferencesTool.getCompositeWorkspacePreferences()
public void plugInto(ILcyLucyEnv aLucyEnv)
plugInto
in class ALcyAddOn
aLucyEnv
- the Lucy environment to plug intoALcyAddOn.unplugFrom(com.luciad.lucy.ILcyLucyEnv)
public void unplugFrom(ILcyLucyEnv aLucyEnv)
unplugFrom
in class ALcyAddOn
aLucyEnv
- the Lucy environmentALcyAddOn.plugInto(com.luciad.lucy.ILcyLucyEnv)
protected TLcyPreferencesTool createPreferencesTool()
Creates the TLcyPreferencesTool
to be used by this add-on. Overwriting this method
for example allows to register additional ILcyPropertyConverter
s for (complex)
custom properties, to make sure they are correctly decoded from the add-on's configuration file
and/or saved to the workspace. Note that this isn't required for simple properties such as
String
, int
, double
, etc.
The default implementation creates a new tool based on the ALcyAddOn.getConfigSourceName()
and
the add-on's prefixes.
TLcyPreferencesTool
.