Class TLcdGXYBalloonManager

java.lang.Object
com.luciad.view.swing.ALcdBalloonManager
com.luciad.view.gxy.swing.TLcdGXYBalloonManager

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

For more information on adding balloons to the view, refer to the balloon how-to article.

Since:
10.0
  • Constructor Details

    • TLcdGXYBalloonManager

      public TLcdGXYBalloonManager(ILcdGXYView aGXYView, Container aBalloonContainer, Object aConstraints)
      Creates a default balloon manager for a gxy view.

      The content provider is retrieved using the LcdService annotation. For more information, refer to the Working with the services mechanism article.

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

      public TLcdGXYBalloonManager(ILcdGXYView aGXYView, Container aBalloonContainer, Object aConstraints, ILcdBalloonContentProvider aBalloonContentProvider)
      Creates a default balloon manager for a gxy view.
      Parameters:
      aGXYView - the view for which balloons should be managed
      aBalloonContainer - 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.
    • TLcdGXYBalloonManager

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

    • getGXYView

      public ILcdGXYView getGXYView()
      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.