com.lamatek.servlets.google
Class DefaultEventListenerServlet

java.lang.Object
  extended by HttpServlet
      extended by com.lamatek.servlets.google.DefaultEventListenerServlet
All Implemented Interfaces:
GoogleMapEventHandler

public class DefaultEventListenerServlet
extends HttpServlet
implements GoogleMapEventHandler

DefaultEventListenerServlet This class is the parent class for all servlet based event listeners for the <googlemaps> JSP Taglibrary. It provides support for all the events available. When declaring <googlemaps:event> tags in your map, pass the URL to your subclass of DefaultEventListenerServlet as the url attribute. Users extending this class should override the methods for the event types they're interested in. It is also recommended that the user first call super.processXXXEvent() for the method to ensure standard map behaviour. The standard process method is called after all event based centric methods have been called and gives the user the opportunity to handle other non-event based interactions in the same class. Using this method, it is quite possible to cleanly handle the interactions for an entire application in one handler. Users may also opt to use the JavaBean event listening.

Version:
0.40
Author:
Tom Cole
See Also:
DefaultEventListenerBean

Constructor Summary
DefaultEventListenerServlet()
           
 
Method Summary
 void doGet(HttpServletRequest request, HttpServletResponse response)
          Overrides doGet from HttpServlet.
 void process(GoogleMapTag map, ServletRequest request)
          This method is called after all the event based methods have been called.
 void processClickEvent(GoogleMapTag map, double longitude, double latitude)
          This method is called when a click event is detected that was generated by a GoogleMapTag (<googlemaps:map>).
 void processDoubleClickEvent(GoogleMapTag map, double longitude, double latitude)
          This method is called when a double-click event is detected that was generated by a GoogleMapTag (<googlemaps:map>).
 void processMapTypeChangedEvent(GoogleMapTag map, java.lang.String type)
          This method is called when a maptypechanged event is detected.
 void processMoveEndEvent(GoogleMapTag map, double longitude, double latitude)
          This method is called when a moveend event is detected.
 void processOverlayClickEvent(GoogleMapTag map, java.lang.String id, java.lang.String type)
          This method is called if a click event is detected that was generated by an overlay (box, circle, marker, polygon, polyline).
 void processOverlayDoubleClickEvent(GoogleMapTag map, java.lang.String id, java.lang.String type)
          This method is called when a double-click event is detected that was generated by an overlay (box, circle, marker, polygon, polyline).
 void processZoomEvent(GoogleMapTag map, int zoom)
          This method is called when a zoom event is detected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEventListenerServlet

public DefaultEventListenerServlet()
Method Detail

doGet

public void doGet(HttpServletRequest request,
                  HttpServletResponse response)
           throws ServletException,
                  java.io.IOException
Overrides doGet from HttpServlet. Users should not override this method. Rather override the method that handles the event(s) you're interested in. You can handle non-event related requests through the process() method.

Parameters:
request - HttpServletRequest
response - HttpServletResponse
Throws:
ServletException
java.io.IOException

process

public void process(GoogleMapTag map,
                    ServletRequest request)
This method is called after all the event based methods have been called. Developers can use this method to handle non-event based requests. The default implementation is empty to there is no need to call super.process().

Specified by:
process in interface GoogleMapEventHandler
Parameters:
map - The GoogleMapTag that generated the event.
request - The original ServletRequest.

processOverlayClickEvent

public void processOverlayClickEvent(GoogleMapTag map,
                                     java.lang.String id,
                                     java.lang.String type)
This method is called if a click event is detected that was generated by an overlay (box, circle, marker, polygon, polyline). The default implementation is empty so there is no need to call super.processMarkerClickEvent().

Specified by:
processOverlayClickEvent in interface GoogleMapEventHandler
Parameters:
map - The GoogleMapTag parent of the marker clicked.
id - The id of the overlay that was clicked.
type - The type of overlay clicked (box, circle, marker, polygon, polyline)

processClickEvent

public void processClickEvent(GoogleMapTag map,
                              double longitude,
                              double latitude)
This method is called when a click event is detected that was generated by a GoogleMapTag (<googlemaps:map>). The default implementation of this method is empty so there is no need to call super.processClickEvent().

Specified by:
processClickEvent in interface GoogleMapEventHandler
Parameters:
map - The GoogleMapTag that generated the event.
longitude - The longitude (in decimal form) where the click occured.
latitude - The latitude (in decimal form) where the click occured.

processOverlayDoubleClickEvent

public void processOverlayDoubleClickEvent(GoogleMapTag map,
                                           java.lang.String id,
                                           java.lang.String type)
This method is called when a double-click event is detected that was generated by an overlay (box, circle, marker, polygon, polyline). The default implementation of this method is empty so there is no need to call super.processMarkerDoubleClickEvent().

Specified by:
processOverlayDoubleClickEvent in interface GoogleMapEventHandler
Parameters:
map - The GoogleMapTag parent of the marker double-clicked.
id - The id of the overlay double-clicked.
type - The type of overlay double-clicked (box, circle, marker, polygon, polyline)

processDoubleClickEvent

public void processDoubleClickEvent(GoogleMapTag map,
                                    double longitude,
                                    double latitude)
This method is called when a double-click event is detected that was generated by a GoogleMapTag (<googlemaps:map>). The default implementation of this method is empty so there is no need to call super.processDoubleClickEvent().

Specified by:
processDoubleClickEvent in interface GoogleMapEventHandler
Parameters:
map - The GoogleMapTag that generated the event.
longitude - The longitude (in decimal form) where the double-click occured.
latitude - The latitude (in decimal form) where the double-click occured.

processZoomEvent

public void processZoomEvent(GoogleMapTag map,
                             int zoom)
This method is called when a zoom event is detected. The default implementation of this method simulates the default behaviour of a Google Map and any subclasses should call super.processZoomEvent() to ensure consistent behaviour.

Specified by:
processZoomEvent in interface GoogleMapEventHandler
Parameters:
map - The GoogleMapTag that generated the event.
zoom - The new requested zoom level.

processMoveEndEvent

public void processMoveEndEvent(GoogleMapTag map,
                                double longitude,
                                double latitude)
This method is called when a moveend event is detected. The default implementation of this method simulates the default behaviour of a Google Map and any subclasses should call super.processMoveEndEvent() to ensure consistent behaviour.

Specified by:
processMoveEndEvent in interface GoogleMapEventHandler
Parameters:
map - The GoogleMapTag that generated the event.
longitude - The new center longitude (in decimal form).
latitude - The new center latitude (in decimal form).

processMapTypeChangedEvent

public void processMapTypeChangedEvent(GoogleMapTag map,
                                       java.lang.String type)
This method is called when a maptypechanged event is detected. The default implementation of this method simulates the default behaviour of a Google Map and any subclasses should call super.processMapTypeChangedEvent() to ensure consistent behaviour.

Specified by:
processMapTypeChangedEvent in interface GoogleMapEventHandler
Parameters:
map - The GoogleMapTag that generated the event.
type - The new requested map type (map | satellite | hybrid).