Class TLcyCompositeFormatBarFactory
A composite implementation of ALcyFormatBarFactory
according to the
composite design pattern.
When creating a new TLcyCompositeFormatBarFactory
using the default
constructor (see TLcyCompositeFormatBarFactory()
), the created instance will
only work on/with the ALcyFormatBarFactorys registered
on this composite instance (see addFormatBarFactory(ALcyFormatBarFactory)
and removeFormatBarFactory(ALcyFormatBarFactory)
).
When creating a new TLcyCompositeFormatBarFactory
using the constructor
specifying an ILcyLucyEnv
instance (see TLcyCompositeFormatBarFactory(com.luciad.lucy.ILcyLucyEnv)
, the created instance will
work on the Lucy back-end services. It will use
all registered ALcyFormatBarFactory instances of the
Lucy back-end, adding and/or removing an ALcyFormatBarFactory
will
add/remove the ALcyFormatBarFactory
as service from Lucy, ... .
Creating an ALcyFormatBar
using the back-end based implementation
can be done by creating a new instance of this class:
//Create a new instance whenever you need it.
TLcyCompositeFormatBarFactory factory = new TLcyCompositeFormatBarFactory( aLucyEnv );
if( factory.canCreateFormatBar( aView, aLayer ){
ALcyFormatBar bar = factory.createFormatBar( aView, aLayer );
}
//There is no need to keep a reference to the composite instance, you can create a new one
//the next time you would need it
factory = null;
- Since:
- 10.0
-
Constructor Summary
ConstructorDescriptionDefault constructor.TLcyCompositeFormatBarFactory
(ILcyLucyEnv aLucyEnv) Construct aTLcyCompositeFormatBarFactory
working on the Lucy back-end -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFormatBarFactory
(ALcyFormatBarFactory aFormatBarFactory) Adds the givenALcyFormatBarFactory
to the list of registered format bar factories.void
addFormatBarFactory
(ALcyFormatBarFactory aFormatBarFactory, int aPriority) Adds the givenALcyFormatBarFactory
to the list of registered format bar factories.boolean
canCreateFormatBar
(ILcdView aView, ILcdLayer aLayer) Returnstrue
if aALcyFormatBar
can be created for the given parameters,false
otherwise.createFormatBar
(ILcdView aView, ILcdLayer aLayer) Creates anALcyFormatBar
for the given parameters.getFormatBarFactory
(int aIndex) Returns theALcyFormatBarFactory
at indexaIndex
.int
Returns the number of registeredALcyFormatBarFactory
instances.void
removeFormatBarFactory
(ALcyFormatBarFactory aFormatBarFactory) Removes the givenALcyFormatBarFactory
from the list of registered format bar factories.
-
Constructor Details
-
TLcyCompositeFormatBarFactory
public TLcyCompositeFormatBarFactory()Default constructor.
The created instance will only work on the
ALcyFormatBarFactory
instances registered to it. If you want to use all registeredALcyFormatBarFactory
instances of the Lucy back-end, useTLcyCompositeFormatBarFactory(com.luciad.lucy.ILcyLucyEnv)
instead.- See Also:
-
TLcyCompositeFormatBarFactory
Construct a
TLcyCompositeFormatBarFactory
working on the Lucy back-endIt will use all
ALcyFormatBarFactory
instances registered to the back-end, and adding and/or removingALcyFormatBarFactory
s to/from thisTLcyCompositeFormatBarFactory
will respectively add/remove it as service from the back-end.If you want to create a
TLcyCompositeFormatBarFactory
which does not use the back-end, useTLcyCompositeFormatBarFactory()
instead.- Parameters:
aLucyEnv
- The Lucy back-end.- See Also:
-
-
Method Details
-
addFormatBarFactory
Adds the given
ALcyFormatBarFactory
to the list of registered format bar factories.Equivalent of calling
addFormatBarFactory( aFormatBarFactory, ILcyLucyEnv.PRIORITY_DEFAULT );
- Parameters:
aFormatBarFactory
- The format bar factory. Must not benull
- See Also:
-
addFormatBarFactory
Adds the given
ALcyFormatBarFactory
to the list of registered format bar factories.If the constructor specifying an
ILcyLucyEnv
is used, theALcyFormatBarFactory
will be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object, int)
). When callingILcyLucyEnv.getServices(Class)
afterwards,aFormatBarFactory
will only be included in the returned list when the requested class wasALcyFormatBarFactory.class
.
Note: if you want to remove the registeredALcyFormatBarFactory
afterwards, useremoveFormatBarFactory(ALcyFormatBarFactory)
and notILcyLucyEnv.removeService(Object)
.- Parameters:
aFormatBarFactory
- The format bar factory. Must not benull
aPriority
- The priority for the instance. Lower values mean higher priorities. Services with higher priority appear earlier in the list of results. Common values areILcyLucyEnv.PRIORITY_DEFAULT
andILcyLucyEnv.PRIORITY_FALLBACK
- Since:
- 2016.0
- See Also:
-
removeFormatBarFactory
Removes the given
ALcyFormatBarFactory
from the list of registered format bar factories. Nothing will happen if the given provider was never added before.If the constructor specifying an
ILcyLucyEnv
is used, theALcyFormatBarFactory
will be removed as service from the Lucy back-end (seeILcyLucyEnv.removeService(Object)
).
Note: it is only possible to removeALcyFormatBarFactory
instances which were registered using theaddFormatBarFactory(ALcyFormatBarFactory)
method.- Parameters:
aFormatBarFactory
- The format bar factory. Must not benull
- See Also:
-
canCreateFormatBar
Description copied from class:ALcyFormatBarFactory
Returnstrue
if aALcyFormatBar
can be created for the given parameters,false
otherwise.- Specified by:
canCreateFormatBar
in classALcyFormatBarFactory
- Parameters:
aView
- The view to create the bar for. Cannot benull
.aLayer
- The layer to create this bar for. Can benull
. It is null if a bar needs to be created before any layer of the format is available.- Returns:
true
if aALcyFormatBar
can be created for the given parameters,false
otherwise.
-
createFormatBar
Description copied from class:ALcyFormatBarFactory
Creates an
ALcyFormatBar
for the given parameters.This method does not need to set the given layer to the created
ALcyFormatBar
, that is the responsibility of the user of this method.- Specified by:
createFormatBar
in classALcyFormatBarFactory
- Parameters:
aView
- The view to create the bar for. Cannot benull
.aLayer
- The layer to create this bar for. Can benull
. It is null if a bar needs to be created before any layer of the format is available.- Returns:
- the newly created
ALcyFormatBar
.
-
getFormatBarFactoryCount
public int getFormatBarFactoryCount()Returns the number of registered
ALcyFormatBarFactory
instances.- Returns:
- the number of registered
ALcyFormatBarFactory
instances.
-
getFormatBarFactory
Returns the
ALcyFormatBarFactory
at indexaIndex
.- Parameters:
aIndex
- The index: 0 <= aIndex <getFormatBarFactoryCount()
- Returns:
- the
ALcyFormatBarFactory
at indexaIndex
.
-