public abstract class ALcyFormatAddOn extends ALcyPreferencesAddOn
Extension of ALcyPreferencesAddOn
that is also equipped with an
ALcyFormat
. The format is created by createBaseFormat()
,
than wrapped with createFormatWrapper
and eventually plugged into ILcyLucyEnv
using a
TLcyFormatTool
created in createFormatTool
.
Modifier | Constructor and Description |
---|---|
protected |
ALcyFormatAddOn(String aLongPrefix,
String aShortPrefix)
Creates a new
ALcyFormatAddOn . |
Modifier and Type | Method and Description |
---|---|
protected abstract ALcyFormat |
createBaseFormat()
Returns a new data format for this add-on.
|
protected TLcyFormatTool |
createFormatTool(ALcyFormat aFormat)
Creates a new format tool for the given format.
|
protected abstract ALcyFormat |
createFormatWrapper(ALcyFormat aBaseFormat)
Returns a new data format wrapper for this add-on.
|
ALcyFormat |
getFormat()
Returns the
ALcyFormat class that encapsulates this add-on's data format. |
void |
plugInto(ILcyLucyEnv aLucyEnv)
Creates and plugs in the add-on's format.
|
void |
unplugFrom(ILcyLucyEnv aLucyEnv)
Unplugs the add-on's format.
|
createPreferencesTool, getLongPrefix, getLucyEnv, getPreferences, getPreferencesTool, getShortPrefix
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
protected ALcyFormatAddOn(String aLongPrefix, String aShortPrefix)
ALcyFormatAddOn
.
See the constructor
of the super class for more information.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 ALcyFormat getFormat()
Returns the ALcyFormat
class that encapsulates this add-on's data format. See the
createBaseFormat()
method if you want to override or extend the data format. Note that
the format instance returned here is different from the one created by createBaseFormat()
as it is wrapped by createFormatWrapper(com.luciad.lucy.format.ALcyFormat)
.
createBaseFormat()
public void plugInto(ILcyLucyEnv aLucyEnv)
Creates and plugs in the add-on's format.
plugInto
in class ALcyPreferencesAddOn
aLucyEnv
- the Lucy environment to plug intoALcyAddOn.unplugFrom(com.luciad.lucy.ILcyLucyEnv)
public void unplugFrom(ILcyLucyEnv aLucyEnv)
unplugFrom
in class ALcyPreferencesAddOn
aLucyEnv
- the Lucy environmentALcyAddOn.plugInto(com.luciad.lucy.ILcyLucyEnv)
protected TLcyFormatTool createFormatTool(ALcyFormat aFormat)
Creates a new format tool for the given format. It is used to plug all parts of the format (
e.g. ILcdGXYLayerFactory
, ILcdModelDecoder
, etc.) into
ILcyLucyEnv
.
aFormat
- the format for which to create a toolTLcyFormatTool
protected abstract ALcyFormat createBaseFormat()
Returns a new data format for this add-on. Override this method to extend the default format with new functionality.
For example, to alter the icon of the layers of this format, you can decorate the layer factory created in the format:
@Override
protected ALcyFormat createBaseFormat() {
return new ALcyFormatWrapper(super.createBaseFormat()){
@Override
protected ILcdGXYLayerFactory createGXYLayerFactory(){
final ILcdGXYLayerFactory delegate = super.createGXYLayerFactory();
return new ILcdGXYLayerFactory(){
@Override
public ILcdGXYLayer createGXYLayer(ILcdModel aModel){
ILcdGXYLayer layer = delegate.createGXYLayer(aModel);
if (layer != null){
ILcdIcon icon = ...;
layer.setIcon(icon);
}
return layer;
}
}
}
}
}
protected abstract ALcyFormat createFormatWrapper(ALcyFormat aBaseFormat)
Returns a new data format wrapper for this add-on. A format wrapper extends the base format with aspects such as asynchronous painting, mutable file behavior, safe guarding, etc.
Overriding this method of an existing add-on should be done with extreme care as add-ons typically rely on the wrappers that should be present (e.g. a safe guard).
aBaseFormat
- the base format to wrapALcyFormatWrapper