Jonathan Holloway
Jonathan Holloway

Reputation: 63652

Hidden Features of Google Web Toolkit 2

I'm curious to find out what the obscure and hidden features of Google Web Toolkit 2 (GWT) are. If you know of any tricks/features - that are uncommon, undocumented or hidden in the Javadocs then what are they and why are they useful?

My personal favorite was the StyleSheetLoader which is buried in the ShowCase application bundled with GWT. I use it to dynamically swap out a stylesheet "on the fly" to provide web application theming capabilities.

Feature Summary:

Upvotes: 15

Views: 987

Answers (3)

jusio
jusio

Reputation: 9900

There are thousands of things which are unknown to the most developers, but can be quite useful. Just few examples:

AsyncProxy A very useful thing for implementing code-splitting. Actually allows you to create an instance of class, which is not yet downloaded, but you can invoke methods on it (with some limitations).

Distributed builds Again, not many people know that you can compile a GWT app on multiple machines (e.g. each permutation can be compiled on different machine)

Multi-JVM compilation. Almost everyone knows about -localWorkers flag. But not everyone knows that you can actually force GWT to create new JVM for each Worker. To do so, launch a compiler with -Dgwt.jjs.permutationWorkerFactory=com.google.gwt.dev.ExternalPermutationWorkerFactory (also this paramter can be used to create your own custom permutation workers factories)

Duration.currentTimeMillis() useful class for measuring performance

-extra compiler parameter generates a symbol map for obfuscated code.

Wildcards in JSNI expressions. For example, when you need to invoke jave method from JSNI instead of:

@com.company.MyClass::test(Ljava\lang\String;)(value);

You can wright:

@com.company.MyClass::test(*)(value);

Upvotes: 1

salk31
salk31

Reputation: 44

This may seem a bit odd but "the runtime is just JavaScript".

It is obvious to people who get it but I've found repeating that a few hundred times has helped me get it adopted. People used to other technologies or worried about risks of new technology find this a great comfort.

Hmmm. Sure you could get pedantic that runtime is DOM, CSS etc ;)

Upvotes: 0

It may be a bit old, but until now, one of my favorites is the ImageBundleDesign. It assembles several similar images to one image, positioning it in different places via CSS tricks. As a result, you still seem to have different images in your application, but in fact there's only one being transmitted from the server. Saves loading time. Hope you didn't know it yet, or you forgot about it :)

Upvotes: 1

Related Questions