vanetsim.gui.helpers
Class MouseClickManager

java.lang.Object
  extended by java.lang.Thread
      extended by vanetsim.gui.helpers.MouseClickManager
All Implemented Interfaces:
java.lang.Runnable

public final class MouseClickManager
extends java.lang.Thread

A class to correctly handle mouseclicks and drags on the DrawingArea. Furthermore, this class also handles the display in the information text area.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 boolean active_
          true if this manager currently is active,false if it's inactive.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 void cleanMarkings()
          Cleans markings so that objects can be deleted through garbage collector.
static MouseClickManager getInstance()
          Gets the single instance of this manager.
 void run()
          The thread which handles mouse drags and information display.
 void setActive(boolean active)
          Sets the value for the isActive variable.
 void setDrawArea(DrawingArea drawArea)
          Sets the DrawingArea this MouseClickManager is associated with.
 void signalPressed(int x, int y)
          Signals this manager that the mouse was pressed.
 void signalReleased(int x, int y)
          Signals this manager that the mouse was released (used for dragging).
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

active_

public boolean active_
true if this manager currently is active,false if it's inactive.

Method Detail

getInstance

public static MouseClickManager getInstance()
Gets the single instance of this manager.

Returns:
single instance of this manager

setActive

public void setActive(boolean active)
Sets the value for the isActive variable.

Parameters:
active - true to signal this thread that the DrawingArea has been entered,false to signal that the area was left

setDrawArea

public void setDrawArea(DrawingArea drawArea)
Sets the DrawingArea this MouseClickManager is associated with.

Parameters:
drawArea - the area on which this MouseClickManager operates

signalPressed

public void signalPressed(int x,
                          int y)
Signals this manager that the mouse was pressed. If the edit mode is currently active, the click is forwarded to the edit panel.

Parameters:
x - the x coordinate where mouse was pressed
y - the y coordinate where mouse was pressed

signalReleased

public void signalReleased(int x,
                           int y)
Signals this manager that the mouse was released (used for dragging).

Parameters:
x - the x coordinate where mouse was released
y - the y coordinate where mouse was released

cleanMarkings

public void cleanMarkings()
Cleans markings so that objects can be deleted through garbage collector.


run

public void run()
The thread which handles mouse drags and information display.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.run()