public class TLspFXBalloonManager extends Object
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);
}
});
The 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.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_DISTANCE |
Constructor and Description |
---|
TLspFXBalloonManager(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,
javafx.scene.layout.Pane aBalloonPane,
ILcdFXBalloonContentProvider aBalloonContentProvider)
Creates a balloon manager for the given view, using the given container and layout constraints,
and the given content provider.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of this object and allows it to release any system resources that it is holding.
|
ILcdFXBalloonContentProvider |
getBalloonContentProvider()
Gets the balloon content provider.
|
ALcdBalloonDescriptor |
getBalloonDescriptor()
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.
|
TLspFXView |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public static final int DEFAULT_DISTANCE
public TLspFXBalloonManager(TLspFXView aView)
LcdService
annotation.
For more information, refer to the
Working with the services mechanism article.aView
- the view for which balloons should be managedpublic TLspFXBalloonManager(TLspFXView aView, ILcdFXBalloonContentProvider aBalloonContentProvider)
aView
- the view for which balloons should be managedaBalloonContentProvider
- a balloon panel provider capable of creating balloon content
panels given an object.public TLspFXBalloonManager(TLspFXView aView, javafx.scene.layout.Pane aBalloonPane, ILcdFXBalloonContentProvider aBalloonContentProvider)
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.public TLspFXView getView()
protected TLcdXYPoint getFocusPoint(ALcdBalloonDescriptor aBalloonDescriptor)
aBalloonDescriptor
- an object, describing a balloon.public void dispose()
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.
public void setBalloonsEnabled(boolean aBalloonsEnabled)
Enables or disables balloons globally.
aBalloonsEnabled
- true if balloons should be enabled globally, false otherwise.public ALcdBalloonDescriptor getBalloonDescriptor()
Returns the current object for which a balloon has been created.
public void setBalloonContentProvider(ILcdFXBalloonContentProvider aBalloonContentProvider)
Sets the balloon content provider for this balloon manager.
aBalloonContentProvider
- a balloon panel provider capable of creating balloon content
panels given an object.public ILcdFXBalloonContentProvider getBalloonContentProvider()
Gets the balloon content provider.
public void setBalloonDescriptor(ALcdBalloonDescriptor aBalloonDescriptor)
Displays balloon with the given data. If the given descriptor equals null, no balloon is displayed.
aBalloonDescriptor
- an object describing a balloon.