Class TLcyCompositeBalloonContentProvider
- All Implemented Interfaces:
ILcdBalloonContentProvider,Iterable<ILcdBalloonContentProvider>
Composite implementation (see composite design pattern) of ILcdBalloonContentProvider. It
keeps a list of associated ILcdBalloonContentProviders: one can add and remove other
ILcdBalloonContentProviders to this ILcdBalloonContentProvider. When a HyperlinkEvent
is fired, it loops over its associated ILcdBalloonContentProviders and notifies all of them.
It is up to the registered ILcdBalloonContentProviders to determine whether or not the fired
HyperlinkEvent is relevant.
When creating a new TLcyCompositeBalloonContentProvider using the default
constructor (see TLcyCompositeBalloonContentProvider()), the created instance will
only work on/with the ILcdBalloonContentProviders registered
on this composite instance (see addBalloonContentProvider(com.luciad.view.swing.ILcdBalloonContentProvider)
and removeBalloonContentProvider(ILcdBalloonContentProvider)).
When creating a new TLcyCompositeBalloonContentProvider using the constructor
specifying an ILcyLucyEnv instance (see TLcyCompositeBalloonContentProvider(com.luciad.lucy.ILcyLucyEnv), the created instance will
work on the Lucy back-end services. It will use
all registered ILcdBalloonContentProvider instances of the
Lucy back-end, adding and/or removing an ILcdBalloonContentProvider will
add/remove the ILcdBalloonContentProvider as service from Lucy, ... .
-
Field Summary
Fields inherited from class com.luciad.lucy.util.TLcyGenericComposite
PRIORITY_DEFAULT, PRIORITY_FALLBACK -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Construct aTLcyCompositeBalloonContentProviderworking on the Lucy back-end -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBalloonContentProvider(ILcdBalloonContentProvider aBalloonContentProvider) Adds the givenILcdBalloonContentProviderto this composite balloon content provider.booleancanGetContent(ALcdBalloonDescriptor aBalloonDescriptor) Checks if it is possible to return aJComponentthat should be used as the content.getBalloonContentProvider(int aIndex) Returns theILcdBalloonContentProviderat the given index.intReturns the number of currently registered balloon content providers.getContent(ALcdBalloonDescriptor aBalloonDescriptor) Returns the balloon contents of an object.voidremoveBalloonContentProvider(ILcdBalloonContentProvider aBalloonContentProvider) Removes the givenILcdBalloonContentProviderfrom this composite layer factory.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TLcyCompositeBalloonContentProvider
public TLcyCompositeBalloonContentProvider()Default constructor. No
ILcdBalloonContentProviders are associated.The created instance will only work on the
ILcdBalloonContentProviderinstances registered to it. If you want to use all registeredILcdBalloonContentProviderinstances of the Lucy back-end, useTLcyCompositeBalloonContentProvider(com.luciad.lucy.ILcyLucyEnv)instead.- See Also:
-
TLcyCompositeBalloonContentProvider
Construct a
TLcyCompositeBalloonContentProviderworking on the Lucy back-endIt will use all
ILcdBalloonContentProviderinstances registered to the back-end, and adding and/or removingILcdBalloonContentProviders to/from thisILcdBalloonContentProviderwill respectively add/remove it as service from the back-end.If you want to create a
TLcyCompositeBalloonContentProviderwhich does not use the back-end, useTLcyCompositeBalloonContentProvider()instead.- Parameters:
aLucyEnv- The Lucy back-end.- See Also:
-
-
Method Details
-
canGetContent
Description copied from interface:ILcdBalloonContentProviderChecks if it is possible to return aJComponentthat should be used as the content. The implementation of this method should be consistent with the implementation ofILcdBalloonContentProvider.getContent(ALcdBalloonDescriptor), i.e. when this method returnsfalse,ILcdBalloonContentProvider.getContent(ALcdBalloonDescriptor)should returnnulland vice versa.- Specified by:
canGetContentin interfaceILcdBalloonContentProvider- Parameters:
aBalloonDescriptor- An object describing a balloon.- Returns:
- true if a content
JComponentcan be returned for the givenALcdBalloonDescriptorand false otherwise.
-
getContent
Description copied from interface:ILcdBalloonContentProviderReturns the balloon contents of an object. It is allowed to call this method without first callingILcdBalloonContentProvider.canGetContent(ALcdBalloonDescriptor). Both implementations should be consistent though, i.e. whenILcdBalloonContentProvider.canGetContent(ALcdBalloonDescriptor)returnsfalse, this method should returnnulland vice versa.- Specified by:
getContentin interfaceILcdBalloonContentProvider- Parameters:
aBalloonDescriptor- An object describing a balloon.- Returns:
- a
JComponentthat should be used as the content of a balloon, ornullwhen this provider cannot provide contents for the givenALcdBalloonDescriptor.
-
addBalloonContentProvider
Adds the given
ILcdBalloonContentProviderto this composite balloon content provider. TheILcdBalloonContentProvidershould only create balloon contents for objects it knows about.If the constructor specifying an
ILcyLucyEnvis used, theILcdBalloonContentProviderwill be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object, int)). When callingILcyLucyEnv.getServices(Class)afterwards,aBalloonContentProviderwill only be included in the returned list when the requested class wasILcdBalloonContentProvider.class.
Note: if you want to remove the registeredILcdBalloonContentProviderafterwards, useremoveBalloonContentProvider(com.luciad.view.swing.ILcdBalloonContentProvider)and notILcyLucyEnv.removeService(Object).- Parameters:
aBalloonContentProvider- the balloon content provider- See Also:
-
removeBalloonContentProvider
Removes the given
ILcdBalloonContentProviderfrom this composite layer factory. If the givenILcdBalloonContentProviderwas never added before, nothing happens.If the constructor specifying an
ILcyLucyEnvis used, theILcdBalloonContentProviderwill be removed as service from the Lucy back-end (seeILcyLucyEnv.removeService(Object)).
Note: it is only possible to removeILcdBalloonContentProviderinstances which were registered using theaddBalloonContentProvider(com.luciad.view.swing.ILcdBalloonContentProvider)method.- Parameters:
aBalloonContentProvider- AILcdBalloonContentProviderto remove.- See Also:
-
getBalloonContentProviderCount
public int getBalloonContentProviderCount()Returns the number of currently registered balloon content providers.
- Returns:
- The number of associated
ILcdBalloonContentProviders.
-
getBalloonContentProvider
Returns the
ILcdBalloonContentProviderat the given index.- Parameters:
aIndex- the index of theILcdBalloonContentProviderto return.- Returns:
- The associated
ILcdBalloonContentProviderat the given index.
-