com.nutiteq.listeners
Class DelayedMapListener

java.lang.Object
  extended by java.lang.Thread
      extended by com.nutiteq.listeners.DelayedMapListener
All Implemented Interfaces:
MapListener, java.lang.Runnable

public class DelayedMapListener
extends java.lang.Thread
implements MapListener

This class implements a delayed map listener that can be used as a wrapper for another map listener. It waits a few seconds before triggering mapMoved in the wrapped listener. This allows for quick map moves without calling mapMoved after each one.

Author:
CristiS

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DelayedMapListener(MapListener listener)
          Constructor for DelayedMapListener.
DelayedMapListener(MapListener listener, int mapDelay, int timeoutInterval)
          Constructor for DelayedMapListener.
 
Method Summary
 void mapClicked(WgsPoint point)
          Called when a point on the map is clicked (when place is not selected).
 void mapMoved()
          Called after map has been moved.
 void needRepaint(boolean mapIsComplete)
          Called when the map is changed in some way and repaint needs to be called on the container object.
 void run()
          Main thread method.
 void setTimeoutInterval(int timeoutInterval)
          Set the timeout interval.
 
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
 

Constructor Detail

DelayedMapListener

public DelayedMapListener(MapListener listener)
Constructor for DelayedMapListener.

Parameters:
listener - wrapped listener

DelayedMapListener

public DelayedMapListener(MapListener listener,
                          int mapDelay,
                          int timeoutInterval)
Constructor for DelayedMapListener.

Parameters:
listener - wrapped listener
mapDelay - delay introduced before calling mapMoved in the wrapped listener.
timeoutInterval - timeout interval. If a map move does not occur within this interval, mapMoved is triggered anyway. Useful for services that should dynamically update map content even if the user doesn't move. If set to zero (by default) this behavior is disabled.
Method Detail

mapClicked

public void mapClicked(WgsPoint point)
Description copied from interface: MapListener
Called when a point on the map is clicked (when place is not selected).

Specified by:
mapClicked in interface MapListener
Parameters:
point - point clicked in WGS84

mapMoved

public void mapMoved()
Description copied from interface: MapListener
Called after map has been moved.

Specified by:
mapMoved in interface MapListener

needRepaint

public void needRepaint(boolean mapIsComplete)
Description copied from interface: MapListener
Called when the map is changed in some way and repaint needs to be called on the container object.

Specified by:
needRepaint in interface MapListener
Parameters:
mapIsComplete - is current map view complete (if FALSE, then some map tiles are not yet downloaded)

run

public void run()
Main thread method.

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

setTimeoutInterval

public void setTimeoutInterval(int timeoutInterval)
Set the timeout interval.

Parameters:
timeoutInterval - new timeout interval