Re: Script tag dynamic loading

2010-08-16 Thread Vincent COROLLEUR
Thx you Cokol for your proposal but my project is confidential.

If you wanna give a try by yourself, you just have to paste this code
in a whatever project.

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);

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: Script tag 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: Script tag dynamic loading

2010-08-13 Thread cokol
cross domain policy does not apply for some certain resources like
javascript or images, so this is not the problem, you have to append
the script element to the HEAD element, not to the BODY

On 13 Aug., 11:56, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 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: Script tag dynamic loading

2010-08-13 Thread cokol
..but watch out, in case you have a code depending on A.js you cannot
run it directly after loadJS(A.js) - it will not work, since
loadJS() is always asynchronously loaded, meaning you code is executed
whilst A.js has not been loaded yet, you have to work with callbacks
to proceed executing AFTER A.js has been loaded

this is a little bit tricky, since SCRIPT tag does not allow you cross-
browser to hook in to know if code is loaded, but there some
strategies for it we can discuss if your problem really relates to the
async control flow..


On 13 Aug., 12:43, cokol eplisc...@googlemail.com wrote:
 cross domain policy does not apply for some certain resources like
 javascript or images, so this is not the problem, you have to append
 the script element to the HEAD element, not to the BODY

 On 13 Aug., 11:56, Vincent COROLLEUR vcoroll...@gmail.com wrote:



  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: Script tag dynamic loading

2010-08-13 Thread Vincent COROLLEUR
I tried to load the script on a button event and it's the same...

Really annoying

-- 
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: Script tag dynamic loading

2010-08-13 Thread cokol
maybe u can expose me your eclipse project and I can try to resolve it
locally...? if u dont mind

On 13 Aug., 13:57, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 I tried to load the script on a button event and it's the same...

 Really annoying

-- 
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: Script tag dynamic loading

2010-08-13 Thread lineman78
I have run into this problem with a few scripts that rely on the
document load event, maybe look into manually firing it.  I think I
tried dynamic loading of the maps library before and gave up, but I
didn't try very hard to get it working.

On Aug 13, 5:57 am, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 I tried to load the script on a button event and it's the same...

 Really annoying

-- 
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: Script tag dynamic loading

2010-08-10 Thread Vincent COROLLEUR
hi,

I have to load different types of map depending on the user. I can't
use gwt-maps API because its only supports Google Maps API version 2
and i need to load OpenLayers in some case. I used to load google map
or openLayers by the static way but now i need to load them
dynamically (so from the JAVA code depending of the user database
parameters).

I saw many times on internet that you can load dynamically script from
JAVA code, i tried and its work but not with a script with a URL value
for the src argument.

I tried this :

Element script1 = DOM.createElement(script);
script1.setAttribute(type, text/javascript);
script1.setAttribute(src, URL);
RootPanel.getBodyElement().appendChild(script1);

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: Script tag dynamic loading

2010-08-10 Thread Vincent COROLLEUR
I think it doesnt work bacause of the cross-domain protection. Have
you got any ideas ?

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: Script tag dynamic loading

2010-08-09 Thread mooreds
Hi Vincent,

You might want to look at this project:

http://code.google.com/p/gwt-google-apis/wiki/MapsGettingStarted

This not only has gwt bindings for google maps, but also has a way to
load the API dynamically (using the ajax loader):
http://gwt-google-apis.googlecode.com/svn/javadoc/maps/1.1/com/google/gwt/maps/client/Maps.html#loadMapsApi(java.lang.String,%20java.lang.String,%20boolean,%20java.lang.Runnable)

This works like a charm for me.

Thanks,
Dan

On Aug 9, 4:33 am, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 Hello,

 I'am trying to load dynamically with GWT some scripts in order to use
 google map API V2.

 By the static way it works (script tag in the index.jsp page) :

         script src=http://maps.google.com/maps?
 file=apiamp;v=2amp;sensor=true_or_falseamp;key=ABQIpOR5tulUc5y1R6lOK 
 FkbpRTwM0brOpm-
 All5BF6PoaKBxRWWERTqbaRJ6lpQdSlaltvv3tD-fLXwvQ type=text/
 javascript/script

 I tried this to do it dynamically (from the EntryPoint) but it doesn't
 work :

 Element script1 = DOM.createElement(script);
 script1.setAttribute(type, text/javascript);
 script1.setAttribute(src, http://maps.google.com/maps?
 file=apiv=2sensor=falsekey=ABQIpOR5tulUc5y1R6lOKFkbpRTwM0brOpm-
 All5BF6PoaKBxRWWERTqbaRJ6lpQdSlaltvv3tD-fLXwvQ);
 RootPanel.getBodyElement().appendChild(script1);

 This code leads to an error when it's loaded (Unloading module) :
 its unload my application module.

 I am still looking for a way to load dynamically google map.

 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: Script tag dynamic loading

2010-08-09 Thread Vincent COROLLEUR
Thx for your help mooreds, but i need to run google map without JAR, i
have to load it with a script.

This script is reachable with an URL. Before, i used to do it with a
script tag placed in the index.jsp as explained previously.

Now the user of my application can choose his type of map (google map,
openLayers...), so i want to load only the script corresponding
to the map API choosed.

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: Script tag dynamic loading

2010-08-09 Thread mooreds
I don't understand?

The gwt maps project is GWT.  Do you want to load the map via GWT, or
before GWT loads?  If after GWT loads, you could definitely load or
not load based on some user input.

Dan

On Aug 9, 9:39 am, Vincent COROLLEUR vcoroll...@gmail.com wrote:
 Thx for your help mooreds, but i need to run google map without JAR, i
 have to load it with a script.

 This script is reachable with an URL. Before, i used to do it with a
 script tag placed in the index.jsp as explained previously.

 Now the user of my application can choose his type of map (google map,
 openLayers...), so i want to load only the script corresponding
 to the map API choosed.

 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.