Package elki.visualization.batikutil
Class DragableArea
- java.lang.Object
-
- elki.visualization.batikutil.DragableArea
-
- All Implemented Interfaces:
org.w3c.dom.events.EventListener
public class DragableArea extends java.lang.Object implements org.w3c.dom.events.EventListenerA simple dragable area for Batik.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDragableArea.DragListenerListener interface for drag events.
-
Field Summary
Fields Modifier and Type Field Description protected org.w3c.dom.ElementcoordrefThe coordinate system node.protected org.w3c.dom.ElementelementOur element node.protected DragableArea.DragListenerlistenerA listener to notify on drags (when not subclassing).protected org.w3c.dom.svg.SVGPointstartDragPointThe point where the drag started.protected SVGPlotsvgpThe plot we are attached to.
-
Constructor Summary
Constructors Constructor Description DragableArea(SVGPlot plot, double x, double y, double w, double h)Constructor for a dragable area. use getElement() to get the DOM node.DragableArea(SVGPlot plot, double x, double y, double w, double h, DragableArea.DragListener listener)Constructor for a dragable area. use getElement() to get the DOM node.DragableArea(SVGPlot plot, org.w3c.dom.Element coordref, double x, double y, double w, double h)Constructor for a dragable area. use getElement() to get the DOM node.DragableArea(SVGPlot plot, org.w3c.dom.Element coordref, double x, double y, double w, double h, DragableArea.DragListener listener)Constructor for a dragable area. use getElement() to get the DOM node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Remove the listenersvoiddisableStart()Disable capturing of 'mousedown' events.protected voiddisableStop()Disable capturing of 'mousemove' and 'mouseup' events.protected booleanduringDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, org.w3c.dom.events.Event evt, boolean inside)Method called during drags.voidenableStart()Enable capturing of 'mousedown' events.protected voidenableStop()Enable capturing of 'mousemove' and 'mouseup' events.protected booleanendDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, org.w3c.dom.events.Event evt, boolean inside)Method called when a drag was ended.protected org.w3c.dom.svg.SVGPointgetCoordinates(org.w3c.dom.events.Event evt)Return the event coordinates for this event.org.w3c.dom.ElementgetElement()The DOM element.voidhandleEvent(org.w3c.dom.events.Event evt)voidmakeInvisible()Make the rectangle invisible.voidmakeVisible()Make the rectangle visible, for debug purposes.protected booleanstartDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.events.Event evt)Action to do on drag start.
-
-
-
Field Detail
-
element
protected final org.w3c.dom.Element element
Our element node.
-
coordref
protected final org.w3c.dom.Element coordref
The coordinate system node.
-
svgp
protected final SVGPlot svgp
The plot we are attached to.
-
startDragPoint
protected org.w3c.dom.svg.SVGPoint startDragPoint
The point where the drag started.
-
listener
protected DragableArea.DragListener listener
A listener to notify on drags (when not subclassing).
-
-
Constructor Detail
-
DragableArea
public DragableArea(SVGPlot plot, double x, double y, double w, double h)
Constructor for a dragable area. use getElement() to get the DOM node.Note: always remember to call 'destroy()' to remove listeners!
- Parameters:
plot- Plot we'll be added tox- X positiony- Y positionw- Widthh- Height
-
DragableArea
public DragableArea(SVGPlot plot, org.w3c.dom.Element coordref, double x, double y, double w, double h)
Constructor for a dragable area. use getElement() to get the DOM node.Note: always remember to call 'destroy()' to remove listeners!
- Parameters:
plot- Plot we'll be added tocoordref- Element defining the coordinate systemx- X positiony- Y positionw- Widthh- Height
-
DragableArea
public DragableArea(SVGPlot plot, double x, double y, double w, double h, DragableArea.DragListener listener)
Constructor for a dragable area. use getElement() to get the DOM node.Note: always remember to call 'destroy()' to remove listeners!
- Parameters:
plot- Plot we'll be added tox- X positiony- Y positionw- Widthh- Heightlistener- Drag listener
-
DragableArea
public DragableArea(SVGPlot plot, org.w3c.dom.Element coordref, double x, double y, double w, double h, DragableArea.DragListener listener)
Constructor for a dragable area. use getElement() to get the DOM node.Note: always remember to call 'destroy()' to remove listeners!
- Parameters:
plot- Plot we'll be added tocoordref- Element defining the coordinate systemx- X positiony- Y positionw- Widthh- Heightlistener- Drag listener
-
-
Method Detail
-
destroy
public void destroy()
Remove the listeners
-
getElement
public org.w3c.dom.Element getElement()
The DOM element.- Returns:
- the element
-
enableStart
public void enableStart()
Enable capturing of 'mousedown' events.
-
disableStart
public void disableStart()
Disable capturing of 'mousedown' events.
-
enableStop
protected void enableStop()
Enable capturing of 'mousemove' and 'mouseup' events.
-
disableStop
protected void disableStop()
Disable capturing of 'mousemove' and 'mouseup' events.
-
handleEvent
public void handleEvent(org.w3c.dom.events.Event evt)
- Specified by:
handleEventin interfaceorg.w3c.dom.events.EventListener
-
getCoordinates
protected org.w3c.dom.svg.SVGPoint getCoordinates(org.w3c.dom.events.Event evt)
Return the event coordinates for this event.- Parameters:
evt- Event- Returns:
- Coordinates
-
startDrag
protected boolean startDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.events.Event evt)Action to do on drag start.- Parameters:
startPoint- Point where the drag was started.evt- The event object- Returns:
trueto start the drag operation
-
duringDrag
protected boolean duringDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, org.w3c.dom.events.Event evt, boolean inside)Method called during drags.- Parameters:
startPoint- Drag starting pointdragPoint- Drag end pointevt- The event objectinside- Inside the tracked element- Returns:
trueto continue the drag
-
endDrag
protected boolean endDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, org.w3c.dom.events.Event evt, boolean inside)Method called when a drag was ended.- Parameters:
startPoint- Drag starting pointdragPoint- Drag end pointevt- The event objectinside- Success flag- Returns:
trueto complete the drag
-
makeInvisible
public void makeInvisible()
Make the rectangle invisible.
-
makeVisible
public void makeVisible()
Make the rectangle visible, for debug purposes.
-
-