Re: local script variables in nocache.js

2011-02-04 Thread Brett Conoly
Unfortunately that won't work, the portlets aren't in their own frames but
they're loaded twice.  And the problem with using module name to distinguish
them is that they both have the same module name but different
resourceUrls.  The only solution that I think may work is having velocity
replace a local JS variable in the nocache.js.
Thanks

On Thu, Feb 3, 2011 at 11:13 PM, Colin Alworth niloc...@gmail.com wrote:

 In your *.nocache.js content, you say you will have 'this.resourceUrl =
 content-replaced-by-velocity;' – what is 'this' in this context? If it is
 the shared window that all the portlets use, they will each overwrite the
 resourceUrl property. If each portlet will use a different module, you could
 use modulename to set and access this data. This could look something like
 window.MyModuleName.resourceUrl = $resourceUrl
 and then access it in your native method with
 return
 $wnd[@com.google.gwt.core.client.GWT::getModuleName()()].resourceUrl;


 If I have misunderstood and each portlet is in its own iframe, then your
 native call just needs to say 'return $wnd.resourceUrl;' to correctly
 reference the window object that the resourceUrl was set in.

 Hope this helps,
 Colin

 --
 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+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://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-toolkit@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.



Re: local script variables in nocache.js

2011-02-03 Thread bconoly
If it helps any I need the following:

nocache.js:
this.resourceUrl = $resourceUrl;

GWT jsni:
/**
 * Returns the resource url set in nocache.js after it has been
replaced by the template.
 */
private native String getResourceUrl /*-{
return resourceUrl;
}-*/

Thanks

On Feb 2, 8:16 am, bconoly bcon...@gmail.com wrote:
 Hey All,
     I'm using GWT in portlets and I've run into a unique circumstance
 where I have an instanceable porltet being placed multiple times on
 the same page.  Currently the url that I use to make my RPC calls is
 set as a global variable in the page and with 2 or more instances on
 the same page they overwrite each other allowing only one to work.

     I had an idea of pulling the nocache.js file into my velocity
 template so I could place the url variable in it so it is scoped
 locally but I need it as part of the compile.  Is there any way I can
 place a variable into the nocache.js that will be local to each
 instance of the script running?  And if so, how do I get access it
 inside the GWT execution context?

 Thanks in advance,
 Brett

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



Re: local script variables in nocache.js

2011-02-03 Thread Colin Alworth
In your *.nocache.js content, you say you will have 'this.resourceUrl = 
content-replaced-by-velocity;' – what is 'this' in this context? If it is 
the shared window that all the portlets use, they will each overwrite the 
resourceUrl property. If each portlet will use a different module, you could 
use modulename to set and access this data. This could look something like
window.MyModuleName.resourceUrl = $resourceUrl
and then access it in your native method with
return $wnd[@com.google.gwt.core.client.GWT::getModuleName()()].resourceUrl;


If I have misunderstood and each portlet is in its own iframe, then your 
native call just needs to say 'return $wnd.resourceUrl;' to correctly 
reference the window object that the resourceUrl was set in.

Hope this helps,
Colin

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



local script variables in nocache.js

2011-02-02 Thread bconoly
Hey All,
I'm using GWT in portlets and I've run into a unique circumstance
where I have an instanceable porltet being placed multiple times on
the same page.  Currently the url that I use to make my RPC calls is
set as a global variable in the page and with 2 or more instances on
the same page they overwrite each other allowing only one to work.

I had an idea of pulling the nocache.js file into my velocity
template so I could place the url variable in it so it is scoped
locally but I need it as part of the compile.  Is there any way I can
place a variable into the nocache.js that will be local to each
instance of the script running?  And if so, how do I get access it
inside the GWT execution context?

Thanks in advance,
Brett

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