Google+‎ > ‎

gwt-hangout 1.0

At least you must know how to build gwt app,it's better  to know what is gwt-gadget.

Download
from Google Drive

How to use

use Hello-hangouts.zip and modify it.

copy  and add jar files

akjava_gwt_hangouts1.0.jar(GWT Hangout wrapper 1.0)
gwt-gadgets_hangout_custom_by_akjava.com.jar(gadget.jar which customized for hangout)

create gadget instead of EntryPoint.

If you are  not familiar gadget copy and paste (SimpleGadget.java & Simple Feature)

extends SimpleGadget and overwrite onApiReady(),and edit ModulePrefs

package test.hello.client;
import com.google.gwt.gadgets.client.Gadget.AllowHtmlQuirksMode;
import com.google.gwt.gadgets.client.Gadget.ModulePrefs;
import com.google.gwt.gadgets.client.Gadget.UseLongManifestName;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

@ModulePrefs(title = "Hangout App")
@UseLongManifestName(false)
@AllowHtmlQuirksMode(false)
public class HelloHangout extends SimpleGadget{
protected  void onApiReady(){
RootPanel.get().add(new Label("Hello World!"));
};
}


Add inherit in .gwt.xml

  <inherits name="com.google.gwt.gadgets.Gadgets"/>
  <inherits name="com.akjava.gwt.lib.hangouts.Hangouts"/>
  <entry-point class='test.hello.client.HelloHangout'/>


create computeUrlForGadgetResource.js

create com/google/gwt/gadgets/linker/computeUrlForGadgetResource.js and modify for your server
This is very important,if you are not modify it,you can see such kind error  when you load a app.

https://www-hangout-opensocial.googleusercontent.com/gadgets/proxy/refresh=3600&container=hangout&gadget=app%3A%2F%2F334799408970%2Fhangout/http://www.xucker.jpn.org/test/hangout_hello/C5287965979E7CF872DF5BC6D3FC3D13.cache.jsFailed to load resource: the server responded with a status of 404 (Not Found)
https://www-hangout-opensocial.googleusercontent.com/gadgets/proxy/refresh=3600&container=hangout&gadget=app%3A%2F%2F334799408970%2Fhangout/http://www.xucker.jpn.org/test/hangout_hello/gwt/clean/clean.cssFailed to load resource: the server responded with a status of 404 (Not Found)


computeUrlForGadgetResource.js
you must replace url to in where your app is uploaded 
function computeUrlForResource(resource) {
var tmpBase = $wnd.gadgets.util.getUrlParameters()['url'];  
 tmpBase = tmpBase.substring(0,  tmpBase.lastIndexOf('/') + 1);
//useless like - app://334799408970/hangout
 
  var cacheSpec;
  if (resource.match(/\.cache\.(js|html)$/)) {
// Allow GWT resources marked named as cachabele to be cached for one year.
cacheSpec = {refreshInterval:31536000};
  }
  /** YOU MUST REPLACE HERE **/
  resource="http://www.xucker.jpn.org/test/hello_hangouts/"+resource;
  
  /* Prepend anything that is not a fully qualified URL with the module base URL */
  if (!resource.match(/^[a-zA-Z]+:\/\//)) {
 resource = __MODULE_FUNC__.__moduleBase + resource;
  }
  return $wnd.gadgets.io.getProxyUrl(resource, cacheSpec);


Comments