yugalatea / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

problem about add the 3rd party gadgets to GWT page. #248

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:
    Google Web Toolkit 1.5.3

Detailed description:
    Yesterday, I wrote a test page for  add the gadget of "Google Friend
Connect" to my GWT page.

    I create a new HTML object and set the gadget's script (got from
"Google Friend Connect" ) to this object.

    This is the code summary:
    ----------------
    HTML htmObj = new HTML("<!-- some script got from 'Google Friend
Connect'-->")
    RootPanel.get().add(htmObj);
    ----------------

    But this code only can run on Firefox. In other browsers (IE, Chrome,
etc.) the gadget is can not show correctly.

Workaround if you have one:

Links to the relevant GWT Developer Forum posts:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f058ed276
032f984

Original issue reported on code.google.com by lexiong...@gmail.com on 5 Mar 2009 at 5:22

GoogleCodeExporter commented 9 years ago
This post is a bit off topic, as it doesn't involve the gwt_gadgets API.

You are right, there is something about that technique that doesn't work.  I 
found
this alternative implementation of the gadget worked, though:

In SimpleFriendConnect.html, add:

  <!-- Include the Google Friend Connect javascript library. -->
  <script type="text/javascript"
src="http://www.google.com/friendconnect/script/friendconnect.js"></script>

Then, I took the HTML code and translated it to JSNI:

package com.example.simpleFriendConnect.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class SimpleFriendConnect implements EntryPoint {

  static native void addFriendConnect(String divId) /*-{
     var skin = {};
     skin['BORDER_COLOR'] = '#cccccc';
     skin['ENDCAP_BG_COLOR'] = '#e0ecff';
     skin['ENDCAP_TEXT_COLOR'] = '#333333';
     skin['ENDCAP_LINK_COLOR'] = '#0000cc';
     skin['ALTERNATE_BG_COLOR'] = '#ffffff';
     skin['CONTENT_BG_COLOR'] = '#ffffff';
     skin['CONTENT_LINK_COLOR'] = '#0000cc';
     skin['CONTENT_TEXT_COLOR'] = '#333333';
     skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
     skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
     skin['CONTENT_HEADLINE_COLOR'] = '#333333';
     skin['DEFAULT_COMMENT_TEXT'] = '- add your comment here -';
     skin['HEADER_TEXT'] = 'Comments';
     skin['POSTS_PER_PAGE'] = '5';

    // NOTE: Prepend $wnd to the calls to the friendconnect API.
     $wnd.google.friendconnect.container.setParentUrl('/users/eric/');
     $wnd.google.friendconnect.container.renderWallGadget(

      // NOTE: substitute 'divId' for the string generated by Google Friendconnect
      { id: divId,
        site: '01989614359727495564',
        'view-params':{"disableMinMax":"true",
          "scope":"PAGE","features":"video,comment",
          "startMaximized":"true"}
      }, skin);
   }-*/;

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
    RootPanel.get().add(new Label("Member Gadget shown below:"));
    DivElement gadgetDiv = Document.get().createDivElement();
    String id = "div-friendconnect1";
    gadgetDiv.setId(id);
    gadgetDiv.getStyle().setPropertyPx("width", 282);
    gadgetDiv.getStyle().setProperty("border", "1px, solid #cccccc");
    RootPanel.get().getElement().appendChild(gadgetDiv);
    addFriendConnect(id);
  }
}

Original comment by galgwt.reviews@gmail.com on 6 Mar 2009 at 3:52

GoogleCodeExporter commented 9 years ago
Thanks for you help. 

Yes, this post is a bit off topic. 
Because I did not understood the difference between "Mozilla Firefox" and other
browsers. And the test result is that only can show correct on Firefox. So, I 
post this.

And thanks for you update. That is very helpful. I will continue research this. 

Original comment by lexiong...@gmail.com on 6 Mar 2009 at 5:34

GoogleCodeExporter commented 9 years ago
After talking to some other folks, The reason the loading in the body of the 
HTML
widget doesn't work is that on some browsers, the <script> body of an element
injected in the DOM is not executed after the document loads.

Original comment by galgwt.reviews@gmail.com on 6 Mar 2009 at 6:04

GoogleCodeExporter commented 9 years ago
Updating account names

Original comment by zundel@google.com on 21 Dec 2009 at 2:00