org.gwtopenmaps.openlayers.client.event
Class EventHandler

java.lang.Object
  extended by org.gwtopenmaps.openlayers.client.event.EventHandler

public abstract class EventHandler
extends Object

Event handlers should be concrete extensions of this abstract class. The onHandle method of a handlers gets called when an event fires to which the handler is registered. See below, for a more convenient way to listen to events.

An event handler can be registered in the following way:

     map.getEvents().register("addlayer", map, new EventHandler()
     {
         public void onHandle(EventObject eventObject)
         {
             //handler code here
         }
     });
 

Consult the OpenLayers API documentation at the OpenLayers site to see which objects fire events (e.g. Map, Layer, etc) and which events they fire (e.g. "addlayer" fired by Map).

GWT OpenLayers provides a higher level way to register events through addXxxListener methods, which are easier to use, and which provide type-safety. However, these may not be implemented for all events in OpenLayers. The addXxxListener methods are methods on the Object firing the event:

     map.addMapMoveListener(new MapMoveListener()
     {
         public void onMapMove(MapMoveEvent eventObject)
         {
             //handler code here
         }
     })
 

Author:
Erdem Gunay, Edwin Commandeur

Constructor Summary
EventHandler()
           
 
Method Summary
 JSObject getJSObject()
           
abstract  void onHandle(EventObject eventObject)
          This method is called on the EventHandler when the event fires that the handler is registered for.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventHandler

public EventHandler()
Method Detail

onHandle

public abstract void onHandle(EventObject eventObject)
This method is called on the EventHandler when the event fires that the handler is registered for.

Parameters:
eventObject - - an event object that is passed by OpenLayers when the event is fired (see also EventObject).

getJSObject

public JSObject getJSObject()
Returns:
the actual handler (a javascript object)


Copyright © 2011 sourceforge. All Rights Reserved.