schmitzm.geotools.gui
Class MouseSelectionTracker

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by javax.swing.event.MouseInputAdapter
          extended by skrueger.geotools.MouseSelectionTracker
              extended by schmitzm.geotools.gui.MouseSelectionTracker
All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener, MouseInputListener
Direct Known Subclasses:
ChartMouseSelectionTracker

public abstract class MouseSelectionTracker
extends MouseSelectionTracker

Extends the geotools org.geotools.swing.MouseSelectionTracker with an enable/disable functionality. Furthermore the tracker (optionally) also reacts on single clicks.

Author:
Martin Schmitz
See Also:
setSelectionMode(SelectionMode)

Nested Class Summary
static class MouseSelectionTracker.SelectionMode
          Selection events the tracker reacts on.
 
Field Summary
protected  boolean enabled
          Indicates whether the tracker reacts on mouse events.
protected  MouseSelectionTracker.SelectionMode selectionMode
          Specifies the selection events the tracker reacts on.
 
Constructor Summary
MouseSelectionTracker()
          Creates a new tracker, which reacts only on window selection events (default geotools behavior for org.geotools.swing.MouseSelectionTracker).
MouseSelectionTracker(MouseSelectionTracker.SelectionMode mode)
          Creates a new tracker.
 
Method Summary
 MouseSelectionTracker.SelectionMode getSelectionMode()
          Returns the selection events the tracker reacts on.
 boolean isEnabled()
          Returns whether the tracker reacts on mouse events or not.
 void mouseClicked(MouseEvent e)
          Ignores the event if tracker is disabled or selection mode is MouseSelectionTracker.SelectionMode.ONLY_WINDOW_SELECTION.
 void mouseDragged(MouseEvent e)
          Ignores the event if tracker is disabled or selection mode is MouseSelectionTracker.SelectionMode.ONLY_SINGLE_CLICK, so that the dragging rectangle is not drawn.
 void mouseEntered(MouseEvent e)
          Ignores the event if tracker is disabled.
 void mouseExited(MouseEvent e)
          Ignores the event if tracker is disabled.
 void mouseMoved(MouseEvent e)
          Ignores the event if tracker is disabled.
 void mousePressed(MouseEvent e)
          Ignores the event if tracker is disabled.
 void mouseReleased(MouseEvent e)
          Ignores the event if tracker is disabled.
 void setEnabled(boolean enabled)
          Sets whether the tracker reacts on mouse events or not.
 void setSelectionMode(MouseSelectionTracker.SelectionMode mode)
          Sets the selection events the tracker reacts on.
 
Methods inherited from class skrueger.geotools.MouseSelectionTracker
getModel, getSelectedArea, selectionPerformed, setXORColors
 
Methods inherited from class java.awt.event.MouseAdapter
mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

protected boolean enabled
Indicates whether the tracker reacts on mouse events.


selectionMode

protected MouseSelectionTracker.SelectionMode selectionMode
Specifies the selection events the tracker reacts on.

Constructor Detail

MouseSelectionTracker

public MouseSelectionTracker()
Creates a new tracker, which reacts only on window selection events (default geotools behavior for org.geotools.swing.MouseSelectionTracker).


MouseSelectionTracker

public MouseSelectionTracker(MouseSelectionTracker.SelectionMode mode)
Creates a new tracker.

Parameters:
mode - specifies the selection events the tracker reacts on
Method Detail

isEnabled

public boolean isEnabled()
Returns whether the tracker reacts on mouse events or not.


setEnabled

public void setEnabled(boolean enabled)
Sets whether the tracker reacts on mouse events or not.


setSelectionMode

public void setSelectionMode(MouseSelectionTracker.SelectionMode mode)
Sets the selection events the tracker reacts on.

Parameters:
mode - the mode to set

getSelectionMode

public MouseSelectionTracker.SelectionMode getSelectionMode()
Returns the selection events the tracker reacts on.


mouseClicked

public void mouseClicked(MouseEvent e)
Ignores the event if tracker is disabled or selection mode is MouseSelectionTracker.SelectionMode.ONLY_WINDOW_SELECTION. Otherwise MouseSelectionTracker.selectionPerformed(int, int, int, int) is called for the selected point.

Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked in class MouseAdapter

mouseEntered

public void mouseEntered(MouseEvent e)
Ignores the event if tracker is disabled. Otherwise the super method is called.

Specified by:
mouseEntered in interface MouseListener
Overrides:
mouseEntered in class MouseAdapter

mouseExited

public void mouseExited(MouseEvent e)
Ignores the event if tracker is disabled. Otherwise the super method is called.

Specified by:
mouseExited in interface MouseListener
Overrides:
mouseExited in class MouseAdapter

mousePressed

public void mousePressed(MouseEvent e)
Ignores the event if tracker is disabled. Otherwise the super method is called.

Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class MouseSelectionTracker

mouseReleased

public void mouseReleased(MouseEvent e)
Ignores the event if tracker is disabled. Otherwise the super method is called.

Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class MouseSelectionTracker

mouseDragged

public void mouseDragged(MouseEvent e)
Ignores the event if tracker is disabled or selection mode is MouseSelectionTracker.SelectionMode.ONLY_SINGLE_CLICK, so that the dragging rectangle is not drawn.

Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class MouseSelectionTracker

mouseMoved

public void mouseMoved(MouseEvent e)
Ignores the event if tracker is disabled. Otherwise the super method is called.

Specified by:
mouseMoved in interface MouseMotionListener
Overrides:
mouseMoved in class MouseSelectionTracker