Hi there
Thats an interesting approach I've never actually called GWT methods
that way.
It looks like from your code that you're calling it that way because
you need to pass a parameter? Is this correct?
I think with GWT you have must have an entry point so that the script
gets loaded and that may be the reason you cannot access the
function?
In the past I have used a hidden div with inner content to pass
parameters to the GWT application like so:
<div id="myParamsDiv">
myParamValue
</div>
RootPanel paramsDiv = RootPanel.get("myParamsDiv");
String paramsText = DOM.getInnerText(paramsDiv.getElement()); //
paramsText would equal myParamValue
Then the entry point would run as normal?
Also have you tried debugging the script on Firefox using Firebug -
I'm aware that as it goes to the GWT script you wont be able to debug
that easily but you should be able to debug your callGWTUtils function
and you can check that all the variables exist?
eggsy
On Nov 19, 12:47 pm, "Manish Kumar" <[EMAIL PROTECTED]> wrote:
> Hi
>
> As asked , please have a look at my code :
>
> GWT :
>
> public void onModuleLoad(){
>
> try
>
> {
>
> exportStaticMethod(this);
>
> }
>
> catch(Exception re)
>
> {
>
> MessageBox.alert(re.getMessage());
>
> }
> }
>
> public native void exportStaticMethod(PMGWTHtmlUtils pmGWTHtmlUtils)
>
> /*-{
>
> $wnd.invokeGWT = function(bId,cId,mId,mName,cName)
>
> {
>
> [EMAIL
> PROTECTED]::invokeGWT(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)(bId,cId,mId,mName,cName);
>
> };
>
> if($wnd.callGWTUtils){
>
> $wnd.callGWTUtils();
>
> }
> }-*/;
>
> public void invokeGWT( String bId,String cId,String mId,String mName,String
> cName ) throws RequestException {
>
> System.out.println( " xxxxxxxxxxxxxxxxxxxxxxxxxxxx :"+ bId);
>
> if(bId.equalsIgnoreCase("new"))
>
> {
>
> window = new Window();
>
> BorderLayoutData centerData = new BorderLayoutData(RegionPosition.CENTER);
>
> window.setTitle("Layout Window");
>
> //window.setClosable(true);
>
> window.setWidth(600);
>
> window.setHeight(500);
>
> window.setPlain(true);
>
> window.setLayout(new BorderLayout());
>
> window.add(createAddCommentForm( "c0","c7","Test Process Model","process
> overview") ,centerData);
>
> //window.setCloseAction(Window.HIDE);
>
> window.show();
>
> }
>
> else if(bId.equalsIgnoreCase("view"))
>
> {
>
> String destUrl = PMServerUrl + "processmaster/comments/"+mName+".xml";
>
> doViewCommentRequest(destUrl);
>
> }
> }
>
> After compiling the gwt component , I am trying to use this in HTML stuffs :
>
> <script type="text/javascript" src="../js/pmxslutils.js"></script>
>
> <script language="javascript"
> src="com.pm.output.html.gwt.model.comment.PMGWTHtmlUtils.nocache.js"></script>
>
> // pmxslutils.js
>
> function callGWTUtils( bttnId ) // This method id called on button click on
> HTML.
> {
> if( currDispId != null )
> {
> invokeGWT( bttnId,this.currDispId,this.mId,this.mName,this.currDispName
> );// This is the vative method.
>
> }
> }
>
> Please let us know if this does not make sense.
>
> Regards,
> Manish
>
> ----- Original Message -----
> From: "eggsy84" <[EMAIL PROTECTED]>
> To: "Google Web Toolkit" <[email protected]>
> Sent: Wednesday, November 19, 2008 4:50 PM
> Subject: Re: how to work with xs-linker in gwt
>
> Can you share any code? I'm not too clear on what you're trying to do?
>
> On Nov 19, 9:53 am, "Manish Kumar" <[EMAIL PROTECTED]> wrote:
> > Hi,
>
> > I am trying the same, But unfortunately this does not work.
> > Please have a check on my approach , Though I am not suspected.
>
> > I have put my compiled code in my required directory and
> > included nocache.js to html stuffs then i am calling a native
> > function defined in GWT component.This does not make a call to
> > respective function.
>
> > Please correct me if i am wrong in my approach.
> > Regards,
> > Manish
>
> > ----- Original Message -----
> > From: "eggsy84" <[EMAIL PROTECTED]>
> > To: "Google Web Toolkit" <[email protected]>
> > Sent: Wednesday, November 19, 2008 2:36 PM
> > Subject: Re: how to work with xs-linker in gwt
>
> > Hi there
>
> > No thats fine you can compile your GWT into Java using the GWT Hosted
> > browser and providing you have the linker this will compile Cross Site
> > compatible Javascript and then you can include the compiled up
> > Javascript on any HTML page.
>
> > EG: You may compile your GWT application up on machine A then make a
> > web page on machine B and include the compiled up javascript file from
> > Machine A on the web page on machine B.
>
> > What doesn't work is when you try to communicate with a foreign server
> > within hosted mode so basically when you're testing before you compile
> > your Java to javascript you have to communicate with a server on the
> > local machine.
>
> > Regards,
>
> > Eggsy
>
> > On Nov 19, 5:50 am, "Manish Kumar" <[EMAIL PROTECTED]> wrote:
> > > Hi,
>
> > > I have just taken a look on the link content, this seems quite useful.I
> > > will
> > > go through in details now.
>
> > > Thanks for much needed stuffs floated on the web.
> > > Do you mean that we can not do xs-compile in hosted mode.We understand
> > > that
> > > we would have to test on different browser.
> > > The way i want to do is that we want to include nocache.js to our HTML
> > > stuffs and call a JNSI method to invoke GWT utilities.
>
> > > Please correct me if i am wrong in my understanding.
>
> > > Regards
> > > Manish
>
> > > ----- Original Message -----
> > > From: "eggsy84" <[EMAIL PROTECTED]>
> > > To: "Google Web Toolkit" <[email protected]>
> > > Sent: Tuesday, November 18, 2008 3:09 PM
> > > Subject: Re: how to work with xs-linker in gwt
>
> > > Also I don't think (at the time of writing) that GWT hosted mode
> > > browser has Cross Site mode functionality so you may have to keep
> > > compiling your widget and testing within a browser. Or simply set up a
> > > test environment (tomcat locally or something) on your local machine.
>
> > > Eggsy
>
> > > On Nov 18, 9:25 am, eggsy84 <[EMAIL PROTECTED]> wrote:
> > > > Hi there
>
> > > > To compile the application for Cross site you simply add <add-linker
> > > > name="xs" />
> > > > to your gwt.xml file.
>
> > > > In GWT 1.5 this now doesn't create xs-nocache.js it simply creates the
> > > > javascript as normal but it will be the xs version. (Took me a while
> > > > to realise this as well)
>
> > > > I had to do the same thing for a client and make a widget that could
> > > > be deployed on various machines - I wrote a quick tutorial with links
> > > > here
>
> > > >http://eggsylife.blogspot.com/2008/10/gwt-and-cross-site-jsonp-in-j2e...
>
> > > > Hope this helps
>
> > > > eggsy
>
> > > > On Nov 18, 8:49 am, "Manish Kumar" <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > While working to make a call to GWT from a eternal HTML using JSNI
> > > > > method , I am trying to compile our code using xs-linker.
>
> > > > > I don't understand why this does not work. I made an entry in for
> > > > > xs-linker in -gwt.xml then compile the our code in hosted browser.
> > > > > Can anybody please hint me what I am missing?
>
> > > > > One more thing I would like to confirm with all of you about my
> > > > > approach.
> > > > > My sole purpose is to add our compiled javascript code to HTML(
> > > > > external ) at any location. The way I expected is that my JSNI method
> > > > > will be available in xs-nocache.js (included in HTML).
>
> > > > > Can anybody please confirm on this?
>
> > > > > Regards,
>
> > > > > Manish
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---