Re: GWT and Map dynamic loading

2010-08-13 Thread Vincent COROLLEUR
Hello,

I still have the problem. I tried to load other scripts and it works.

There is a mechanism from JS maps API that i may not understand or
know.

I should not be the only guy trying this...

Regards,

Vincent

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread Vincent COROLLEUR
Application bugs when the code is reached, i tried DefferedCommand and
i even tried to launch it with a button...
Debug mode won't give me any explaination.

It's been three days i'm on it and i can't see any sunbeam :)

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread cokol
i would use appropriate API for either maps but control them from
above, from the DOM of the browser, so first I'd create two DIV
containers and bind GMaps or OpenLayers to each, depending on the user
selection you can make the one or another container invisible, BUT you
should not consider to clean or remove the maps widgets from the DOM,
just make them disappear by CSS.

as for loading JS code on demand, I'd rather write this subroutine in
JSNI then callback the GWT part to pass control over, this way you
hide the dirty things from GWT - it will work for sure. So just
write your SCRIPTing tag JS loader but in JavaScript as native method.

On 12 Aug., 09:19, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 Application bugs when the code is reached, i tried DefferedCommand and
 i even tried to launch it with a button...
 Debug mode won't give me any explaination.

 It's been three days i'm on it and i can't see any sunbeam :)

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread Vincent COROLLEUR
Hi,

I always tried with JSNI and it's the same... (Unloading module when
scipt is loading)


On Aug 12, 9:35 am, cokol eplisc...@googlemail.com wrote:
 i would use appropriate API for either maps but control them from
 above, from the DOM of the browser, so first I'd create two DIV
 containers and bind GMaps or OpenLayers to each, depending on the user
 selection you can make the one or another container invisible, BUT you
 should not consider to clean or remove the maps widgets from the DOM,
 just make them disappear by CSS.

 as for loading JS code on demand, I'd rather write this subroutine in
 JSNI then callback the GWT part to pass control over, this way you
 hide the dirty things from GWT - it will work for sure. So just
 write your SCRIPTing tag JS loader but in JavaScript as native method.

 On 12 Aug., 09:19, Vincent COROLLEUR vcoroll...@gmail.com wrote:

  Application bugs when the code is reached, i tried DefferedCommand and
  i even tried to launch it with a button...
  Debug mode won't give me any explaination.

  It's been three days i'm on it and i can't see any sunbeam :)

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread cokol
lol, maybe OpenLayer detects and kills Google Maps :-)

On 12 Aug., 09:57, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 Hi,

 I always tried with JSNI and it's the same... (Unloading module when
 scipt is loading)

 On Aug 12, 9:35 am, cokol eplisc...@googlemail.com wrote:



  i would use appropriate API for either maps but control them from
  above, from the DOM of the browser, so first I'd create two DIV
  containers and bind GMaps or OpenLayers to each, depending on the user
  selection you can make the one or another container invisible, BUT you
  should not consider to clean or remove the maps widgets from the DOM,
  just make them disappear by CSS.

  as for loading JS code on demand, I'd rather write this subroutine in
  JSNI then callback the GWT part to pass control over, this way you
  hide the dirty things from GWT - it will work for sure. So just
  write your SCRIPTing tag JS loader but in JavaScript as native method.

  On 12 Aug., 09:19, Vincent COROLLEUR vcoroll...@gmail.com wrote:

   Application bugs when the code is reached, i tried DefferedCommand and
   i even tried to launch it with a button...
   Debug mode won't give me any explaination.

   It's been three days i'm on it and i can't see any sunbeam :)

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread Vincent COROLLEUR
But even if try to load only one map dynamically, it bugs.

It works only by the static way for the moment (script tag in
index.jsp)

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread cokol
maybe you make a change to a DOM node what GWT is aware of and
therefore triggers module unload?
try following function (ready to use) define the function inside JSP

script
function loadJS(url){
var loaderNode = document.createElement(script);
loaderNode.setAttribute(id,ffxep);
loaderNode.setAttribute(type,text/javascript);
(document.getElementsByTagName(head)[0]).appendChild(loaderNode);
loaderNode.setAttribute(src,url);
}
/script

and put invoker to your GWT class:

public native void loadJS(String url)/*-{
 $wnd.loadJS(url);
}-*/;

ensure you have the HEAD tag in your html, and give it a try

it has to work...

On 12 Aug., 11:01, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 But even if try to load only one map dynamically, it bugs.

 It works only by the static way for the moment (script tag in
 index.jsp)

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread Vincent COROLLEUR
I just tried this and it doesn't work, same problem.

I had already tried a similar thing but the JSNI was implemented in
GWT code, same problem anyway :)

I tried to put a javaScript file with basic code on tomcat and it
succed. So the problem doesn't come from the way i load the script.

I think the problem comes from the maps' javascript combined with
dynamic load from GWT. From the javaScript i try to load, there is
other call to scripts, maybe it's a problem... I think there's a
mechanism that i'm not aware.

