public class TLspBalloonManager extends ALcdBalloonManager
Balloon manager for Lightspeed views.
Once you set an appropriate balloon descriptor, the manager retrieves the corresponding balloon contents and anchors those on the map overlay into a movable and resizable balloon GUI component with an arrow. The balloon will remain on the map until the user closes it or until you passnull
to ALcdBalloonManager.setBalloonDescriptor(com.luciad.view.swing.ALcdBalloonDescriptor)
.
Balloons are typically, but not necessarily tied to domain object selection:
view.addLayerSelectionListener(
(ILcdSelectionListener<Object>) aSelectionEvent -> {
ILcdLayer layer = (ILcdLayer) aSelectionEvent.getSelection();
if (layer.getSelectionCount() == 1) {
TLcdDomainObjectContext objectContext = new TLcdDomainObjectContext(
layer.selectedObjects().nextElement(), layer.getModel(), layer, view);
manager.setBalloonDescriptor(new TLcdModelElementBalloonDescriptor(objectContext));
} else {
manager.setBalloonDescriptor(null);
}
});
The samples.common.BalloonViewSelectionListener
sample class does exactly this, and also makes sure that hiding
or removing layers removes corresponding balloons.
Note that TLspBalloonManager only supports the display of one balloon at a time.
For more information on adding balloons to the view, refer to the balloon how-to article.
Constructor and Description |
---|
TLspBalloonManager(ILspAWTView aView)
Creates a default balloon manager for the given view.
|
TLspBalloonManager(ILspAWTView aView,
ILcdBalloonContentProvider aBalloonContentProvider)
Creates a default balloon manager for the given view, using the given content provider.
|
TLspBalloonManager(ILspAWTView aView,
ILcdBalloonContentProvider aBalloonContentProvider,
TLcdBalloonGUIFactory aBalloonGUIFactory)
Creates a default balloon manager for the given view, using the given content provider and GUI
factory.
|
TLspBalloonManager(ILspView aView,
Container aBalloonContainer,
Object aConstraints)
Creates a default balloon manager for the given view, using the given container and layout constraints.
|
TLspBalloonManager(ILspView aView,
Container aBalloonContainer,
Object aConstraints,
ILcdBalloonContentProvider aBalloonContentProvider)
Creates a default balloon manager for the given view, using the given container and layout constraints,
and the given content provider.
|
TLspBalloonManager(ILspView aView,
Container aBalloonContainer,
Object aConstraints,
ILcdBalloonContentProvider aBalloonContentProvider,
TLcdBalloonGUIFactory aBalloonGUIFactory)
Creates a default balloon manager for the given view, using the given container and layout constraints,
and the given content provider and GUI factory.
|
Modifier and Type | Method and Description |
---|---|
protected Point |
getFocusPoint(ALcdBalloonDescriptor aBalloonDescriptor)
Returns the focus point of a given object in view coordinates, or null if there is
no focus point.
|
ILspView |
getView()
Returns the view this manager is configured for.
|
computeBalloonBounds, getBalloon, getBalloonContainer, getBalloonContent, getBalloonContentProvider, getBalloonDescriptor, isBalloonsEnabled, setBalloonContentProvider, setBalloonDescriptor, setBalloonsEnabled
public TLspBalloonManager(ILspAWTView aView)
ILspAWTView.getOverlayComponent()
). The used constraint is TLcdOverlayLayout.Location.NO_LAYOUT
.
The content provider is retrieved using the LcdService
annotation.
For more information, refer to the
Working with the services mechanism article.
aView
- a view which can be used for world to view transformations.public TLspBalloonManager(ILspAWTView aView, ILcdBalloonContentProvider aBalloonContentProvider)
ILspAWTView.getOverlayComponent()
). The used constraint is TLcdOverlayLayout.Location.NO_LAYOUT
.aView
- the view for which balloons should be managedaBalloonContentProvider
- a balloon panel provider capable of creating balloon content
panels given an object.public TLspBalloonManager(ILspAWTView aView, ILcdBalloonContentProvider aBalloonContentProvider, TLcdBalloonGUIFactory aBalloonGUIFactory)
ILspAWTView.getOverlayComponent()
). The used constraint is TLcdOverlayLayout.Location.NO_LAYOUT
.aView
- the view for which balloons should be managedaBalloonContentProvider
- a balloon panel provider capable of creating balloon content
panels given an object.aBalloonGUIFactory
- a custom balloon GUI factorypublic TLspBalloonManager(ILspView aView, Container aBalloonContainer, Object aConstraints)
aView
- the view for which balloons should be managedaBalloonContainer
- a container to which balloons can be added.aConstraints
- The constraints with which the balloon should be added to aBalloonContainer,
i.e.: TLcdOverlayLayout.Location.NO_LAYOUT. If null, default constraints are used.public TLspBalloonManager(ILspView aView, Container aBalloonContainer, Object aConstraints, ILcdBalloonContentProvider aBalloonContentProvider)
aView
- the view for which balloons should be managedaBalloonContainer
- a container to which balloons can be added.aConstraints
- The constraints with which the balloon should be added to aBalloonContainer,
i.e.: TLcdOverlayLayout.Location.NO_LAYOUT. If null, default constraints are used.aBalloonContentProvider
- a balloon panel provider capable of creating balloon content
panels given an object.public TLspBalloonManager(ILspView aView, Container aBalloonContainer, Object aConstraints, ILcdBalloonContentProvider aBalloonContentProvider, TLcdBalloonGUIFactory aBalloonGUIFactory)
aView
- the view for which balloons should be managedaBalloonContainer
- a container to which balloons can be added.aConstraints
- The constraints with which the balloon should be added to aBalloonContainer,
i.e.: TLcdOverlayLayout.Location.NO_LAYOUT. If null, default constraints are used.aBalloonContentProvider
- a balloon panel provider capable of creating balloon content
panels given an object.aBalloonGUIFactory
- a custom balloon GUI factorypublic ILspView getView()
protected Point getFocusPoint(ALcdBalloonDescriptor aBalloonDescriptor)
getFocusPoint
in class ALcdBalloonManager
aBalloonDescriptor
- an object, describing a balloon.