Hello,
           I am a newbie to GWT and using gwt 2.0 and now gwt 2.0.2 to
create my web application. (Actually I am converting my existing app
to a gwt app...). To do this I am trying one small example. To avoid
very large .no-cache.js file and large first page Ioad time, I have
created 1 module (e.g. MyModule) and I am using it in my main gwt
project by inheriting it. My main project name is MyModuleUsage.

Here is the code in MyModule. This has no entrypoint class. It has one
MyForm class, one DetailsService and .gwt.xml file.  (given below)

public class MyForm extends Composite {
  // Code to create my form
}

MyModule.xml:

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='mymodule'>
  <inherits name='com.google.gwt.user.User'/>
  <source path='client'/>
</module>

After creating this module, I created MyModule.jar with src and class
files as described on

http://developerlife.com/tutorials/?p=229   (Although it was for
gwt1.4 and IDEA, I could use that info on gwt 2.0 and eclipse.)

I created MyModule.jar manually by copying src and class files in
required dir structure. ( I hope there is some utility of gwt itself
to create one...please let me know if any)

Code for MyModuleUsage is as given below.

public class MyModuleUsage implements EntryPoint {

public void onModuleLoad() {
// My buttons and textboxes and tables....
                MyForm myform = new
MyForm();                             // This is from inherited
module.
                RootPanel.get("MyMod").add(myform.asWidget());
// some more buttons...and their click handlers..
}

MyModuleUsage.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='mymoduleusage'>
  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.mycompany.my.MyModule'/>
  <inherits name='com.google.gwt.user.theme.standard.Standard'/>
  <entry-point class='com.mycomany.your.client.MyModuleUsage'/>
  <source path='client'/>
  <source path='shared'/>
</module>

There is one more service of this project itself to handle clicks of
buttons created inside MyModuleUsage..

Now if I run MyModuleUsage then I get required output. Click on
buttons of Myform are handled by service inside MyModule and click on
buttons of MyModuleUsage are handled by service inside MyModuleUsage
as expected. This gives me a feeling that I can use MyModule as
indepedent component which I can use any other gwt project.

If I do a gwt compilation of MyModuleUsage in eclipse then generated
no-cache.js file is of 6 kb and cache.html file is of 80 kb.

If I write code to generate same UI and service inside a single module
then generated no-cache.js file is of 10 kb and cache.html file is of
230 kb.

My question is , the way I am using multiple modules to reduce files
sizes, is it correct or no ?
Second I have never gwt compiled MyModule independently. so when
exactly it gets compiled ?
where are the compiled files for MyModule.











-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to