The MapViewer sample application utilizes two Java Blueprint's
1.4 Catalog components written by Roger Kitain and modified for a
Creator 2 sample by Craig McClanahan. This sample is based on
Craig's Creator sample. The GeoCoder uses the Yahoo map service
to verify the entered address and to get the exact
latitude and longitude. This information is then used by
the
MapViewer component to render and center the Google map.
Currently the early access sample application only presents the first
address returned from the Yahoo map service. The tag library for
the MapViewer &
GeoCoder components can be accessed using the
declaration:
<%@taglib prefix="ui" uri="http://java.sun.com/blueprints/ui/14"%>
The Map Viewer component uses a backing bean to provide the
necessary information to render the Google map. This information
is populated by user input, and from the return of the GeoCoder
component's Yahoo lookup. These components can be used
independently, but the exact latitude and longitude is required by the
Map Viewer component to center the returned Google map. To see
how to use the GeoCoder component look at the "findAction" method of
the com.sun.javaee.blueprints.mapviewer.MapBean backing bean. It
encapsulates the entire call and return of the GeoCoder and sets the
values that are used by the Map Viewer.
<ui:mapViewer id="mapViewerx" center="#{MapBean.mapPoint}" info="#{MapBean.mapMarker}"
markers="#{MapBean.locations}" style="height: 500px; width: 700px"/>
As you can see above, the component tag name is "mapViewer" and has the
following
attributes whose values are populated by the MapBean backing bean:permission java.util.PropertyPermission "*","read,write";
NOTE: If the sample application is accessed through a URL other than
"http://localhost:8080/bp-map-viewer" then a new map KEY will have to
generated to access the Google map service. The key is currently
free and can be generated from http://www.google.com/apis/maps/.
The resultant key can be placed in the Map Viewer component's "key"
attribute or placed in the WEB-INF/web.xml deployment descriptor under
the param-name com.sun.j2ee.blueprints.ui.mapviewer.KEY. For
example:
<param-name>com.sun.j2ee.blueprints.ui.mapviewer.KEY</param-name>
<param-value>ABQIAAAAyQYKk4__l80DyIsqLPvvuxTRFLl8Tcq3arEgFHYFeOMvEMiJ8RQehhrYXPIDrf1muScWAd1MXrlVkQ</param-value>