Java源码示例:com.lynden.gmapsfx.javascript.event.UIEventType
示例1
protected void configureMap() {
MapOptions mapOptions = new MapOptions();
mapOptions.center(new LatLong(47.6097, -122.3331))
.mapType(MapTypeIdEnum.ROADMAP)
.zoom(9);
map = googleMapView.createMap(mapOptions, false);
map.addMouseEventHandler(UIEventType.click, (GMapMouseEvent event) -> {
LatLong latLong = event.getLatLong();
latitudeLabel.setText(formatter.format(latLong.getLatitude()));
longitudeLabel.setText(formatter.format(latLong.getLongitude()));
});
}
示例2
/**
* Adds a handler for a mouse type event on the map.
*
* @param obj The object that the event should be registered on.
* @param type Type of the event to register against.
* @param h Handler that will be called when the event occurs.
*/
public void addUIEventHandler(JavascriptObject obj, UIEventType type, UIEventHandler h) {
String key = registerEventHandler(h);
String mcall = "google.maps.event.addListener(" + obj.getVariableName() + ", '" + type.name() + "', "
+ "function(event) {document.jsHandlers.handleUIEvent('" + key + "', event);});";//.latLng
//System.out.println("addUIEventHandler mcall: " + mcall);
runtime.execute(mcall);
}
示例3
public void addMarkers(Collection<Marker> col, UIEventType type, Callback<Marker, UIEventHandler> h) {
if (markers == null) {
markers = new HashSet<>(col);
} else {
markers.addAll(col);
}
col.forEach((m) -> {
m.setMap(this);
addUIEventHandler(m, type, h.call(m));
});
}
示例4
protected void addUIHandler(JavascriptObject obj, UIEventType type, GFXEventHandler h) {
String key = registerEventHandler(h);
String mcall = "google.maps.event.addListener(" + obj.getVariableName() + ", '" + type.name() + "', "
+ "function(event) {document.jsHandlers.handleUIEvent('" + key + "', event);});";//.latLng
//System.out.println("addUIEventHandler mcall: " + mcall);
runtime.execute(mcall);
}
示例5
/**
* Adds a handler for a mouse type event on the map.
*
* @param type Type of the event to register against.
* @param h Handler that will be called when the event occurs.
*/
public void addUIEventHandler(UIEventType type, UIEventHandler h) {
this.addUIEventHandler(this, type, h);
}
示例6
/**
* Adds a handler for a mouse type event on the map.
*
* @param type Type of the event to register against.
* @param h Handler that will be called when the event occurs.
*/
public void addUIEventHandler(UIEventType type, UIEventHandler h) {
this.addUIEventHandler(this, type, h);
}
示例7
/**
* Adds a handler for a mouse type event on the map.
*
* @param obj The object that the event should be registered on.
* @param type Type of the event to register against.
* @param h Handler that will be called when the event occurs.
*/
public void addUIEventHandler(JavascriptObject obj, UIEventType type, UIEventHandler h) {
addUIHandler(obj, type, h);
}
示例8
/**
* Adds a handler for a mouse type event and returns an object that does not require interaction with
* the underlying Javascript API.
*
* @param type The type of event to listen for
* @param h The MouseEventHandler that will handle the event.
*/
public void addMouseEventHandler(UIEventType type, MouseEventHandler h) {
addUIHandler(this, type, h);
}