views:

103

answers:

1

Hi, I've a big GWT module which comprised of many java classes (& of course it's impossible to break it down into several modules).
My GWT application consists of some forms, but the users usually work only with a few of them, anyway they should be abale to open any form as they need.
Now my problem its that gwt generates a big js file that will load each time, but most of its content may never use!
Is there any way to break the big js module file into several smaller files(for example, one file for each class) & gwt load them automatically as needed ?

+3  A: 

You need Code Splitting - http://code.google.com/webtoolkit/doc/latest/DevGuideCodeSplitting.html

Conceptually, think of you code as a tree starting with your onModuleLoad() method. Every method call is a branch in this tree. Now GWT's code splitting is an axe that you can cut the tree at any branch. You can cut your tree anywhere and any number of times you want.

At startup, GWT will only load the part of the tree that contains onModuleLoad. Others will be loaded when you first access that part. In terms of code, other branches will be loaded ansynchronously, and you will be notified in a callback when it has finished loading.

Read the docs at the link I pasted above. It has enough material to get you started.

sri