Tuesday, April 26, 2011

How to configure One Module and Many Entry Points

Hi,

My app runs all fine with two modules
1. Login Module
2. Main Module (The Login Module opens up the Main Module)

Now my app needs to be accessed on the mobile phone (iphone).

I have decided to :
extend the Main module by having two entry point classes for it (One
Module Many EntryPoints)

Referred this thread : http://groups.google.com/group/google-web-toolkit/browse_thread/thread/6c70d5f19340e978?tvc=2
, but seems am missing on something silly.

1. Entry Point class Main (already exists and serves as desktop
version of the app)
2. Entry Point class Mobile (should serve as mobile version of the
app)

so my Main.gwt.xml now, looks like this
<entry-point class='com.capgent.cpt.client.Main' />
<entry-point class='com.capgent.cpt.client.Mobile' />

I have a Mobile.html which is same as Main.html but just specifies a
different id
so my Main.html
<body bgcolor="#5693C5" >
<script language='javascript' src='com.capgent.cpt.Main.nocache.js'></
script>
<div style="overflow: auto; position: relative; width: 100%; height:
100%" id="com-capgent-cpt-main"></div>
</body>

and Mobile.html

<body bgcolor="#5693C5" >
<script language='javascript' src='com.capgent.cpt.Main.nocache.js'></
script>
<div style="overflow: auto; position: relative; width: 100%; height:
100%" id="com-capgent-cpt-mobile"></div>
</body>

Both HTML refer to same Main.nocache.js

Both Main.html and Mobile.html would share the common code classes,
its just that, both Entry point classes would have a different
implementation of onModuleLoad to kick off with.

Login module, based on a value to differentiate between the desktop
request and mobile request, calls

Window.Location.assign("./com.capgent.cpt.Main/Main.html)

or

Window.Location.assign("./com.capgent.cpt.Main/Mobile.html)


com.capgent.cpt.Main folder contains both Main.html and Mobile.html
and the Main.nocache.js

But when i login, for mobile version, the onModuleLoad of Main is
invoked and not onModuleLoad for Mobile.

What am missing? Am looking at approach of : One Module Many
EntryPoints. I do not want to have Different Module for Mobile version
of the app. as it will be code duplicating, since only few things only
would differ in onModuleLoad.

Any directions on this, will be a great help.

Thanks,
Pragati

--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment