uk.ac.starlink.diva
Class DragRegion

java.lang.Object
  extended by diva.canvas.interactor.AbstractInteractor
      extended by diva.canvas.interactor.DragInteractor
          extended by diva.canvas.interactor.SelectionDragger
              extended by uk.ac.starlink.diva.DragRegion
All Implemented Interfaces:
LayerListener, LayerMotionListener, Interactor, EventListener

public class DragRegion
extends SelectionDragger

A class that implements rubber-banding on a canvas. It contains references to one or more instances of SelectionInteractor, which it notifies whenever dragging includes or excludes a figure in the given layers (which can be from a GraphicsPane) and additionally (which is the reason for this class to be used instead of SelectionDragger) informs any FigureListeners when the region is released (uses of this are expected to be when creating figures and zooming the plot).

Version:
$Id$
Author:
Peter W. Draper
See Also:
SelectionDragger

Field Summary
protected  EventListenerList listeners
           
 
Fields inherited from class diva.canvas.interactor.SelectionDragger
_rubberBand
 
Constructor Summary
DragRegion()
          Create a new DragRegion.
DragRegion(GraphicsPane gpane)
          Create a new DragRegion attached to the given graphics pane.
 
Method Summary
 void addListener(FigureListener l)
          Registers a listener for to be informed when figure changes occur.
protected  void fireCompleted(LayerEvent le)
          Send an event to all FigureListeners that this pseudo-figure has completed its work.
 Rectangle2D getFinalShape()
          Get shape of rectangle when released.
 void mouseReleased(LayerEvent event)
          Delete the rubber-band.
 void removeListener(FigureListener l)
          Remove a listener.
 
Methods inherited from class diva.canvas.interactor.SelectionDragger
addSelectionInteractor, clearSelection, contractSelection, expandSelection, getEventLayer, getFigureLayer, getOverlayLayer, getSelectionFilter, getToggleFilter, mouseDragged, mousePressed, removeSelectionInteractor, selectionInteractors, setEventLayer, setFigureLayer, setOverlayLayer, setSelectionFilter, setToggleFilter, terminateDragSelection
 
Methods inherited from class diva.canvas.interactor.DragInteractor
addLayerListener, appendConstraint, constrainPoint, fireLayerEvent, getSelectiveEnabled, getTargetArray, getX, getY, prependConstraint, removeLayerListener, setSelectiveEnabled, setTargetArray, setup, targets, translate
 
Methods inherited from class diva.canvas.interactor.AbstractInteractor
accept, getMouseFilter, isConsuming, isEnabled, isMotionEnabled, mouseClicked, mouseEntered, mouseExited, mouseMoved, setConsuming, setEnabled, setMotionEnabled, setMouseFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected EventListenerList listeners
Constructor Detail

DragRegion

public DragRegion()
Create a new DragRegion.


DragRegion

public DragRegion(GraphicsPane gpane)
Create a new DragRegion attached to the given graphics pane.

Method Detail

mouseReleased

public void mouseReleased(LayerEvent event)
Delete the rubber-band. Inform any FigureListeners of this.

Specified by:
mouseReleased in interface LayerListener
Overrides:
mouseReleased in class SelectionDragger

getFinalShape

public Rectangle2D getFinalShape()
Get shape of rectangle when released.


addListener

public void addListener(FigureListener l)
Registers a listener for to be informed when figure changes occur.

Parameters:
l - the FigureListener

removeListener

public void removeListener(FigureListener l)
Remove a listener.

Parameters:
l - the FigureListener

fireCompleted

protected void fireCompleted(LayerEvent le)
Send an event to all FigureListeners that this pseudo-figure has completed its work. The event that trigger this is passed along so that the MouseEvent features may be queried.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.