If you are calling JavaScript inside of a GWT JSNI function, you
should be using $wnd.google.load(...)

On Thu, Aug 13, 2009 at 11:55 PM, Bobby<[email protected]> wrote:
>
> This IE AuthSub issue is not because of the IFrame, the transferToken
> approach didn't make a difference.
>
> I tried placing the google.load('gdata', '1.10'); call in a button
> click event. Here's the code:
> <html>
> <body>
>    <img src="logo-small.png" />
>    <script type="text/javascript" src="http://www.google.com/jsapi";></
> script>
>    <script type="text/javascript">
>        function loadGData() {
>                google.load('gdata', '1.10');
>        }
>    </script>
>    <input type="button" value="Load GData" onclick="loadGData();" />
> </body>
> </html>
>
> If you try this, when you click "Load GData", the page is cleared and
> nothing really happens. If you look at the page source after clicking
> the button you see the following:
> <script src="http://www.google.com/uds/?file=gdata&v=1.10"; type="text/
> javascript"></script>
>
> This is what would happen if document.write was being used and would
> explain a few things.
>
> Eric, does your AjaxLoader module use google.load() from the jsapi?
>
> Bobby
>
> On Aug 13, 10:20 pm, Bobby <[email protected]> wrote:
>> By the way, i've finished porting the samples (70 of them) i'm
>> currently polishing and commenting the samples code.
>>
>> I've added specialized Callbacks into the API, for example
>> BlogEntryCallback (extending AsyncCallback<BlogEntry>) - this meant
>> adding specialized methods for insert/update/delete, but makes for a
>> better API. There have been other changes and design choices as well.
>>
>> In the Maps samples, the create/update features are not working
>> because of a KML-related defect which i might try to get around with
>> GWT:http://code.google.com/p/gmaps-api-issues/issues/detail?id=1585
>>
>> Other than that i have a small list of items to wrap up (including
>> this IE issue) and some documentation to write, but nothing major and
>> i'm counting on having a download by the end of this week or next week
>> at the latest.
>>
>> Bobby
>>
>> On Aug 13, 9:46 pm, Bobby <[email protected]> wrote:
>>
>> > The onModuleLoad is within an iframe, that's probably the cause. I
>> > think i can find a way around this. For example, i can add the
>> > following method to the GData module:
>> > GData.transferTokenOrSomething();
>>
>> > This function would check the top frame for a token and append it to
>> > the IFrame's location. I'll play around with this.
>>
>> > Bobby
>>
>> > On Aug 13, 9:29 pm, Bobby <[email protected]> wrote:
>>
>> > > Another possible cause could be for example if, in the compiled GWT
>> > > app, the google.load call happens inside an IFrame.
>>
>> > > Currently, with google.load being called from onModuleLoad,
>> > > google.accounts.user.login() causes the redirect to the Google
>> > > Accounts authorization page, but when it redirects back, with the
>> > > token in the URL (for example /HelloGData.html#tokenhere), the token
>> > > doesn't get consumed (in IE), and the authentication doesn't succeed.
>>
>> > > If GWT is placing the onModuleLoad code inside an IFrame, then it may
>> > > cause the GData library to look for the token on the IFrame
>> > > window.location, instead of the top's window.location.
>>
>> > > Bobby
>>
>> > > On Aug 13, 9:16 pm, Eric Ayers <[email protected]> wrote:
>>
>> > > > The gdata init shouldn't use document.write() - you should be able to
>> > > > call it at any time.
>>
>> > > > There is a tradeoff of using the AjaxLoader module - it does add more
>> > > > delay than using the script version.  Fortunately, you can code your
>> > > > app using AjaxLoader and then if you need the speedup, just add the
>> > > > logic in your host page.  AjaxLoader will detect that the jsapi is
>> > > > already there and bypass it.  You can add that check in your version
>> > > > of GData.loadGDataApi() if you like.
>>
>> > > > On Thu, Aug 13, 2009 at 9:11 PM, Bobby<[email protected]> wrote:
>>
>> > > > > In the GData JS library, in IE, AuthSub fails if google.load("gdata",
>> > > > > "1.10"); is asynchronous, after the page has finished processing. For
>> > > > > example, if i place the google.load("gdata", "1.10"); call within the
>> > > > > GWT onModuleLoad method, then AuthSub stops halfway.
>>
>> > > > > To avoid this we can directly add the following at the top of the GWT
>> > > > > html page:
>> > > > >        <script type="text/javascript" 
>> > > > > src="http://www.google.com/jsapi";></
>> > > > > script>
>> > > > >        <script type="text/javascript">google.load("gdata", "1.10");</
>> > > > > script>
>>
>> > > > > Or just use the auto-load feature of the JS API to collapse these two
>> > > > > into a single script load.
>>
>> > > > > But this wouldn't make use of the AjaxLoader module and it means that
>> > > > > the GWT app will have to wait for the GData libraries to load before
>> > > > > rendering, etc, instead of doing something like the following:
>>
>> > > > > public void onModuleLoad() {
>> > > > >    //render main app here
>> > > > >    GData.loadGDataApi(null, new Runnable() {
>> > > > >      public void run() {
>> > > > >        initialize();
>> > > > >      }
>> > > > >    });
>> > > > > }
>>
>> > > > > I don't know the reason for this behavior but it could happen if the
>> > > > > gdata library uses document.write for example.
>>
>> > > > > Bobby
>>
>> > > > > On Jul 15, 1:30 am, Bobby <[email protected]> wrote:
>> > > > >> I'm adding the GData samples here as i go, if you want to see the
>> > > > >> library in 
>> > > > >> action.http://1.latest.gwt-gdata.appspot.com/v/HelloGData.html
>>
>> > > > >> Bobby
>>
>> > > > >> On Jul 14, 9:54 am, Eric Ayers <[email protected]> wrote:
>>
>> > > > >> > Thanks for the update.
>>
>> > > > >> > On Mon, Jul 13, 2009 at 11:45 PM, Bobby<[email protected]> 
>> > > > >> > wrote:
>>
>> > > > >> > > Status update: the library is ready, i'm translating the 
>> > > > >> > > various JS
>> > > > >> > > samples into GWT to include in the first download, using the 
>> > > > >> > > same
>> > > > >> > > format as the Google Maps sample app which is contained the in 
>> > > > >> > > the gwt-
>> > > > >> > > maps-1.0.4.zip available here:
>> > > > >> > >http://code.google.com/p/gwt-google-apis/wiki/Downloads?tm=2
>>
>> > > > >> > > This is the fun part. :)
>>
>> > > > >> > > Bobby
>>
>> > > > >> > > On Jun 25, 8:20 am, Thomas Broyer <[email protected]> wrote:
>> > > > >> > >> On 25 juin, 08:32, Bobby <[email protected]> wrote:
>>
>> > > > >> > >> > Actually, i've just noticed that the ArrayHelper in the 
>> > > > >> > >> > AjaxLoader
>> > > > >> > >> > module provides the same functionality. Question though, 
>> > > > >> > >> > when calling
>> > > > >> > >> > the fromArray() method from within a JSNI method, what's the 
>> > > > >> > >> > parameter
>> > > > >> > >> > signature that should be used? I'm not having any luck with 
>> > > > >> > >> > fromArray
>> > > > >> > >> > (Lcom/google/gwt/core/client/JavaScriptObject;).
>>
>> > > > >> > >> > I want to transform the following:
>> > > > >> > >> > public final native void setProperties(JsArray<Property> 
>> > > > >> > >> > properties) /
>> > > > >> > >> > *-{
>> > > > >> > >> >     this.setProperties(
>> > > > >> > >> >       properties
>> > > > >> > >> >     );
>>
>> > > > >> > >> > }-*/;
>>
>> > > > >> > >> > Into the following:
>>
>> > > > >> > >> > public final native void setProperties(Property[] 
>> > > > >> > >> > properties) /*-{
>> > > > >> > >> >     this.setProperties(
>> > > > >> > >> >       
>> > > > >> > >> > @net.ltgt.gwt.jscollections.client.JsArrays::fromArray(Lcom/
>> > > > >> > >> > google/gwt/core/client/JavaScriptObject;)(properties)
>> > > > >> > >> >     );
>>
>> > > > >> > >> > }-*/;
>>
>> > > > >> > >> I'd personally use an intermediate 
>> > > > >> > >> setProperty(JsArray<Property>) and
>> > > > >> > >> call the fromArray in pure Java.
>>
>> > > > >> > >> > But GWT complains about not being able to find the method 
>> > > > >> > >> > with that
>> > > > >> > >> > signature.
>>
>> > > > >> > >>http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#D...
>> > > > >> > >> links 
>> > > > >> > >> tohttp://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/types.html#wp16432
>> > > > >> > >> which says to use:
>>
>> > > > >> > >>    
>> > > > >> > >> ...::fromArray([Lcom/google:gwt/core/client/JavaScriptObject;)
>> > > > >> > >> (properties)
>>
>> > > > >> > >> (note the left square bracket before the L)
>>
>> > > > >> > >> > Also, why are the ellipsis used?
>>
>> > > > >> > >> to allow for uses such as fromArray("a", "b", "c") instead of 
>> > > > >> > >> fromArray
>> > > > >> > >> (new String[] { "a", "b", "c" })
>>
>> > > > >> > >> > Do they have a special purpose in GWT?
>>
>> > > > >> > >> No (and as with generics, it's hardly more than syntactic 
>> > > > >> > >> sugar, as
>> > > > >> > >> the "new String[]" is implied in the example above)
>>
>> > > > >> > --
>> > > > >> > Eric Z. Ayers - GWT Team - Atlanta, GA 
>> > > > >> > USAhttp://code.google.com/webtoolkit/
>>
>> > > > --
>> > > > Google Code Jam 2009http://code.google.com/codejam
> >
>



-- 
Google Code Jam 2009
http://code.google.com/codejam

--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to