in my case, I've got several url but only one GWT module.

I put a javascript argument in the page (this is your server which put it in 
the html page). This argument is read by my gwt module and I've got a switch 
block to instanciate one widget which correspond to my page.

With this method, its is easy to deferred loading of javascript block.

Here is an example:

public class WidgetManager implements EntryPoint
{
private static final String VAR_ARGUMENTS = "args";
public static final String WIDGET_PANEL = "widgetPanel";
public static final String WIDGET = "widget";

public enum WidgetType
{
RegisterWidget, LoginWidget
}

/**
 * This is the entry point method.
 */
public void onModuleLoad()
{
MainResources.INSTANCE.css_styles().ensureInjected();

// get all arguments
Dictionary args = Dictionary.getDictionary(VAR_ARGUMENTS);
String widgetArg = args.get(WIDGET);

if (!widgetArg.equals(""))
{
WidgetType widgetType = WidgetType.valueOf(widgetArg);

switch (widgetType)
{
case RegisterWidget:
GWT.runAsync(new RunAsyncCallback() {
public void onFailure(Throwable caught)
{

}

public void onSuccess()
{
addToRoot(new RegisterWidget());
}
});
break;
case LoginWidget:
GWT.runAsync(new RunAsyncCallback() {
public void onFailure(Throwable caught)
{

}

public void onSuccess()
{
addToRoot(new LoginWidget());
}
});
break;
 }

}

}

public static void addToRoot(Widget page)

{

 RootPanel rootPanel = RootPanel.get(WIDGET_PANEL);

 DOM.setInnerHTML(rootPanel.getElement(), "");

 rootPanel.add(page);

 }

}

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

Reply via email to