Class TLspFXBalloonManager

java.lang.Object
com.luciad.view.lightspeed.javafx.TLspFXBalloonManager
All Implemented Interfaces:
ILcdDisposable, AutoCloseable

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 pass null 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.

Since:
2020.0
  • Field Details

  • Constructor Details

    • TLspFXBalloonManager

      public TLspFXBalloonManager(TLspFXView aView)
      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 the LcdService annotation. For more information, refer to the Working with the services mechanism article.
      Parameters:
      aView - the view for which balloons should be managed
    • TLspFXBalloonManager

      public TLspFXBalloonManager(TLspFXView aView, ILcdFXBalloonContentProvider aBalloonContentProvider)
      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 managed
      aBalloonContentProvider - 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 managed
      aBalloonPane - 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

      public TLspFXView getView()
      Returns the view that this manager is configured for.
      Returns:
      the view that this manager is configured for
    • getFocusPoint

      protected TLcdXYPoint getFocusPoint(ALcdBalloonDescriptor aBalloonDescriptor)
      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

      public ALcdBalloonDescriptor 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

      public void setBalloonContentProvider(ILcdFXBalloonContentProvider aBalloonContentProvider)

      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

      public ILcdFXBalloonContentProvider getBalloonContentProvider()

      Gets the balloon content provider.

      Returns:
      a balloon content provider; null if no content provider has been set.
    • setBalloonDescriptor

      public void setBalloonDescriptor(ALcdBalloonDescriptor aBalloonDescriptor)

      Displays balloon with the given data. If the given descriptor equals null, no balloon is displayed.

      Parameters:
      aBalloonDescriptor - an object describing a balloon.