de.lmu.ifi.dbs.elki.visualization.batikutil
Class DragableArea

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.visualization.batikutil.DragableArea
All Implemented Interfaces:
EventListener

public class DragableArea
extends Object
implements EventListener

A simple dragable area for Batik.


Nested Class Summary
static interface DragableArea.DragListener
          Listener interface for drag events.
 
Field Summary
protected  Element coordref
          The coordinate system node.
protected  Element element
          Our element node.
protected  DragableArea.DragListener listener
          A listener to notify on drags (when not subclassing).
protected  org.w3c.dom.svg.SVGPoint startDragPoint
          The point where the drag started.
protected  SVGPlot svgp
          The plot we are attached to.
 
Constructor Summary
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, 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, 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
 void destroy()
          Remove the listeners
 void disableStart()
          Disable capturing of 'mousedown' events.
protected  void disableStop()
          Disable capturing of 'mousemove' and 'mouseup' events.
protected  boolean duringDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, Event evt, boolean inside)
          Method called during drags.
 void enableStart()
          Enable capturing of 'mousedown' events.
protected  void enableStop()
          Enable capturing of 'mousemove' and 'mouseup' events.
protected  boolean endDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, Event evt, boolean inside)
          Method called when a drag was ended.
protected  org.w3c.dom.svg.SVGPoint getCoordinates(Event evt)
          Return the event coordinates for this event.
 Element getElement()
          The DOM element.
 void handleEvent(Event evt)
           
 void makeInvisible()
          Make the rectangle invisible.
 void makeVisible()
          Make the rectangle visible, for debug purposes.
protected  boolean startDrag(org.w3c.dom.svg.SVGPoint startPoint, Event evt)
          Action to do on drag start.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

protected final Element element
Our element node.


coordref

protected final 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 to
x - X position
y - Y position
w - Width
h - Height

DragableArea

public DragableArea(SVGPlot plot,
                    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 to
coordref - Element defining the coordinate system
x - X position
y - Y position
w - Width
h - 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 to
x - X position
y - Y position
w - Width
h - Height
listener - Drag listener

DragableArea

public DragableArea(SVGPlot plot,
                    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 to
coordref - Element defining the coordinate system
x - X position
y - Y position
w - Width
h - Height
listener - Drag listener
Method Detail

destroy

public void destroy()
Remove the listeners


getElement

public 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(Event evt)
Specified by:
handleEvent in interface EventListener

getCoordinates

protected org.w3c.dom.svg.SVGPoint getCoordinates(Event evt)
Return the event coordinates for this event.

Parameters:
evt - Event
Returns:
Coordinates

startDrag

protected boolean startDrag(org.w3c.dom.svg.SVGPoint startPoint,
                            Event evt)
Action to do on drag start.

Parameters:
startPoint - Point where the drag was started.
evt - The event object
Returns:
true to start the drag operation

duringDrag

protected boolean duringDrag(org.w3c.dom.svg.SVGPoint startPoint,
                             org.w3c.dom.svg.SVGPoint dragPoint,
                             Event evt,
                             boolean inside)
Method called during drags.

Parameters:
startPoint - Drag starting point
dragPoint - Drag end point
evt - The event object
inside - Inside the tracked element
Returns:
true to continue the drag

endDrag

protected boolean endDrag(org.w3c.dom.svg.SVGPoint startPoint,
                          org.w3c.dom.svg.SVGPoint dragPoint,
                          Event evt,
                          boolean inside)
Method called when a drag was ended.

Parameters:
startPoint - Drag starting point
dragPoint - Drag end point
evt - The event object
inside - Success flag
Returns:
true to complete the drag

makeInvisible

public void makeInvisible()
Make the rectangle invisible.


makeVisible

public void makeVisible()
Make the rectangle visible, for debug purposes.


Release 0.4.0 (2011-09-20_1324)