|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
最后更新时间:2007-11-22
GWT Object Exporter 1. 简介 GWT 允许传递的对象为Element,JavaScriptObject GWT Object Exporter 提供将页面对象 导出(export) 成JavaScriptObject,将JavaScriptObject 导入(import)成代理对象(服务) 2. 核心 & Demo interface IExportable : 实现此接口的类将允许exporter 成 javaScriptObject interface IExportableExporter : exporter 接口,根据需要写出export、import方法 2.1 需要导出的类实现IExportable (或接口继承IExportable) java 代码
java 代码
2.3 应用
声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
最后更新时间:2007-10-30
gwt提供的1.46包中没有IExportableExporter ,IExportable~~
楼主的这两个接口哪里来的 |
|
| 返回顶楼 | |
|
最后更新时间:2007-10-31
兄弟和这个项目有关系吗?
http://code.google.com/p/gwt-exporter/ |
|
| 返回顶楼 | |
|
最后更新时间:2007-10-31
这是我们公司自己内部的模块,整理后会发布上来的。
|
|
| 返回顶楼 | |
|
最后更新时间:2007-11-06
已经发布了,地址是
http://code.google.com/p/gwt-object-exporter/ 包含export模块已经测试类 |
|
| 返回顶楼 | |
|
最后更新时间:2007-11-07
还是少了点类呀~~?
|
|
| 返回顶楼 | |
|
最后更新时间:2007-11-07
o~,粗心大意了,你把错误的方法屏蔽就Ok拉,Download已经更新了~
|
|
| 返回顶楼 | |
|
最后更新时间:2007-11-22
請問這個exporter的作用是什麼?
我想一個html 內有2個gwt 的widget, 2個widget 相互share 一個gwt 的object 可以做到嗎? 請指教 |
|
| 返回顶楼 | |
|
最后更新时间:2007-11-23
可以做到。
原理: html里面内2个widget可以传递JavaScriptObject. gwt object expoter就是提供将share的object解析成JavaScriptObject,和导入成类的。 |
|
| 返回顶楼 | |
|
最后更新时间:2007-11-28
我想寫一個GWTSession, 作用就如HTTPSession 一樣, 可以被同一個html 內的gwt widget 互相share object:
GWTSession:
package commons.gwt.data.client;
import java.util.HashMap;
import com.macaufly.gwt.exporter.client.IExportable;
public class GWTSession extends HashMap implements IExportable {
}
當然需要Helper 去import/export:
package commons.gwt.data.client;
import com.google.gwt.core.client.JavaScriptObject;
import com.macaufly.gwt.exporter.client.IExporter;
public interface GWTSessionHelper extends IExporter {
public JavaScriptObject doExport(GWTSession gwtSession);
public GWTSession doImport(JavaScriptObject jso);
}
為了GWT Widget 可以方便拿到GWTSession來用, 寫了一個GWTSessionAccessor
package commons.gwt.data.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
public class GWTSessionAccessor {
private static GWTSessionHelper helper = (GWTSessionHelper) GWT
.create(GWTSessionHelper.class);
public static void clear() {
setGWTSession(null);
}
private static native void setGWTSession(JavaScriptObject gwtSession) /*-{
$wnd.parent.gwtSession = gwtSession;
}-*/;
public static native JavaScriptObject getGwtSession() /*-{
if ($wnd.parent.gwtSession == undefined) {
return null;
} else {
return $wnd.parent.gwtSession
}
}-*/;
public static GWTSession get() {
JavaScriptObject jso = getGwtSession();
if (jso == null) {
GWTSession gwtSession = new GWTSession();
setGWTSession(helper.doExport(gwtSession));
return gwtSession;
} else {
GWTSession gwtSession = helper.doImport(jso);
return gwtSession;
}
}
}
實際應用:
// put the auth into session
GWTSession gwtSession = GWTSessionAccessor.get();
gwtSession.put("auth", AuthenticationAccessor.get());
// test the auth has been put into session
gwtSession = GWTSessionAccessor.get();
Authentication auth = gwtSession.get("auth");
發現 gwtSession 可以拿出來, 但內部的key/value pair 的數目是0...我用錯了嗎?....謝謝 |
|
| 返回顶楼 | |