On Aug 12, 11:18 am, cokol eplisc...@googlemail.com wrote:
 maybe you make a change to a DOM node what GWT is aware of and
 therefore triggers module unload?
 try following function (ready to use) define the function inside JSP

 script
 function loadJS(url){
         var loaderNode = document.createElement(script);
         loaderNode.setAttribute(id,ffxep);
         loaderNode.setAttribute(type,text/javascript);
         (document.getElementsByTagName(head)[0]).appendChild(loaderNode);
         loaderNode.setAttribute(src,url);}

 /script

 and put invoker to your GWT class:

 public native void loadJS(String url)/*-{
  $wnd.loadJS(url);

 }-*/;

 ensure you have the HEAD tag in your html, and give it a try

 it has to work...

 On 12 Aug., 11:01, Vincent COROLLEUR vcoroll...@gmail.com wrote:

  But even if try to load only one map dynamically, it bugs.

  It works only by the static way for the moment (script tag in
  index.jsp)

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread cokol
this indeed could be the case, never seen that such things refuse to
work - but we're ont done yet, please try to defer loading the script
upon button click - just to be sure browser loaded and initialized, so
create a button and load the script from that onClickHandler()

if still would ont work, then I'd blame maps' script ;)  btw. when
serioously think about loading js on demand I'd suggest to try out
RequireJS rom http://requirejs.org/

reg,

On 12 Aug., 11:38, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 I just tried this and it doesn't work, same problem.

 I had already tried a similar thing but the JSNI was implemented in
 GWT code, same problem anyway :)

 I tried to put a javaScript file with basic code on tomcat and it
 succed. So the problem doesn't come from the way i load the script.

 I think the problem comes from the maps' javascript combined with
 dynamic load from GWT. From the javaScript i try to load, there is
 other call to scripts, maybe it's a problem... I think there's a
 mechanism that i'm not aware.

 On Aug 12, 11:18 am, cokol eplisc...@googlemail.com wrote:



  maybe you make a change to a DOM node what GWT is aware of and
  therefore triggers module unload?
  try following function (ready to use) define the function inside JSP

  script
  function loadJS(url){
          var loaderNode = document.createElement(script);
          loaderNode.setAttribute(id,ffxep);
          loaderNode.setAttribute(type,text/javascript);
          (document.getElementsByTagName(head)[0]).appendChild(loaderNode);
          loaderNode.setAttribute(src,url);}

  /script

  and put invoker to your GWT class:

  public native void loadJS(String url)/*-{
   $wnd.loadJS(url);

  }-*/;

  ensure you have the HEAD tag in your html, and give it a try

  it has to work...

  On 12 Aug., 11:01, Vincent COROLLEUR vcoroll...@gmail.com wrote:

   But even if try to load only one map dynamically, it bugs.

   It works only by the static way for the moment (script tag in
   index.jsp)

-- 
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.



Re: GWT and Map dynamic loading

2010-08-12 Thread Vincent COROLLEUR
It's the same when i load on a button click.

I ll take a look at requireJS.

Thank you for your help !

On Aug 12, 11:47 am, cokol eplisc...@googlemail.com wrote:
 this indeed could be the case, never seen that such things refuse to
 work - but we're ont done yet, please try to defer loading the script
 upon button click - just to be sure browser loaded and initialized, so
 create a button and load the script from that onClickHandler()

 if still would ont work, then I'd blame maps' script ;)  btw. when
 serioously think about loading js on demand I'd suggest to try out
 RequireJS romhttp://requirejs.org/

 reg,

 On 12 Aug., 11:38, Vincent COROLLEUR vcoroll...@gmail.com wrote:

  I just tried this and it doesn't work, same problem.

  I had already tried a similar thing but the JSNI was implemented in
  GWT code, same problem anyway :)

  I tried to put a javaScript file with basic code on tomcat and it
  succed. So the problem doesn't come from the way i load the script.

  I think the problem comes from the maps' javascript combined with
  dynamic load from GWT. From the javaScript i try to load, there is
  other call to scripts, maybe it's a problem... I think there's a
  mechanism that i'm not aware.

  On Aug 12, 11:18 am, cokol eplisc...@googlemail.com wrote:

   maybe you make a change to a DOM node what GWT is aware of and
   therefore triggers module unload?
   try following function (ready to use) define the function inside JSP

   script
   function loadJS(url){
           var loaderNode = document.createElement(script);
           loaderNode.setAttribute(id,ffxep);
           loaderNode.setAttribute(type,text/javascript);
           
   (document.getElementsByTagName(head)[0]).appendChild(loaderNode);
           loaderNode.setAttribute(src,url);}

   /script

   and put invoker to your GWT class:

   public native void loadJS(String url)/*-{
    $wnd.loadJS(url);

   }-*/;

   ensure you have the HEAD tag in your html, and give it a try

   it has to work...

   On 12 Aug., 11:01, Vincent COROLLEUR vcoroll...@gmail.com wrote:

But even if try to load only one map dynamically, it bugs.

It works only by the static way for the moment (script tag in
index.jsp)

-- 
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.



GWT and Map dynamic loading

2010-08-11 Thread Vincent COROLLEUR
Hello,

In my application, users can choose between two different map : google
map or OpenLayers. I'd like to load dynamically the chosen one by
loading the corresponding script (in this exemple google map).

