A Google map. To use this control, you must configure the control's key
property with a valid Google Maps API key. For more information, see Google Maps API Family. When registering a key, you must specify the host name and port number of the server. Use the host name and port number the user can see in the browser address bar when accessing the portlet or Web application. For example, if the user accesses the application using http://mws.example.com/, you need to use http://mws.example.com/ when registering for a key.
If the map is not rendered during the initial page load, that is, if the map is rendered only as part of an async refresh and not as part of the initial page, you must include a Google Map Key control as part of the initial page, configured with the Google Maps API key. Otherwise, you can ignore the Google Map Key control.
The center of the map is specified using the latitude and longitude property values. You can also specify the center of the map as follows:
initialAddress
property, if the latitude and longitude are both set to 0. You can format the address as a natural-language address; you can concatenate multiple lines into a single line with spaces, for example, 600 108th Ave NE, Bellevue, WA 98004 USA. You can specify a two-letter ISO-3166 country code using the initialCountry
property as a country/locale hint, though it is generally not needed.initialAddress
is blank, and the map has markers.You can add a variety of controls to the Google Map control:
Scripting
The Google Maps API is a full-featured, client-side JavaScript API, and is fully accessible for use with the CAF Google Maps controls.
To access the GMap2 object, the Google Maps API map object, associated with a Google Map control, use the map property of the control's CAF client-side model object. The following example looks up the GMap2 object of the Google Map control model with an ID of myMap, and uses the Google Maps API to zoom in one level:
var map = CAF.model("#{caf:cid("myMap")}").map;
map.zoomIn();
Client-Side Model
The CAF client-side model object for the Google Map control extends from the CAF.Input.Model object. For more information, see information about the client-side model see "Client-Side Model" in the webMethods CAF Development Help.
The value of the model object is the coordinates of the map's center in String form, for example, 37.0625;-95.67706. The following script centers a Google Map control with an ID of myMap over the city of Bellevue, Washington:
CAF.model("#{caf:cid("myMap")}")
.setValue("37.0625;-95.677068");
The CAF.GMap.stringToGLatLng()
and CAF.GMap.gLatLngToString()
functions convert string coordinates to and from a GLatLng object, the Google Maps API coordinates object.
You can also use the CAF client-side model to set a map's center with a natural-language address. The following script centers a Google Map control with an ID of myMap over the city of Bellevue, Washington:
CAF.model("#{caf:cid("myMap")}")
.setAddress("600 108th Ave NE, Bellevue, WA 98004");
You can also auto-center a map among the map's markers with the client-side model's autoCenter()
method. The following script centers a Google Map control with an ID of myMap among the markers on the map:
CAF.model("#{caf:cid("myMap")}").autoCenter(true);
Pass a value of true to the autoCenter()
method to automatically zoom so that all markers on the map are visible; pass a value of false or nothing to auto-center without changing the zoom level.
Script Controls
You can also use the standard Script-category controls like Return Value Script or Invoke Script to manipulate the map with the standard client-side actions, such as getValue or setValue. You can also use the custom Return Map Value Script and Invoke Map Script controls to access special map-only properties and actions, such as getLatitude or setAddress. The Return Map Coords Script control enables specifying the latitude and longitude coordinates when invoking the setValue or setCoords action.
Children
Map Navigation control, Dynamic Map Marker List control, Map Marker Group control, or Invoke Map Script control
Info | Value |
---|---|
Component Type | com.webmethods.caf.faces.gmap.GMap |
Handler Class | None |
Renderer Type | com.webmethods.caf.faces.gmap.GMap |
Description | Interactive Google Map |
Palette Location | CAF Html/Control/Map/Google Map |
Client-Side Model | CAF.GMap.Model |
Name | Required | Type | Description |
---|---|---|---|
ContinuousZoom | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
|
True to enable continuous smooth zooming
If not specified, the default value is "false". |
dir | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
|
Specifies the directionality of the flow of the content for the current element
Valid values are:
|
DoubleClickZoom | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
|
True to enable user to zoom in/out by double-clicking map
If not specified, the default value is "false". |
Dragging | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
|
True to enable user to re-center map by dragging it
If not specified, the default value is "true". |
height | true | javax.el.ValueExpression
(must evaluate to java.lang.String )
| Control height in pixels (500) or percent (50%) |
id | false | java.lang.String | Control identifier |
InfoWindow | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
|
True to enable info (bubble) window
If not specified, the default value is "true". |
initialAddress | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| Initial center of map if latitude=0 and longitude=0 (for example, "600 108th Ave NE, Bellevue, WA 98004") |
initialCountry | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| Two-letter country code (ISO 3166) hint for initial address (for example, "US") |
key | true | javax.el.ValueExpression
(must evaluate to java.lang.String )
| Google Maps API Key (see http://www.google.com/apis/maps/signup.html) |
lang | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| Specifies the language of the enclosed content |
latitude | false | javax.el.ValueExpression
(must evaluate to java.lang.Double )
| Latitude of map center in degrees (for example, 37.0625) |
longitude | false | javax.el.ValueExpression
(must evaluate to java.lang.Double )
| Longitude of map center in degrees (for example, -95.677068) |
rendered | false | javax.el.ValueExpression
(must evaluate to boolean )
|
True to render control; false to ignore it
If not specified, the default value is "true". |
ScrollWheelZoom | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
|
True to enable user to zoom map via the mouse scroll wheel
If not specified, the default value is "false". |
style | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| HTML "style" attribute value |
styleClass | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
|
HTML "class" attribute value
Valid values are:
|
title | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| HTML "title" attribute value (often displayed as a tooltip) |
type | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
|
Map type
If not specified, the default value is "G_NORMAL_MAP". Valid values are:
|
width | true | javax.el.ValueExpression
(must evaluate to java.lang.String )
| Control width in pixels (500) or percent (50%) |
zoom | false | javax.el.ValueExpression
(must evaluate to java.lang.Integer )
|
Zoom level from 1 (whole world) to about 20 (city block); 0 signals zoom-to-fit markers
Valid values are:
|
Output generated by Vdldoc View Declaration Language Documentation Generator.