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.
when you'll GWTcompile the MyModuleUsage module GWT il put in that
compilation all the classes needed for this module to run that
includes the classes from MyModule.
that in info is on AFAIK bases, if someone knows different please
correct me.
for "My question is , the way I am using multiple modules to reduce
files sizes, is it correct or no ?" only the people working on
developing GWT could give u an correct answer, my guess is that it'
wont reduce it. but it would be usefull if you've used MyModule in
other more modules like MyModuleUsage
Hope it helps you and clears some of you questions
good luck
On Feb 19, 7:28 am, vinayak <vinayakshu...@gmail.com> wrote:
> Moderators,
> Nobody is answering this question. Is it that
> others can not view this thread anywhere? Do I need to do something
> more to make it viewable to others ?
> Question must be easily answerable.... Please help.
> Thanks.
>
> - vinayak
> > If I do a gwtcompilationof 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.- Hide quoted text -
>
> - Show quoted text -
GWT developers, please take a look at other part of the question.
Thanks in advance.
- vinayak
On Feb 19, 4:36 pm, Ashar Lohmar <asharloh...@gmail.com> wrote:
> the "MyModule" that will be used in MyModuleUsage module does not need
> to be GWT compiled ... and even further you can't GWTcomplie it
> without an entry point, but you don't need it gwt complied,
> in this type of scenario myModule is compiled in java (javac) and made
> a jar that has the .class files along with the .java files for the
> classes in the (from the) folder that are mentioned by <source
> path='client'/> tags.
>
> when you'll GWTcompile the MyModuleUsage module GWT il put in thatcompilationall the classes needed for this module to run that
also on my production server, where i deploy the app, i run the build
script that only gwtcompiles the modules with the entrypoints, an put
in the webapps\ROOT folder of the tomcat server only the content of
the war folder of my app.
for a (good/correct) gwt compile script try building a dummy app
using the command line with webAppCreator.cmd (check the params) that
will also create a build.xml file which afterwards you could modify it
to suit your needs.
good luck
> > > - Show quoted text -- Hide quoted text -
Thanks.