Class ALcdBalloonManager
- Direct Known Subclasses:
TLcdGXYBalloonManager
,TLspBalloonManager
An abstract class for all balloon managers. A balloon manager creates and manages all balloons, as well as their visibility, size and location.
The content creation of the balloon is delegated to a ILcdBalloonContentProvider
Note:As with most painting or Swing related classes, all methods should be called in the Event Dispatch Thread.
- Since:
- 10.0
-
Constructor Summary
ModifierConstructorDescriptionprotected
ALcdBalloonManager
(Container aBalloonContainer) Creates a new balloon manager with an invisible balloon.protected
ALcdBalloonManager
(Container aBalloonContainer, ILcdBalloonContentProvider aBalloonContentProvider) Creates a new balloon manager with an invisible balloon.protected
ALcdBalloonManager
(Container aBalloonContainer, ILcdBalloonContentProvider aBalloonContentProvider, TLcdBalloonGUIFactory aBalloonGUIFactory) Creates a new balloon manager with an invisible balloon. -
Method Summary
Modifier and TypeMethodDescriptionprotected Rectangle
computeBalloonBounds
(ALcdBalloonDescriptor aBalloonDescriptor, Rectangle aViewBounds, boolean aIsManualRepositioned, Point aEnforcedPosition, boolean aIsManualResized, Dimension aEnforcedSize) Computes the rectangle (in view coordinates) in which the balloon should be visible.final JComponent
getBalloon
(ALcdBalloonDescriptor aBalloonDescriptor) Returns theJComponent
that represents the balloon for the given balloon descriptor.getBalloonContainer
(ALcdBalloonDescriptor aBalloonDescriptor) Returns the container that contains the balloon for the given balloon descriptor.getBalloonContent
(ALcdBalloonDescriptor aBalloonDescriptor) Returns theJComponent
that is the balloon content for the given balloon descriptor.Returns the balloon content provider.Returns the current object for which a balloon has been created.protected abstract Point
getFocusPoint
(ALcdBalloonDescriptor aBalloonDescriptor) Method that can retrieve the focus point of an object.boolean
Returns whether balloons managed by this balloon manager are enabled.void
setBalloonContentProvider
(ILcdBalloonContentProvider 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.
-
Constructor Details
-
ALcdBalloonManager
Creates a new balloon manager with an invisible balloon. After this constructor is called, references to
getBalloon()
will return a valid balloon.The abstract constructor does not add the balloon to the given container, this is left up to concrete implementations.
Balloon content providers are retrieved using
TLcdServiceLoader
.The created balloon will be equipped with all necessary listeners for its functionality, such as the ability to resize and move. It also listens to the balloon content panel for changes in size or location, and calls the
computeBalloonBounds()
method.- Parameters:
aBalloonContainer
- a container in which the main balloon should be put. Note that this abstract constructor does not explicitly add the balloon to the given container. The container can be retrieved with:getBalloonContainer()
-
ALcdBalloonManager
protected ALcdBalloonManager(Container aBalloonContainer, ILcdBalloonContentProvider aBalloonContentProvider) Creates a new balloon manager with an invisible balloon. After this constructor is called, references to
getBalloon()
will return a valid balloon.The abstract constructor does not add the balloon to the given container, this is left up to concrete implementations.
The created balloon will be equipped with all necessary listeners for its functionality, such as the ability to resize and move. It also listens to the balloon content panel for changes in size or location, and calls the
computeBalloonBounds()
method.- Parameters:
aBalloonContainer
- a container in which the main balloon should be put. Note that this abstract constructor does not explicitly add the balloon to the given container. The container can be retrieved with:getBalloonContainer()
.aBalloonContentProvider
- a balloon panel provider capable of creating balloon content panels given an object.
-
ALcdBalloonManager
protected ALcdBalloonManager(Container aBalloonContainer, ILcdBalloonContentProvider aBalloonContentProvider, TLcdBalloonGUIFactory aBalloonGUIFactory) Creates a new balloon manager with an invisible balloon. After this constructor is called, references to
getBalloon()
will return a valid balloon.The abstract constructor does not add the balloon to the given container, this is left up to concrete implementations.
The created balloon will be equipped with all necessary listeners for its functionality, such as the ability to resize and move. It also listens to the balloon content panel for changes in size or location, and calls the
computeBalloonBounds()
method.A custom balloon GUI factory is also supplied with this constructor, that allows to customize the visualization of the balloon.
- Parameters:
aBalloonContainer
- a container in which the main balloon should be put. Note that this abstract constructor does not explicitly add the balloon to the given container. The container can be retrieved with:getBalloonContainer()
.aBalloonContentProvider
- a balloon panel provider capable of creating balloon content panels given an object.aBalloonGUIFactory
- a custom balloon GUI factory.
-
-
Method Details
-
getBalloonContent
Returns the
JComponent
that is the balloon content for the given balloon descriptor. ThisJComponent
was returned by theILcdBalloonContentProvider
.- Parameters:
aBalloonDescriptor
- an object describing a balloon.- Returns:
- the balloon content for the given balloon descriptor.
-
getBalloon
Returns the
JComponent
that represents the balloon for the given balloon descriptor.- Parameters:
aBalloonDescriptor
- an object describing a balloon.- Returns:
- the
JComponent
that represents the balloon.
-
getBalloonContainer
Returns the container that contains the balloon for the given balloon descriptor.
- Parameters:
aBalloonDescriptor
- an object describing a balloon.- Returns:
- the balloon container for the given balloon descriptor.
-
isBalloonsEnabled
public boolean isBalloonsEnabled()Returns whether balloons managed by this balloon manager are enabled.
- Returns:
- true if balloons are enabled, false otherwise.
-
setBalloonsEnabled
public void setBalloonsEnabled(boolean aBalloonsEnabled) Enables or disables balloons globally.
- Parameters:
aBalloonsEnabled
- true if balloons should be enabled globally, false otherwise.
-
setBalloonDescriptor
Displays balloon with the given data. If the given descriptor equals null, no balloon is displayed.
- Parameters:
aBalloonDescriptor
- an object describing a balloon.
-
computeBalloonBounds
protected Rectangle computeBalloonBounds(ALcdBalloonDescriptor aBalloonDescriptor, Rectangle aViewBounds, boolean aIsManualRepositioned, Point aEnforcedPosition, boolean aIsManualResized, Dimension aEnforcedSize) Computes the rectangle (in view coordinates) in which the balloon should be visible. This method can be overridden for custom positioning algorithms.- Parameters:
aBalloonDescriptor
- an object describing a balloon.aViewBounds
- the bounds of the view.aIsManualRepositioned
- true if the position of the balloon has been changed manually through user interaction.aEnforcedPosition
- if not null, this position will be enforced during the calculation of the bounds, and if aIsManualRepositioned is true.aIsManualResized
- true if the size of the balloon has been changed manually through user interaction.aEnforcedSize
- if not null, this size will be enforced during the calculation of the bounds, and if aIsManualResized is true.- Returns:
- A rectangle that represents the size and location of the balloon (in view coordinates), based on the supplied values.
-
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
Returns the balloon content provider.
By default, this is a composite implementation that makes use of
TLcdServiceLoader
.- Returns:
- a balloon content provider
-
getFocusPoint
Method that can retrieve the focus point of an object. The returned Point should be defined in view-coordinates, and can be null if no focus point exists. The focus point determines how the balloon arrow should be drawn on-screen.- Parameters:
aBalloonDescriptor
- an object, describing where the balloon is positioned.- Returns:
- A point in view coordinates that represent the point of the object on the screen, or null if the object has no point.
-