public abstract class Overlay extends java.lang.Object implements Painter, ChangeListener, java.lang.Comparable<Overlay>, XMLPersistent
IcyCanvas
subclasses should propagate mouse and key events to overlay.Modifier and Type | Class and Description |
---|---|
static class |
Overlay.OverlayPriority
Define the overlay priority:
Lowest | BACKGROUND (below image)
| IMAGE (image level)
| SHAPE (just over the image)
| TEXT (over image and shape)
| TOOLTIP (all over the rest)
Highest | TOPMOST (absolute topmost)
You have 4 levels for each category (except TOPMOST) for finest adjustment:
Lowest | LOW
| NORMAL
| HIGH
Highest | TOP
TOP level should be used to give focus to a specific Overlay over all other in the same
category.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID_CANBEREMOVED |
static java.lang.String |
ID_CLASSNAME |
static java.lang.String |
ID_ID |
static java.lang.String |
ID_NAME |
static java.lang.String |
ID_OVERLAY |
static java.lang.String |
ID_PRIORITY |
static java.lang.String |
ID_READONLY |
static java.lang.String |
ID_RECEIVEKEYEVENTONHIDDEN |
static java.lang.String |
ID_RECEIVEMOUSEEVENTONHIDDEN |
static int |
LOD_SMALL
We consider as tiny object anything with a size of 10 pixels or less
|
static int |
LOD_TINY |
static java.lang.String |
PROPERTY_CANBEREMOVED |
static java.lang.String |
PROPERTY_NAME |
static java.lang.String |
PROPERTY_PERSISTENT |
static java.lang.String |
PROPERTY_PRIORITY |
static java.lang.String |
PROPERTY_READONLY |
static java.lang.String |
PROPERTY_RECEIVEKEYEVENTONHIDDEN |
static java.lang.String |
PROPERTY_RECEIVEMOUSEEVENTONHIDDEN |
Constructor and Description |
---|
Overlay(java.lang.String name) |
Overlay(java.lang.String name,
Overlay.OverlayPriority priority) |
Modifier and Type | Method and Description |
---|---|
void |
addOverlayListener(OverlayListener listener)
Add a listener.
|
void |
attachTo(Sequence sequence)
Deprecated.
Use
Sequence.addOverlay(Overlay) instead. |
void |
beginUpdate() |
void |
changed()
Deprecated.
Use
painterChanged() instead. |
int |
compareTo(Overlay o) |
static Overlay |
createFromXML(org.w3c.dom.Node node)
Create a Overlay from a XML node.
|
void |
detachFrom(Sequence sequence)
Deprecated.
Use
Sequence.removeOverlay(Overlay) instead. |
void |
endUpdate() |
java.util.List<IcyCanvas> |
getAttachedCanvas()
Returns all canvas where the overlay is currently present as a layer.
|
boolean |
getCanBeRemoved()
Returns
true if the overlay can be freely removed from the Canvas where it
appears and false otherwise. |
java.lang.String |
getName() |
javax.swing.JPanel |
getOptionsPanel()
Override this method to provide an extra options panel for the overlay.
|
static int |
getOverlayCount(org.w3c.dom.Node node)
Return the number of Overlay defined in the specified XML node.
|
Overlay.OverlayPriority |
getPriority() |
boolean |
getReceiveKeyEventOnHidden() |
boolean |
getReceiveMouseEventOnHidden() |
java.util.List<Sequence> |
getSequences()
Returns all sequences where the overlay is currently attached.
|
boolean |
isAttached(Sequence sequence)
Returns
true if the overlay is attached to the specified Sequence . |
boolean |
isFixed()
Deprecated.
Use
getCanBeRemoved() instead. |
boolean |
isPersistent()
Return persistent property.
|
boolean |
isReadOnly()
Return read only property.
|
boolean |
isUpdating() |
void |
keyPressed(java.awt.event.KeyEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
Use
keyPressed(KeyEvent, Point5D.Double, IcyCanvas) instead |
void |
keyPressed(java.awt.event.KeyEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Key press event forwarded to the overlay.
|
void |
keyReleased(java.awt.event.KeyEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
Use
keyReleased(KeyEvent, Point5D.Double, IcyCanvas) instead |
void |
keyReleased(java.awt.event.KeyEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Key release event forwarded to the overlay.
|
boolean |
loadFromXML(org.w3c.dom.Node node)
LOAD
|
boolean |
loadFromXML(org.w3c.dom.Node node,
boolean preserveId) |
static java.util.List<Overlay> |
loadOverlaysFromXML(org.w3c.dom.Node node)
Return a list of Overlay from a XML node.
|
void |
mouseClick(java.awt.event.MouseEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
|
void |
mouseClick(java.awt.event.MouseEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Mouse click event forwarded to the overlay.
|
void |
mouseDrag(java.awt.event.MouseEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
Use
mouseDrag(MouseEvent, Point5D.Double, IcyCanvas) instead |
void |
mouseDrag(java.awt.event.MouseEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Mouse drag event forwarded to the overlay.
|
void |
mouseEntered(java.awt.event.MouseEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
|
void |
mouseEntered(java.awt.event.MouseEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Mouse enter event forwarded to the overlay.
|
void |
mouseExited(java.awt.event.MouseEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
|
void |
mouseExited(java.awt.event.MouseEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Mouse exit event forwarded to the overlay.
|
void |
mouseMove(java.awt.event.MouseEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
Use
mouseMove(MouseEvent, Point5D.Double, IcyCanvas) instead |
void |
mouseMove(java.awt.event.MouseEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Mouse move event forwarded to the overlay.
|
void |
mousePressed(java.awt.event.MouseEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
|
void |
mousePressed(java.awt.event.MouseEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Mouse press event forwarded to the overlay.
|
void |
mouseReleased(java.awt.event.MouseEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
|
void |
mouseReleased(java.awt.event.MouseEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Mouse release event forwarded to the overlay.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e,
java.awt.geom.Point2D imagePoint,
IcyCanvas canvas)
Deprecated.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e,
Point5D.Double imagePoint,
IcyCanvas canvas)
Mouse wheel moved event forwarded to the overlay.
|
void |
onChanged(CollapsibleEvent object)
fire changed event
|
void |
paint(java.awt.Graphics2D g,
Sequence sequence,
IcyCanvas canvas)
Paint method called to draw the overlay.
|
void |
painterChanged()
Notify the painter content has changed.
|
void |
propertyChanged(java.lang.String propertyName)
Notify the overlay property has changed.
|
void |
remove()
Remove the Overlay from all sequences and canvas where it is currently attached.
|
void |
removeOverlayListener(OverlayListener listener)
Remove a listener.
|
static void |
saveOverlaysToXML(org.w3c.dom.Node node,
java.util.List<Overlay> overlays)
Set a list of Overlay to a XML node.
|
boolean |
saveToXML(org.w3c.dom.Node node)
SAVE
|
void |
setCanBeRemoved(boolean value)
Set the
canBeRemoved property. |
void |
setFixed(boolean value)
Deprecated.
Use
setCanBeRemoved(boolean) instead. |
void |
setName(java.lang.String name) |
void |
setPersistent(boolean value)
Set persistent property.
|
void |
setPriority(Overlay.OverlayPriority priority) |
void |
setReadOnly(boolean value)
Set read only property.
|
void |
setReceiveKeyEventOnHidden(boolean value)
Set to
true if you want to overlay to receive KeyEvent even when it is
not visible. |
void |
setReceiveMouseEventOnHidden(boolean value)
Set to
true if you want to overlay to receive KeyEvent even when it is
not visible. |
public static final java.lang.String ID_OVERLAY
public static final java.lang.String ID_CLASSNAME
public static final java.lang.String ID_ID
public static final java.lang.String ID_NAME
public static final java.lang.String ID_PRIORITY
public static final java.lang.String ID_READONLY
public static final java.lang.String ID_CANBEREMOVED
public static final java.lang.String ID_RECEIVEKEYEVENTONHIDDEN
public static final java.lang.String ID_RECEIVEMOUSEEVENTONHIDDEN
public static final java.lang.String PROPERTY_NAME
public static final java.lang.String PROPERTY_PRIORITY
public static final java.lang.String PROPERTY_READONLY
public static final java.lang.String PROPERTY_PERSISTENT
public static final java.lang.String PROPERTY_CANBEREMOVED
public static final java.lang.String PROPERTY_RECEIVEKEYEVENTONHIDDEN
public static final java.lang.String PROPERTY_RECEIVEMOUSEEVENTONHIDDEN
public static final int LOD_SMALL
public static final int LOD_TINY
public Overlay(java.lang.String name, Overlay.OverlayPriority priority)
public Overlay(java.lang.String name)
public static Overlay createFromXML(org.w3c.dom.Node node)
node
- XML node defining the overlaynull
if the Overlay class does not support XML
persistence a default
constructorpublic static int getOverlayCount(org.w3c.dom.Node node)
node
- XML node defining the Overlay listpublic static java.util.List<Overlay> loadOverlaysFromXML(org.w3c.dom.Node node)
node
- XML node defining the Overlay listpublic static void saveOverlaysToXML(org.w3c.dom.Node node, java.util.List<Overlay> overlays)
node
- XML node which is used to store the list of Overlayoverlays
- the list of Overlay to store in the XML nodepublic java.lang.String getName()
public void setName(java.lang.String name)
name
- the name to setpublic Overlay.OverlayPriority getPriority()
public void setPriority(Overlay.OverlayPriority priority)
priority
- the priority to setpublic boolean isAttached(Sequence sequence)
true
if the overlay is attached to the specified Sequence
.@Deprecated public boolean isFixed()
getCanBeRemoved()
instead.setCanBeRemoved(boolean)
@Deprecated public void setFixed(boolean value)
setCanBeRemoved(boolean)
instead.public boolean getCanBeRemoved()
true
if the overlay can be freely removed from the Canvas where it
appears and false
otherwise.setCanBeRemoved(boolean)
public void setCanBeRemoved(boolean value)
canBeRemoved
property.public boolean isPersistent()
true
the Overlay will be saved in the Sequence persistent XML data.public void setPersistent(boolean value)
true
the Overlay will be saved in the Sequence persistent XML data
(default is false
).public boolean isReadOnly()
true
we cannot anymore modify overlay properties from the GUI.public void setReadOnly(boolean value)
true
we cannot anymore modify overlay properties from the GUI.public boolean getReceiveKeyEventOnHidden()
true
is the overlay should receive KeyEvent
even when it is not
visible.public void setReceiveKeyEventOnHidden(boolean value)
true
if you want to overlay to receive KeyEvent
even when it is
not visible.public boolean getReceiveMouseEventOnHidden()
true
is the overlay should receive MouseEvent
even when it is
not visible.public void setReceiveMouseEventOnHidden(boolean value)
true
if you want to overlay to receive KeyEvent
even when it is
not visible.public javax.swing.JPanel getOptionsPanel()
@Deprecated public void attachTo(Sequence sequence)
Sequence.addOverlay(Overlay)
instead.@Deprecated public void detachFrom(Sequence sequence)
Sequence.removeOverlay(Overlay)
instead.public void remove()
public java.util.List<Sequence> getSequences()
public java.util.List<IcyCanvas> getAttachedCanvas()
public void beginUpdate()
public void endUpdate()
public boolean isUpdating()
@Deprecated public void changed()
painterChanged()
instead.public void painterChanged()
public void propertyChanged(java.lang.String propertyName)
public void onChanged(CollapsibleEvent object)
ChangeListener
onChanged
in interface ChangeListener
public void addOverlayListener(OverlayListener listener)
public void removeOverlayListener(OverlayListener listener)
public void paint(java.awt.Graphics2D g, Sequence sequence, IcyCanvas canvas)
@Deprecated public void mousePressed(java.awt.event.MouseEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
mousePressed(MouseEvent, Point5D.Double, IcyCanvas)
insteadPainter
mousePressed
in interface Painter
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvas@Deprecated public void mouseReleased(java.awt.event.MouseEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
mouseReleased(MouseEvent, Point5D.Double, IcyCanvas)
insteadPainter
mouseReleased
in interface Painter
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvas@Deprecated public void mouseClick(java.awt.event.MouseEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
mouseClick(MouseEvent, Point5D.Double, IcyCanvas)
insteadPainter
mouseClick
in interface Painter
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvas@Deprecated public void mouseMove(java.awt.event.MouseEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
mouseMove(MouseEvent, Point5D.Double, IcyCanvas)
insteadPainter
@Deprecated public void mouseDrag(java.awt.event.MouseEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
mouseDrag(MouseEvent, Point5D.Double, IcyCanvas)
insteadPainter
@Deprecated public void mouseEntered(java.awt.event.MouseEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
mouseEntered(MouseEvent, Point5D.Double, IcyCanvas)
instead@Deprecated public void mouseExited(java.awt.event.MouseEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
mouseExited(MouseEvent, Point5D.Double, IcyCanvas)
instead@Deprecated public void mouseWheelMoved(java.awt.event.MouseWheelEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
mouseWheelMoved(MouseWheelEvent, Point5D.Double, IcyCanvas)
instead@Deprecated public void keyPressed(java.awt.event.KeyEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
keyPressed(KeyEvent, Point5D.Double, IcyCanvas)
insteadPainter
keyPressed
in interface Painter
e
- key eventimagePoint
- mouse position (image coordinates)canvas
- icy canvas@Deprecated public void keyReleased(java.awt.event.KeyEvent e, java.awt.geom.Point2D imagePoint, IcyCanvas canvas)
keyReleased(KeyEvent, Point5D.Double, IcyCanvas)
insteadPainter
keyReleased
in interface Painter
e
- key eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void mousePressed(java.awt.event.MouseEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void mouseReleased(java.awt.event.MouseEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void mouseClick(java.awt.event.MouseEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void mouseMove(java.awt.event.MouseEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void mouseDrag(java.awt.event.MouseEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void mouseEntered(java.awt.event.MouseEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void mouseExited(java.awt.event.MouseEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void mouseWheelMoved(java.awt.event.MouseWheelEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- mouse eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void keyPressed(java.awt.event.KeyEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- key eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic void keyReleased(java.awt.event.KeyEvent e, Point5D.Double imagePoint, IcyCanvas canvas)
e
- key eventimagePoint
- mouse position (image coordinates)canvas
- icy canvaspublic boolean loadFromXML(org.w3c.dom.Node node, boolean preserveId)
public boolean loadFromXML(org.w3c.dom.Node node)
XMLPersistent
loadFromXML
in interface XMLPersistent
public boolean saveToXML(org.w3c.dom.Node node)
XMLPersistent
saveToXML
in interface XMLPersistent