Constructor and Description |
---|
AbstractOverlay() |
Modifier and Type | Method and Description |
---|---|
void |
addOverlayListener(OverlayListener listener)
Add a listener.
|
protected void |
fireOverlayConfigurationChanged()
Call this method to notify the system that the overlay has changed.
|
protected void |
fireOverlayTitleChanged()
Call this method to notify the system that the overlay title has changed.
|
PropertyMap |
getConfiguration()
Return the user-customizable settings for this overlay.
|
javax.swing.JComponent |
getConfigurationComponent()
Return the configuration UI component for this overlay.
|
boolean |
isVisible()
Return whether this overlay is shown.
|
void |
paintOverlay(java.awt.Graphics2D graphicsContext,
java.awt.Rectangle screenRect,
DisplaySettings displaySettings,
java.util.List<Image> images,
Image primaryImage,
java.awt.geom.Rectangle2D.Float imageViewPort)
Paint the overlay to the given graphics context.
|
void |
removeOverlayListener(OverlayListener listener)
Remove a listener.
|
void |
setConfiguration(PropertyMap config)
Configure the overlay with the given parameters.
|
void |
setVisible(boolean visible)
Show or hide this overlay.
|
public void paintOverlay(java.awt.Graphics2D graphicsContext, java.awt.Rectangle screenRect, DisplaySettings displaySettings, java.util.List<Image> images, Image primaryImage, java.awt.geom.Rectangle2D.Float imageViewPort)
This default implementation draws nothing. Override to draw the overlay graphics.
paintOverlay
in interface Overlay
graphicsContext
- the graphics context to paint withscreenRect
- the screen region displaying part or all of the image,
in the graphics context's coordinatesdisplaySettings
- the current display settings of the display windowimages
- the images on which the overlay is to be drawn (multiple
images if in composite color mode)primaryImage
- the currently selected image (if in composite color
mode) or the single displayed image (otherwise)imageViewPort
- the visible region of the image, in image coordinatespublic javax.swing.JComponent getConfigurationComponent()
The component should work well when laid out with a fixed width and height, determined based on its minimum and maximum sizes. The width of the component may be changed in response to layout changes, but the component must not actively resize itself. It is recommended that the preferred width be no more than 480 pixels.
This method should return the same object every time it is called,
throughout the lifetime of this Overlay instance. If the overlay does not
require any user configuration, null
may be returned.
Important: The Overlay must not create any UI objects unless this method is called, and still support all other methods. This is to support headless use of overlays.
This default implementation returns null. Override to provide a user interface.
getConfigurationComponent
in interface Overlay
public PropertyMap getConfiguration()
The configuration should contain all parameters needed to reproduce the same overlay on another display window.
This default implementation returns an empty property map. Override to implement custom settings.
getConfiguration
in interface Overlay
public void setConfiguration(PropertyMap config)
This default implementation does nothing. Override to implement custom settings.
setConfiguration
in interface Overlay
config
- a property map previously returned by
getConfiguration
of an overlay of the same class.public final boolean isVisible()
Note: AbstractOverlay
implements this method.
This implementation takes care of visibility management.
public final void setVisible(boolean visible)
Note: AbstractOverlay
implements this method.
This implementation takes care of visibility management.
setVisible
in interface Overlay
visible
- whether to show the overlaypublic final void addOverlayListener(OverlayListener listener)
Note: AbstractOverlay
implements this method.
This implementation takes care of managing listeners.
addOverlayListener
in interface Overlay
listener
- the listener to addfireOverlayConfigurationChanged()
public final void removeOverlayListener(OverlayListener listener)
Note: AbstractOverlay
implements this method.
This implementation takes care of managing listeners.
removeOverlayListener
in interface Overlay
listener
- the listener to removefireOverlayConfigurationChanged()
protected final void fireOverlayTitleChanged()
If the overlay has a fixed title, this method need not ever be called.
protected final void fireOverlayConfigurationChanged()
This only needs to be called when the overlay needs a repaint due to its configuration changing. The case when the displayed image has changed is automatically handled by the system.