I tried this (in the EntryPoint) :

ScriptElement script1 = Document.get().createScriptElement();
script1.setType(text/javascript);
script1.setSrc(http://maps.google.com/maps?
file=apiv=2sensor=falsekey=ABQIpOR5tulUc5y1R6lOKFkbpRTwM0brOpm-
All5BF6PoaKBxRWWERTqbaRJ6lpQdSlaltvv3tD-fLXwvQ);

Document.get().getElementsByTagName(head).getItem(0).appendChild(script1);

ScriptElement script2 = Document.get().createScriptElement();
script2.setType(text/javascript);

script2.setSrc(http://mapstraction.googlecode.com/svn/trunk/source/
mxn.js?(google));

Document.get().getElementsByTagName(head).getItem(0).appendChild(script2);

This code makes my application unloading... (message : Unloading
module).

I don't understand the problem. Is there a way to realize this ?

Vincent COROLLEUR



-- 
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.



Re: GWT and Map dynamic loading

2010-08-11 Thread Eric Ayers
That error message doesn't look familiar.  Where do you see the
message?  Are you running in development mode or web mode?

If you want to dynamically load the Google Maps API, you can use the
gwt-google-apis maps library Maps.loadMapsApi() method:

http://gwt-google-apis.googlecode.com/svn/javadoc/maps/1.1/com/google/gwt/maps/client/Maps.html

or the AjaxLoader classs directly:

http://gwt-google-apis.googlecode.com/svn/javadoc/ajaxloader/1.1/com/google/gwt/ajaxloader/client/AjaxLoader.html

If you want to see how Maps.loadMapsApi to injects a script tag, take
a look at the implementation of the AjaxLoader class.

http://www.google.com/codesearch/p?hl=en#ow6Lmd7dcZY/trunk/ajaxloader/ajaxloader/src/com/google/gwt/ajaxloader/client/AjaxLoader.java

It is pretty much the same, only it puts the script tag on the BODY
element, and has logic to wait for the tag to be loaded by using a
callback.


On Wed, Aug 11, 2010 at 3:26 AM, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 Hello,

 In my application, users can choose between two different map : google
 map or OpenLayers. I'd like to load dynamically the chosen one by
 loading the corresponding script (in this exemple google map).

 I tried this (in the EntryPoint) :

                ScriptElement script1 = Document.get().createScriptElement();
                script1.setType(text/javascript);
                script1.setSrc(http://maps.google.com/maps?
 file=apiv=2sensor=falsekey=ABQIpOR5tulUc5y1R6lOKFkbpRTwM0brOpm-
 All5BF6PoaKBxRWWERTqbaRJ6lpQdSlaltvv3tD-fLXwvQ);

 Document.get().getElementsByTagName(head).getItem(0).appendChild(script1);

                ScriptElement script2 = Document.get().createScriptElement();
                script2.setType(text/javascript);
                
 script2.setSrc(http://mapstraction.googlecode.com/svn/trunk/source/
 mxn.js?(google));

 Document.get().getElementsByTagName(head).getItem(0).appendChild(script2);

 This code makes my application unloading... (message : Unloading
 module).

 I don't understand the problem. Is there a way to realize this ?

 Vincent COROLLEUR



 --
 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.





-- 
Eric Z. Ayers
Google Web Toolkit, Atlanta, GA USA

-- 
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.



Re: GWT and Map dynamic loading

2010-08-11 Thread Vincent COROLLEUR
Hello,

I'm trying this in hosted mode (development mode). I can see this
error in the Eclipse console.
If i use Goodle map API, i will not be able to load the other king of
map i need to use.

I tried many way to load these javascript files dynamically with an
URL as argument but it's always the same error.

 Module is loading normaly and when the code is reached, it unloads
the application.

Regards,

Vincent COROLLEUR

-- 
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.



Re: GWT and Map dynamic loading

2010-08-11 Thread Eric Ayers
The gwt-maps API allows you to defer loading of the Maps API.  The
Maps API will not actually be download until you call
Maps.loadMapsApi()

Regardless, what I think is happening is that your code is failing in a static
initializer or before the onModuleLoad() returns.

One way to debug this is to put all of your startup logic into a
different method, and then invoke the method via a Timer or
DeferredCommand.  if your code is failing before onModuleLoad()
returns, you'll likely get a better stack trace.

You can also just set your IDE debugger to stop in onModuleLoad and
trace through it until it throws an exception.

On Wed, Aug 11, 2010 at 11:14 AM, Vincent COROLLEUR
vcoroll...@gmail.com wrote:
 Hello,

 I'm trying this in hosted mode (development mode). I can see this
 error in the Eclipse console.
 If i use Goodle map API, i will not be able to load the other king of
 map i need to use.

 I tried many way to load these javascript files dynamically with an
 URL as argument but it's always the same error.

  Module is loading normaly and when the code is reached, it unloads
 the application.

 Regards,

 Vincent COROLLEUR

 --
 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.





-- 
Eric Z. Ayers
Google Web Toolkit, Atlanta, GA USA

-- 
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.