com.lamatek.beans.google
Class DefaultEventListenerBean

java.lang.Object
  extended by com.lamatek.beans.google.DefaultEventListenerBean
All Implemented Interfaces:
GoogleMapEventHandler

public class DefaultEventListenerBean
extends java.lang.Object
implements GoogleMapEventHandler

DefaultEventListenerBean This class is the parent class for all bean 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 the page containing your subclass of DefaultEventListenerBean as the url attribute. This will typically be the same page the contains the map. Using this method, most Google Map applications can be written using just one .jsp page and one bean. 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 Servlet event listening.

Version:
0.40
Author:
Tom Cole
See Also:
DefaultEventListenerServlet

Constructor Summary
DefaultEventListenerBean()
           
 
Method Summary
 PageContext getPageContext()
          Returns the pageContext responsible for this bean.
 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.
 void setPageContext(PageContext page)
          Sets the pageContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEventListenerBean

public DefaultEventListenerBean()
Method Detail

setPageContext

public void setPageContext(PageContext page)
Sets the pageContext. Developers should not override this method. If users override this method they must call super.setPageContext() or else this bean will not function as expected.

Parameters:
page - The PageContext that loads this bean.

getPageContext

public PageContext getPageContext()
Returns the pageContext responsible for this bean.

Returns:
PageContext

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 (marker, box, circle, 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 (marker, circle, box, 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).