Class TLcyLspFormatTool
- All Implemented Interfaces:
ILcdPropertyChangeSource
Support class to plug the format-related objects created by an ALcyLspFormat
(e.g. ILspLayerFactory) into the ILcyLucyEnv. Call the plugInto(com.luciad.lucy.ILcyLucyEnv) method to plug all the format-related objects of the
given ALcyLspFormat into the Lucy back-end.
Using this TLcyLspFormatTool to plug in an ALcyLspFormat will register
most objects as service to the Lucy back-end. As a consequence, everything that is plugged in
using this TLcyLspFormatTool should be unplugged using a
TLcyLspFormatTool as well.
A typical usage might look like (for example in the
ALcyAddOn#plugInto method):
ALcyLspFormat format = ... ;
TLcyLspFormatTool formatTool = new TLcyLspFormatTool( format );
//plug in the whole format at once
formatTool.plugInto( aLucyEnv );
When the format components are no longer needed, the same format tool can be used to unregister
those instances (for example in the ALcyAddOn#unplugFrom method):
//same TLcyLspFormatTool and Lucy back-end as used in the plugInto method
formatTool.unplugFrom( aLucyEnv );
Note: when you want to create an add-on which plugs in an ALcyLspFormat you can
as well extend from ALcyLspFormatAddOn directly,
which does what is shown above.
- Since:
- 2012.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTLcyLspFormatTool(ALcyLspFormat aFormat) Creates aTLcyLspFormatToolfor the givenALcyLspFormat.TLcyLspFormatTool(ALcyLspFormat aFormat, int aPriorityForAllObjects) Creates aTLcyLspFormatToolfor the givenALcyLspFormatwhich will plug in all objects into the Lucy back-end using the specified priority. -
Method Summary
Modifier and TypeMethodDescriptionstatic ALcyLspFormatfindBaseFormat(ALcyLspFormat aFormat) Utility method to, in a chain of wrapped formats, find the deepest format.static <T extends ALcyLspFormat>
TfindFormat(ALcyLspFormat aFormat, Class<T> aFormatClass) Utility method to find anALcyLspFormat(orALcyLspFormatWrapper) of the given class.Returns theALcyLspFormatfor which this tool was created.voidplugInto(ILcyLucyEnv aLucyEnv) Plugs this tool.voidunplugFrom(ILcyLucyEnv aLucyEnv) Unplugs this tool.Methods inherited from class com.luciad.lucy.util.ALcyTool
addPropertyChangeListener, addPropertyChangeListener, assertPlugged, firePropertyChange, getLongPrefix, getLongPrefixWithClassName, getLucyEnv, getShortPrefix, removePropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
TLcyLspFormatTool
Creates a
TLcyLspFormatToolfor the givenALcyLspFormat.- Parameters:
aFormat- TheALcyLspFormatwhose contents needs to be plugged into the Lucy back-end. Must not benull.
-
TLcyLspFormatTool
Creates a
TLcyLspFormatToolfor the givenALcyLspFormatwhich will plug in all objects into the Lucy back-end using the specified priority.- Parameters:
aFormat- TheALcyLspFormatwhose contents needs to be plugged into the Lucy back-end. Must not benull.aPriorityForAllObjects- The priority which will be used to plug in all the objects into the Lucy back-end. Lower values mean higher priorities. Common values areILcyLucyEnv.PRIORITY_DEFAULTandILcyLucyEnv.PRIORITY_FALLBACK.- Since:
- 2016.0
-
-
Method Details
-
getFormat
Returns the
ALcyLspFormatfor which this tool was created.- Returns:
- the
ALcyLspFormatfor which this tool was created. Nevernull
-
plugInto
Plugs this tool. This method is usually called from
ALcyAddOn#plugInto.Lets the format create all the format-related objects and plugs them into the given Lucy back-end.
-
unplugFrom
Description copied from class:ALcyToolUnplugs this tool. This method is usually called from
ALcyAddOn#unplugFrom.- Overrides:
unplugFromin classALcyTool- Parameters:
aLucyEnv- The environment to unplug from, must be identical to the environment given toplugInto.
-
findFormat
Utility method to find an
ALcyLspFormat(orALcyLspFormatWrapper) of the given class. This can be useful to, in a chain of wrapped formats, retrieve a format of the given class.To do so, it assumes every format wrapper extends from
ALcyLspFormatWrapper.Consider for example this chain of formats:
A call toALcyLspFormat format = new TLcyLspSafeGuardFormatWrapper( new MyFormat() )
will return thefindFormat(format, TLcyLspSafeGuardFormatWrapper.class)TLcyLspSafeGuardFormatWrapperinstance. A call to
will returnfindFormat(format, SomeOtherFormatWrapper.class)null.- Parameters:
aFormat- The format to start looking from.aFormatClass- The class to find.- Returns:
nullif no such format was found, or an instance of (a subclass of) the givenaFormatClass.
-
findBaseFormat
Utility method to, in a chain of wrapped formats, find the deepest format.
To do so, it assumes every format wrapper extends from
ALcyLspFormatWrapper.Consider for example this chain of formats:
A call toALcyLspFormat format = new TLcyLspSafeGuardFormatWrapper( new MyFormat() )
will return thefindBaseFormat(format)MyFormatinstance.- Parameters:
aFormat- The format to find the base format of.- Returns:
- The base format of the given
aFormat.
-