An instance of this class is assigned to the document model so that Javascript can access it to make callbacks when events occur.
An application calls on one of the two addXXEventHandler methods in the
com. class to register an
instance of the GFXEventHandler interface against a certain event
type in the Google Maps event model. See addUIEventHandler and
addStateEventHandler.
This class uses a key based on a UUID to map the Javascript event handlers registered against the Google Maps model back to our Java event handlers stored here. The addXXEventHandler methods in GoogleMap create functions that call back into this class using the supplied key.
Currently an instance of this class is registered as:
document.jsHandlers
The event listeners are established using the following Javascript calls:
com.
google.maps.event.addListener(map, 'event_type', function(event) { document.jsHandlers.handleUIEvent('key', event.latLng); });
com.
google.maps.event.addListener(map, 'event_type', function() { document.jsHandlers.handleStateEvent('key'); });
| Modifier and Type | Field and Description |
|---|---|
| private final Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected GMapMouseEvent | buildMouseEvent(JSObject jsObject)
References Deprecated
JSObject is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public void | handleStateEvent(String
Key generated by the call to registerHandler. callbackKey)This method is called from Javascript, passing in the previously created callback key. |
| public void | handleUIEvent(String
Key generated by the call to registerHandler. callbackKey, JSObject Currently the event object from the Google Maps event. result)
References Deprecated
JSObject is deprecated or references (maybe indirectly) at least one deprecated element.
This method is called from Javascript, passing in the previously created callback key, and the event object. |
| public String | Returns: A String random UUID that can be used as the callback key.Handler to be registered. handler)Registers a handler and returns the callback key to be passed to Javascript. |
| handlers | back to summary |
|---|---|
| private final Map<String, GFXEventHandler> handlers | |
| EventHandlers | back to summary |
|---|---|
| public EventHandlers() | |
| buildMouseEvent | back to summary |
|---|---|
| protected GMapMouseEvent buildMouseEvent(JSObject jsObject)
References Deprecated
See corresponding docs for further information. | |
| handleStateEvent | back to summary |
|---|---|
| public void handleStateEvent(String callbackKey) This method is called from Javascript, passing in the previously created callback key. It uses that to find the correct handler and then passes on the call. State events in the Google Maps API don't pass any parameters.
| |
| handleUIEvent | back to summary |
|---|---|
| public void handleUIEvent(String callbackKey, JSObject result)
References Deprecated
See corresponding docs for further information. This method is called from Javascript, passing in the previously created callback key, and the event object. The current implementation is receiving the LatLng object that the Javascript MouseEvent contains. It may be more useful to return the MouseEvent and let clients go from there, but there is only the stop() method on the MouseEvent? | |
| registerHandler | back to summary |
|---|---|
| public String registerHandler(GFXEventHandler handler) Registers a handler and returns the callback key to be passed to Javascript.
| |