I am trying to use the above api to implement some JSNI code in my
onModuleLoad method.  I am having the darnedest time trying to get it to
recognize that I have the extra javascript files available.  The JS debugger
in Chrome keeps saying that Garmin is undefined (see below).  Here's the
dilemma: when I create my JSNI it gets compiled in the main JS code and
evidently the Garmin JS code is out of the scope of where the call happens
in the compiled JS.  I'm somewhat new to GWT, and I'm not sure if I'm doing
something incorrectly or not. Here's what I've got in my project:

src
---public
------communicator-api
---------miscellaneous garmin folders in the original structure
---garmin_project.gwt.xml

com.stephenlwalsh.garmin_project.client
---garmin_project.java

Contents of garmin_project.gwt.xml  The script src tags are doing a fine job
of pulling in the js needed and the entire communicator-api folder on
compile.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.1//EN" "
http://google-web-toolkit.googlecode.com/svn/tags/1.7.1/distro-source/core/src/gwt-module.dtd
">
<module rename-to='garmin_favorites_sync'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.standard.Standard'/>
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->

  <!-- Other module inherits                                      -->
  <script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;gwt=1
"/>
  <script src="communicator-api/garmin/device/GarminDeviceDisplay.js"/>
  <script src="communicator-api/prototype/prototype.js"/>
  <stylesheet src="communicator-api/garmin/device/style/communicator.css"/>
  <!-- Specify the app entry point class.                         -->
  <entry-point
class='com.stephenlwalsh.garminsync.client.Garmin_Favorites_Sync'/>
</module>

JSNI function within EntryPoint()

    private native void load() /*-{
        var display = new Garmin.DeviceDisplay("garminDisplay", {
            pathKeyPairsArray:
["http://developer.garmin.com","49048b3369edffd4a511d920202a6214";],

            autoFindDevices: true, //start searching for devices
            showStatusElement: true, //basic feedback provided
            showReadDataElement: false //don't offer to read data
            //add other options per the documentation
            });
    }-*/;

>From within onModuleLoad() I have the function called and it works fine.
The problem lies within the line above in the var display declaration.  It
says that "Garmin" is undefined.  I have moved files and reworded and
everything trying to give that function access to the JS that it should have
access to.  It's interesting that when I place the js load function in the
html, it works just fine even when GWT is compiling the external javascript.

Any thoughts?

Thanks,
Stephen Walsh

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.


Reply via email to