public class TLcdGXYBalloonManager extends ALcdBalloonManager
An implementation of ALcdBalloonManager for GXY 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.
For more information on adding balloons to the view, refer to the balloon how-to article.
Constructor and Description |
---|
TLcdGXYBalloonManager(ILcdGXYView aGXYView,
Container aBalloonContainer,
Object aConstraints)
Creates a default balloon manager for a gxy view.
|
TLcdGXYBalloonManager(ILcdGXYView aGXYView,
Container aBalloonContainer,
Object aConstraints,
ILcdBalloonContentProvider aBalloonContentProvider)
Creates a default balloon manager for a gxy view.
|
TLcdGXYBalloonManager(ILcdGXYView aGXYView,
Container aBalloonContainer,
Object aConstraints,
ILcdBalloonContentProvider aBalloonContentProvider,
TLcdBalloonGUIFactory aBalloonGUIFactory)
Creates a balloon manager for a gxy view, with a custom balloon 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.
|
ILcdGXYView |
getGXYView()
Returns the view this manager is configured for.
|
computeBalloonBounds, getBalloon, getBalloonContainer, getBalloonContent, getBalloonContentProvider, getBalloonDescriptor, isBalloonsEnabled, setBalloonContentProvider, setBalloonDescriptor, setBalloonsEnabled
public TLcdGXYBalloonManager(ILcdGXYView aGXYView, Container aBalloonContainer, Object aConstraints)
The content provider is retrieved using the LcdService
annotation.
For more information, refer to the
Working with the services mechanism article.
aGXYView
- the view for which balloons should be managedaBalloonContainer
- a container to which balloons can be added.aConstraints
- The constrains with which the balloon should be added to aBalloonContainer,
i.e.: BorderLayout.CENTER. If null, default constraints are used.public TLcdGXYBalloonManager(ILcdGXYView aGXYView, Container aBalloonContainer, Object aConstraints, ILcdBalloonContentProvider aBalloonContentProvider)
aGXYView
- the view for which balloons should be managedaBalloonContainer
- a container to which balloons can be added.aConstraints
- The constrains with which the balloon should be added to aBalloonContainer,
i.e.: BorderLayout.CENTER. If null, default constraints are used.aBalloonContentProvider
- a balloon panel provider capable of creating balloon content
panels given an object.public TLcdGXYBalloonManager(ILcdGXYView aGXYView, Container aBalloonContainer, Object aConstraints, ILcdBalloonContentProvider aBalloonContentProvider, TLcdBalloonGUIFactory aBalloonGUIFactory)
aGXYView
- the view for which balloons should be managedaBalloonContainer
- a container to which balloons can be added.aConstraints
- The constrains with which the balloon should be added to aBalloonContainer,
i.e.: BorderLayout.CENTER. 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 ILcdGXYView getGXYView()
protected Point getFocusPoint(ALcdBalloonDescriptor aBalloonDescriptor)
getFocusPoint
in class ALcdBalloonManager
aBalloonDescriptor
- an object, describing a balloon.