Class TLspFXBalloonManager
java.lang.Object
com.luciad.view.lightspeed.javafx.TLspFXBalloonManager
- All Implemented Interfaces:
ILcdDisposable
,AutoCloseable
Balloon manager for Lightspeed JavaFX 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 setBalloonDescriptor(com.luciad.view.swing.ALcdBalloonDescriptor)
.
Balloons are typically, but not necessarily tied to domain object selection:
TLspFXBalloonManager manager = new TLspFXBalloonManager(view);
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);
}
});
samples.lightspeed.javafx.balloon.BalloonFXViewSelectionListener
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 How to add balloons to the view article.
- Since:
- 2020.0
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTLspFXBalloonManager
(TLspFXView aView) Creates a balloon manager for the given view.TLspFXBalloonManager
(TLspFXView aView, ILcdFXBalloonContentProvider aBalloonContentProvider) Creates a balloon manager for the given view and the given content provider.TLspFXBalloonManager
(TLspFXView aView, Pane aBalloonPane, ILcdFXBalloonContentProvider aBalloonContentProvider) Creates a balloon manager for the given view, using the given container and layout constraints, and the given content provider. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of this object and allows it to release any system resources that it is holding.Gets the balloon content provider.Returns the current object for which a balloon has been created.protected TLcdXYPoint
getFocusPoint
(ALcdBalloonDescriptor aBalloonDescriptor) Returns the focus point of a given object in view coordinates, or null if there is no focus point.getView()
Returns the view that this manager is configured for.void
setBalloonContentProvider
(ILcdFXBalloonContentProvider aBalloonContentProvider) Sets the balloon content provider for this balloon manager.void
setBalloonDescriptor
(ALcdBalloonDescriptor aBalloonDescriptor) Displays balloon with the given data.void
setBalloonsEnabled
(boolean aBalloonsEnabled) Enables or disables balloons globally.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdDisposable
close
-
Field Details
-
DEFAULT_DISTANCE
public static final int DEFAULT_DISTANCE- See Also:
-
-
Constructor Details
-
TLspFXBalloonManager
Creates a balloon manager for the given view. The manager adds balloons to a default fullscreen Pane that's added to the view overlays. The content provider is retrieved using theLcdService
annotation. For more information, refer to the Working with the services mechanism article.- Parameters:
aView
- the view for which balloons should be managed
-
TLspFXBalloonManager
Creates a balloon manager for the given view and the given content provider. The manager adds balloons to a default fullscreen Pane that's added to the view overlays.- Parameters:
aView
- the view for which balloons should be managedaBalloonContentProvider
- a balloon panel provider capable of creating balloon content panels given an object.
-
TLspFXBalloonManager
public TLspFXBalloonManager(TLspFXView aView, Pane aBalloonPane, ILcdFXBalloonContentProvider aBalloonContentProvider) Creates a balloon manager for the given view, using the given container and layout constraints, and the given content provider.- Parameters:
aView
- the view for which balloons should be managedaBalloonPane
- a pane to which balloons can be added.aBalloonContentProvider
- a balloon panel provider capable of creating balloon content panels given an object.
-
-
Method Details
-
getView
Returns the view that this manager is configured for.- Returns:
- the view that this manager is configured for
-
getFocusPoint
Returns the focus point of a given object in view coordinates, or null if there is no focus point.- Parameters:
aBalloonDescriptor
- an object, describing a balloon.- Returns:
- Returns either null if there is no focus point, or a valid point in view coordinates.
-
dispose
public void dispose()Description copied from interface:ILcdDisposable
Disposes of this object and allows it to release any system resources that it is holding.
The result of calling any other method (other than
finalize
) on this object subsequent to a call to this method is undefined. -
setBalloonsEnabled
public void setBalloonsEnabled(boolean aBalloonsEnabled) Enables or disables balloons globally.
- Parameters:
aBalloonsEnabled
- true if balloons should be enabled globally, false otherwise.
-
getBalloonDescriptor
Returns the current object for which a balloon has been created.
- Returns:
- an object that is currently set as the main balloon focus point
-
setBalloonContentProvider
Sets the balloon content provider for this balloon manager.
- Parameters:
aBalloonContentProvider
- a balloon panel provider capable of creating balloon content panels given an object.
-
getBalloonContentProvider
Gets the balloon content provider.
- Returns:
- a balloon content provider; null if no content provider has been set.
-
setBalloonDescriptor
Displays balloon with the given data. If the given descriptor equals null, no balloon is displayed.
- Parameters:
aBalloonDescriptor
- an object describing a balloon.
-