I am considering 2 usecases.  The first being an integration with the
Liferay Java portal where we would essentially have many portlets all
with the same portlet wrapper all using different deferred binding.
For instance, I would write one module to wrap all of our portlets and
write an ant script to change the module.gwt.xml's replace-with line
and recompile to produce all of our components.  We essentially have 2
possible ways of displaying our portlets.  One is a custom portlet
with no user management completely written in GWT, and the other is
Liferay (JSR Portlet spec).  I would like to have them all use the
same code with minimal wrapper work, which is why I decided on the
approach I just explained.  Also, I have been contemplating a way to
write a pure GWT portal implementation that would be completely
plugable.  From the (limited) research I have done, I cannot find an
easy way to make GWT pluggable without seperating it into several
modules, and I could see a case where someone would like to put the
same portlet on the page twice with different data/configuration.  I
have been working on a way to make this work, and I believe I have.  I
think this could also be modified for all the work to be done as a
Linker, but I am not familiar enough with them to do that yet,

private static native JavaScriptObject fixWnd()/*-{
    orig_wnd = $wnd;
    while($wnd.parent != $wnd)
      $wnd = $wnd.parent;
    if (orig_wnd == $wnd)
      return null;
    $doc = $wnd.document;
    return orig_wnd;
  }-*/;

  private static final JavaScriptObject originalWindow = fixWnd();

  public static native String getQueryParam(String queryParam)
  /*-{
    return @com.gwt.client.GWTClient::originalWindow.gup(queryParam);
  }-*/;

  public void onModuleLoad()
  {
    if (originalWindow == null)
      throw new RuntimeException("not meant to be run as a
standalone");
    Alerter alerter = ((Alerter) GWT.create(Alerter.class));
    RootPanel.get("container_" + getQueryParam("uuid")).add
(alerter.getWidget());
  }

/tester/GWTTester.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html;
charset=UTF-8">
    <title>index</title>
    <script type="text/javascript">
    function gup( name )
    {
      name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
      var regexS = "[\\?&]"+name+"=([^&#]*)";
      var regex = new RegExp( regexS );
      var results = regex.exec( window.location.href );
      if( results == null )
        return "";
      else
        return results[1];
    }
    </script>
  </head>
  <body style="margin:0;">
                <script type="text/javascript" language="javascript"
src="tester.nocache.js"></script>
  </body>
</html>

/index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html;
charset=UTF-8">
    <title>index</title>
  </head>
  <body style="margin:0;">
    <iframe src="tester/GWTTester.html?alerter=hello&uuid=1"
style="display:none;"></iframe>
    <iframe src="tester/GWTTester.html?alerter=goodbye&uuid=2"
style="display:none;"></iframe>
    <iframe src="tester/GWTTester.html?uuid=3" style="display:none;"></
iframe>
    <div id="container_3"></div>
    <div id="container_2"></div>
    <div id="container_1"></div>
  </body>
</html>

On Dec 30, 9:39 am, Jason Essington <jas...@greenrivercomputing.com>
wrote:
> I can't think of a single usecase where it would be appropriate to load a 
> module twice ... It would be effectively the same as loading YUI, or Dojo, or 
> jQuery twice, Once it is there the first time there's no need to load it 
> again, the code is already there.
>
> If you are simply trying to place a panel in multiple places on the page, 
> that can be done from the single invocation of your module, look for the 
> container elements in the DOM and add your panel (widgets)
>
> RootPanel.get("contianer1").add(myStuff); 
> RootPanel.get("container2").add(anotherInstanceOfMyStuff);
>
> -jason
>
> On Dec 29, 2009, at 6:39 PM, Ian Bambury wrote:
>
> > Why would you want to run it twice? What effect are you trying to produce?
>
> > Ian
>
> >http://examples.roughian.com
>
> > 2009/12/30 lineman78 <linema...@gmail.com>
> > Can someone please tell me if it is possible to load the same module
> > twice.  If so, how?  I have tried including the script tag twice,
> > which used to work in older versions of gwt, but no longer works.  I
> > was thinking that once it is loaded you could call the onModuleLoad
> > function manually, but cannot find how that would work.  Another thing
> > I noticed is that if you do include the script tag twice, it writes
> > the code to the dom twice, but it is only executed once.  If it is by
> > design that you can only run a module once by including the script
> > tag, maybe this ought to be prevented.  I also tried using the cross
> > site linker, which is what i believe i used before to get this to
> > work.
>
> > <module>
> >        <define-linker name="xs" class="com.google.gwt.core.linker.XSLinker"/
>
> >        <add-linker name="xs"/>
>
> >        <inherits name="com.google.gwt.user.User" />
> >        <source path="client" />
>
> >        <define-property values="hello,goodbye,default" name="alerter" />
>
> >        <property-provider name="alerter">
> >                <![CDATA[
> >                        var alerter = $wnd.gwttester_alerter;
> >                        if (alerter == null){
> >                                alerter = "default";
> >                        }
> >                        return alerter;
> >                ]]>
> >        </property-provider>
>
> >        <replace-with class="com.gwt.client.alert.impl.HelloAlerter">
> >                <when-type-is class="com.gwt.client.alert.Alerter" />
> >                <when-property-is name="alerter" value="hello" />
> >        </replace-with>
>
> >        <replace-with class="com.gwt.client.alert.impl.GoodbyeAlerter">
> >                <when-type-is class="com.gwt.client.alert.Alerter" />
> >                <when-property-is name="alerter" value="goodbye" />
> >        </replace-with>
>
> >        <replace-with class="com.gwt.client.alert.impl.DefaultAlerter">
> >                <when-type-is class="com.gwt.client.alert.Alerter" />
> >                <when-property-is name="alerter" value="default" />
> >        </replace-with>
>
> >        <entry-point class="com.gwt.client.GWTClient"></entry-point>
> > </module>
>
> > <html>
> >  <head>
> >    <meta http-equiv="content-type" content="text/html;
> > charset=UTF-8">
> >    <title>index</title>
> >  </head>
> >  <body>
> >        <div>
> >                <script type="text/javascript">var gwttester_alerter = 
> > 'hello';</
> > script>
> >                <script type="text/javascript" language="javascript"
> > src="com.gwt.GWTTester.nocache.js"/>
> >        </div>
> >        <div>
> >                <script type="text/javascript">var gwttester_alerter = 
> > 'goodbye';</
> > script>
> >                <script type="text/javascript" language="javascript"
> > src="com.gwt.GWTTester.nocache.js"/>
> >        </div>
> >  </body>
> > </html>
>
> > --
>
> > 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 
> > athttp://groups.google.com/group/google-web-toolkit?hl=en.
>
> > --
>
> > 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 
> > athttp://groups.google.com/group/google-web-toolkit?hl=en.

--

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