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
ConstructorsConstructorDescriptionDefault constructor.TLcyCompositeFormatBarFactory(ILcyLucyEnv aLucyEnv) Construct aTLcyCompositeFormatBarFactoryworking on the Lucy back-end -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFormatBarFactory(ALcyFormatBarFactory aFormatBarFactory) Adds the givenALcyFormatBarFactoryto the list of registered format bar factories.voidaddFormatBarFactory(ALcyFormatBarFactory aFormatBarFactory, int aPriority) Adds the givenALcyFormatBarFactoryto the list of registered format bar factories.booleancanCreateFormatBar(ILcdView aView, ILcdLayer aLayer) Returnstrueif aALcyFormatBarcan be created for the given parameters,falseotherwise.createFormatBar(ILcdView aView, ILcdLayer aLayer) Creates anALcyFormatBarfor the given parameters.getFormatBarFactory(int aIndex) Returns theALcyFormatBarFactoryat indexaIndex.intReturns the number of registeredALcyFormatBarFactoryinstances.voidremoveFormatBarFactory(ALcyFormatBarFactory aFormatBarFactory) Removes the givenALcyFormatBarFactoryfrom the list of registered format bar factories.
-
Constructor Details
-
TLcyCompositeFormatBarFactory
public TLcyCompositeFormatBarFactory()Default constructor.
The created instance will only work on the
ALcyFormatBarFactoryinstances registered to it. If you want to use all registeredALcyFormatBarFactoryinstances of the Lucy back-end, useTLcyCompositeFormatBarFactory(com.luciad.lucy.ILcyLucyEnv)instead.- See Also:
-
TLcyCompositeFormatBarFactory
Construct a
TLcyCompositeFormatBarFactoryworking on the Lucy back-endIt will use all
ALcyFormatBarFactoryinstances registered to the back-end, and adding and/or removingALcyFormatBarFactorys to/from thisTLcyCompositeFormatBarFactorywill respectively add/remove it as service from the back-end.If you want to create a
TLcyCompositeFormatBarFactorywhich does not use the back-end, useTLcyCompositeFormatBarFactory()instead.- Parameters:
aLucyEnv- The Lucy back-end.- See Also:
-
-
Method Details
-
addFormatBarFactory
Adds the given
ALcyFormatBarFactoryto 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
ALcyFormatBarFactoryto the list of registered format bar factories.If the constructor specifying an
ILcyLucyEnvis used, theALcyFormatBarFactorywill be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object, int)). When callingILcyLucyEnv.getServices(Class)afterwards,aFormatBarFactorywill only be included in the returned list when the requested class wasALcyFormatBarFactory.class.
Note: if you want to remove the registeredALcyFormatBarFactoryafterwards, useremoveFormatBarFactory(ALcyFormatBarFactory)and notILcyLucyEnv.removeService(Object).- Parameters:
aFormatBarFactory- The format bar factory. Must not benullaPriority- 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_DEFAULTandILcyLucyEnv.PRIORITY_FALLBACK- Since:
- 2016.0
- See Also:
-
removeFormatBarFactory
Removes the given
ALcyFormatBarFactoryfrom the list of registered format bar factories. Nothing will happen if the given provider was never added before.If the constructor specifying an
ILcyLucyEnvis used, theALcyFormatBarFactorywill be removed as service from the Lucy back-end (seeILcyLucyEnv.removeService(Object)).
Note: it is only possible to removeALcyFormatBarFactoryinstances which were registered using theaddFormatBarFactory(ALcyFormatBarFactory)method.- Parameters:
aFormatBarFactory- The format bar factory. Must not benull- See Also:
-
canCreateFormatBar
Description copied from class:ALcyFormatBarFactoryReturnstrueif aALcyFormatBarcan be created for the given parameters,falseotherwise.- Specified by:
canCreateFormatBarin 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:
trueif aALcyFormatBarcan be created for the given parameters,falseotherwise.
-
createFormatBar
Description copied from class:ALcyFormatBarFactoryCreates an
ALcyFormatBarfor 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:
createFormatBarin 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
ALcyFormatBarFactoryinstances.- Returns:
- the number of registered
ALcyFormatBarFactoryinstances.
-
getFormatBarFactory
Returns the
ALcyFormatBarFactoryat indexaIndex.- Parameters:
aIndex- The index: 0 <= aIndex <getFormatBarFactoryCount()- Returns:
- the
ALcyFormatBarFactoryat indexaIndex.
-