public abstract class ALcdBalloonManager extends Object
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.
Modifier | Constructor and Description |
---|---|
protected |
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
JComponent |
getBalloon(ALcdBalloonDescriptor aBalloonDescriptor)
Returns the
JComponent that represents the balloon for the given balloon
descriptor. |
Container |
getBalloonContainer(ALcdBalloonDescriptor aBalloonDescriptor)
Returns the container that contains the balloon for the given balloon descriptor.
|
JComponent |
getBalloonContent(ALcdBalloonDescriptor aBalloonDescriptor)
Returns the
JComponent that is the balloon content for the given balloon descriptor. |
ILcdBalloonContentProvider |
getBalloonContentProvider()
Returns the balloon content provider.
|
ALcdBalloonDescriptor |
getBalloonDescriptor()
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 |
isBalloonsEnabled()
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.
|
protected ALcdBalloonManager(Container aBalloonContainer)
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.
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()
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.
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.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.
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.public JComponent getBalloonContent(ALcdBalloonDescriptor aBalloonDescriptor)
Returns the JComponent
that is the balloon content for the given balloon descriptor.
This JComponent
was returned by the ILcdBalloonContentProvider
.
aBalloonDescriptor
- an object describing a balloon.public final JComponent getBalloon(ALcdBalloonDescriptor aBalloonDescriptor)
Returns the JComponent
that represents the balloon for the given balloon
descriptor.
aBalloonDescriptor
- an object describing a balloon.JComponent
that represents the balloon.public Container getBalloonContainer(ALcdBalloonDescriptor aBalloonDescriptor)
Returns the container that contains the balloon for the given balloon descriptor.
aBalloonDescriptor
- an object describing a balloon.public boolean isBalloonsEnabled()
Returns whether balloons managed by this balloon manager are enabled.
public void setBalloonsEnabled(boolean aBalloonsEnabled)
Enables or disables balloons globally.
aBalloonsEnabled
- true if balloons should be enabled globally, false otherwise.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.protected Rectangle computeBalloonBounds(ALcdBalloonDescriptor aBalloonDescriptor, Rectangle aViewBounds, boolean aIsManualRepositioned, Point aEnforcedPosition, boolean aIsManualResized, Dimension aEnforcedSize)
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.public ALcdBalloonDescriptor getBalloonDescriptor()
Returns the current object for which a balloon has been created.
public void setBalloonContentProvider(ILcdBalloonContentProvider 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 ILcdBalloonContentProvider getBalloonContentProvider()
Returns the balloon content provider.
By default, this is a composite implementation that makes use of TLcdServiceLoader
.
protected abstract Point getFocusPoint(ALcdBalloonDescriptor aBalloonDescriptor)
aBalloonDescriptor
- an object, describing where the balloon is positioned.