Subversion Repositories eFlore/Applications.cel

Rev

Rev 3857 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2108 mathias 1
Google Maps V3 Bindings for GWT
2
 
3
This software is distributed under the Apache 2.0 license.
4
See the file COPYING for more details.
5
 
6
For more information on this project, see:
7
 
8
  http://code.google.com/p/gwt-google-apis
9
 
10
Contents:
11
  gwt-maps-<version>.jar  Add this library to your GWT project
12
  javadoc/                Javadoc generated from the API
13
  samples/                Short examples that show how to use the API.
14
 
15
For support, try the gwt-google-apis Google group.
16
If you think you have found a bug, see the online Issue tracker
17
 
18
==================================================================
19
 
20
Instructions for using Eclipse
21
 
22
These instructions require
23
  GWT 2.4 or higher          http://code.google.com/webtoolkit
24
  Google Plugin for Eclipse  http://code.google.com/eclipse
25
  Java JDK 1.5 or higher     http://java.sun.com/
26
 
27
---------- General Instructions  ---------------------------------
28
 
29
To work with the API in Eclipse, First create a 'Web Application' project
30
using the Google Plugin for Eclipse with Google Web Toolkit enabled.
31
 
32
This should create a new directory in your workspace for the project and
33
a war/WEB-INF/lib directory.  The gwt-maps.jar file need to be copied there
34
then refresh your project in Eclipse.
35
 
36
In Eclipse, add the gwt-maps.jar file to the build path, for example:
37
Project
38
  -> Properties
39
    -> Java Build Path
40
      -> Libraries
41
        -> Select gwt-maps.jar
42
 
43
Next, open to your entry point's .gwt.xml file and add the line:
44
 
45
  <inherits name="com.google.maps.gwt.GoogleMaps" />
46
 
47
 
48
Finally, you need to do one of two things to load the API on
49
application startup:
50
 
51
  1) Update your host file to include the following script tag:
52
 
53
  <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=SENSOR_TRUE_OR_FALSE"></script>
54
 
55
  Where the sensor value is either "true" or "false" depending on if you
56
  are hooked up to a location sensing device.  See the Maps API documentation
57
  at http://developers.google.com/maps/documentation/javascript/tutorial
58
 
59
 
60
  2) Load the API through the AjaxLoader library.  See the sample
61
  "MapsSimpleAjaxLoader.java" for an example.  The AjaxLoader library is
62
  bundled with the gwt-maps.jar distribution.  You will need to add
63
  the following line to your gwt module definition:
64
 
65
  <inherits name="com.google.gwt.ajaxloader.AjaxLoader" />
66
 
67
 
68
---------- Running a Sample ----------------------------------------
69
 
70
These instructions describe how to take one of the distributed samples
71
and run them in Eclipse using GWT's DevMode.  This assumes you are already
72
configured Eclipse with the Google Plugin for Eclipse and have run
73
through the GWT tutorials before.
74
 
75
 
76
Start by create a new Web Application Project. Uncheck the checkbox box to
77
install template code so that you start with an empty project.
78
 
79
Recursively copy in the sample code into the 'src' directory of your new
80
project.  Your src tree should now have the directories
81
com/google/maps/gwt/samples/...
82
 
83
Add the gwt-maps.jar to war/WEB-INF/lib and add it to the Java build path
84
of your project as mentioned in "General Instructions" above.
85
 
86
Choose the sample you'd like to run.  We'll use MapGeolocation.java as an
87
example.
88
 
89
Find MapGeolocoation.java in the tree, then find the corresponding .html file
90
for it in one of the 'public' directories.  In this case its
91
'map_geolocation.html'.
92
 
93
Copy the .html file down into the 'war' directory.
94
 
95
Open up the .html file and look at the module name.  To be compatible
96
with the Google Plugin for Eclipse, you'll need to edit the src attribute
97
'map_geolocation.nocache.js' and prepend the module name:
98
 
99
      <script type="text/javascript" language="javascript"
100
       src="map_geolocation/map_geolocation.nocache.js"></script>
101
 
102
Next, you'll need to create a GWT module
103
 
104
  1) Create a new GWT module using:
105
   File
106
     --> New
107
       --> Other...
108
         --> Google Web Toolkit
109
           --> Module
110
 
111
  2) Choose the module name to match the name in the .html file. In our
112
     example, that would be map_geolocation.  The package should be one
113
     level up from the location of the .java file:
114
 
115
     Package: com.google.maps.gwt.samples.basics
116
     Module name: map_geolocation
117
     Inherited Modules: com.google.gwt.user.User
118
                        com.google.maps.gwt.GoogleMaps
119
 
120
  3) Open the new module and add make the following modifications:
121
 
122
     Add a 'rename-to' attribute to the module start tag
123
 
124
     <module rename-to="map_geolocation" />
125
 
126
 
127
     Add in the .java sample as an entry point
128
 
129
     <entry-point
130
      class="com.google.maps.gwt.samples.basics.client.MapGeolocation" />
131
 
132
 
133
Finally, you are ready to launch the sample!  Right click on the
134
new map_geolocation.gwt.xml module and run the sample:
135
 
136
  Run As
137
   --> Web Application
138
 
139
Choose the web page you copied down (map_gelocation.html)  if prompted.