Class TLspBalloonManager

java.lang.Object
com.luciad.view.swing.ALcdBalloonManager
com.luciad.view.lightspeed.swing.TLspBalloonManager

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

Since:
2012.0
  • Constructor Details

    • TLspBalloonManager

      public TLspBalloonManager(ILspAWTView aView)
      Creates a default balloon manager for the given view. This constructor uses the overlay panel of the given view (see 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.

      Parameters:
      aView - a view which can be used for world to view transformations.
    • TLspBalloonManager

      public TLspBalloonManager(ILspAWTView aView, ILcdBalloonContentProvider aBalloonContentProvider)
      Creates a default balloon manager for the given view, using the given content provider. This constructor uses the overlay panel of the given view (see ILspAWTView.getOverlayComponent()). The used constraint is TLcdOverlayLayout.Location.NO_LAYOUT.
      Parameters:
      aView - the view for which balloons should be managed
      aBalloonContentProvider - a balloon panel provider capable of creating balloon content panels given an object.
    • TLspBalloonManager

      public TLspBalloonManager(ILspAWTView aView, ILcdBalloonContentProvider aBalloonContentProvider, TLcdBalloonGUIFactory aBalloonGUIFactory)
      Creates a default balloon manager for the given view, using the given content provider and GUI factory. This constructor uses the overlay panel of the given view (see ILspAWTView.getOverlayComponent()). The used constraint is TLcdOverlayLayout.Location.NO_LAYOUT.
      Parameters:
      aView - the view for which balloons should be managed
      aBalloonContentProvider - a balloon panel provider capable of creating balloon content panels given an object.
      aBalloonGUIFactory - a custom balloon GUI factory
    • TLspBalloonManager

      public TLspBalloonManager(ILspView aView, Container aBalloonContainer, Object aConstraints)
      Creates a default balloon manager for the given view, using the given container and layout constraints.
      Parameters:
      aView - the view for which balloons should be managed
      aBalloonContainer - 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.
    • TLspBalloonManager

      public 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.
      Parameters:
      aView - the view for which balloons should be managed
      aBalloonContainer - 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.
    • TLspBalloonManager

      public 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.
      Parameters:
      aView - the view for which balloons should be managed
      aBalloonContainer - 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 factory
  • Method Details

    • getView

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

      protected Point getFocusPoint(ALcdBalloonDescriptor aBalloonDescriptor)
      Returns the focus point of a given object in view coordinates, or null if there is no focus point.
      Specified by:
      getFocusPoint in class ALcdBalloonManager
      Parameters:
      aBalloonDescriptor - an object, describing a balloon.
      Returns:
      Returns either null if there is no focus point, or a valid point in view coordinates.