GWT RPC data format

EDIT: Brian Slesinsky just documented the protocol (by reverse-engineering the code): https://docs.google.com/document/d/1eG0YocsYYbNAtivkLtcaiEE5IOF5u4LUol8-LL0TIKU/edit First, GWT-RPC protocol is asymmetric so that it’s always optimized for the client-side: fast to deserialize something coming from the server, and fast to serialize something to send to it. It’s obviously not binary, as you suspected, but text-based. client-to-server protocol is pipe-delimited … Read more

Using GWT Editors with a complex usecase

Fundamentally, you want a CompositeEditor to handle cases where objects are dynamically added or removed from the Editor hierarchy. The ListEditor and OptionalFieldEditor adaptors implement CompositeEditor. If the information required for the different types of questions is fundamentally orthogonal, then multiple OptionalFieldEditor could be used with different fields, one for each question type. This will … Read more

GWT.setUncaughtExceptionHandler()

I believe what’s happening here is that the current JS event cycle is using the DefaultUncaughtExceptionHandler because that was the handler set at the start of the cycle. You’ll need to defer further initialization to the next event cycle, like this: public void onModuleLoad() { GWT.setUncaughtExceptionHandler(new ClientExceptionHandler()); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { … Read more

Firing click event from code in gwt

I have done this code: if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { myButton.fireEvent( new GwtEvent<ClickHandler>() { @Override public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() { return ClickEvent.getType(); } @Override protected void dispatch(ClickHandler handler) { handler.onClick(null); } }); } Of course myButton must be final or public cause you are inside another event handler.

Java 8 support in GWT

EDIT GWT 2.8.0 was released on Oct 20, 2016 with support for Java 8 language constructs (lambdas, method references) and emulation of some Java 8 APIs (streams mostly) EDIT as of Apr 2014, GWT 2.6 supports Java 7, and work is underway to support Java 8 in GWT 2.7, to be released by the summer … Read more

How do I select only visible elements using XPath?

This should work: .//button[.=’OK’ and not(ancestor::div[contains(@style,’display:none’)]) and not(ancestor::div[contains(@style,’display: none’)])] EDIT: The simpler and more efficient expression below: //div[not(contains(@style,’display:none’))]//button[.=’OK’] does not work properly because every button has at least one div that’s visible in its ancestors.

Using the GWT Scheduler

JavaScript (in a browser) is single threaded. The event loop model means, we’re always in exactly one of two states: in the event loop executing an event handler There are many kinds of events: Click events, onload events, XHR events, timer events, … You’ll have to declare some handlers (at least one during page load), … Read more

How can a user download a file in client side (Google Web Toolkit)

You REALLY need to distinguish between GWT client side java code and server side java code. On the client side in your GWT Java Code String url = GWT.getModuleBaseURL() + “downloadService?fileInfo1=” + fileInfo1; Window.open( url, “_blank”, “status=0,toolbar=0,menubar=0,location=0”); On server side in your non-gwt Java code- In web.xml <servlet> <servlet-name>downloadService</servlet-name> <servlet-class>AAA.BBB.CCC.DownloadServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>downloadService</servlet-name> <url-pattern>/<gwtmodulename>/downloadService</url-pattern> </servlet-mapping> … Read more

how to clear cache in gwt?

When you deploy a GWT-application it’s important to avoid proxies and browsers to cache the .nocache.js-files generated by GWT. One solution is to implement a servlet filter that adds the necessary HTTP-headers that control the caching behaviour. Here’s such a filter: http://seewah.blogspot.com/2009/02/gwt-tips-2-nocachejs-getting-cached-in.html The headers in that example are: Date: Wed, 24 Nov 2010 20:32:43 GMT … Read more