Re: how to pass hash map to native java script method

2011-06-12 Thread rsutton
My Apologies and thank you Thomas. This is perfect. I failed to see
that you had added the alternate code to the quote.

Thanks again.

Robert.

On Jun 11, 1:32 am, Thomas Broyer t.bro...@gmail.com wrote:
 Wouldn't it be easier to rewrite your openReportWindow in Java rather than
 JSNI?

 On Thursday, June 9, 2011 3:19:05 AM UTC+2, rsutton wrote:

    var form = document.createElement(form);

 FormElement form = Document.get().createFormElement();

    form.setAttribute(method, post);

 form.setAttribute(method, post);
 or
 form.setMethod(post); (would be the equivalent of form.method='post' in
 JS)

    form.setAttribute(action, action);
      // setting form target to a window named
  'formresult'
    form.setAttribute(target, _blank);
      for (var i=0; ivalues.length; i++) {

 for (Map.EntryString, String entry : values) {

         var hiddenField = document.createElement(input);

 InputElement hiddenField = Document.get().createHiddenInputElement();

                  hiddenField.setAttribute(name, values[i].name);

 input.setName(entry.getKey());

               hiddenField.setAttribute(value, values[i].value);

 input.setValue(entry.getValue());

                  form.appendChild(hiddenField);

 form.appendChild(hiddenField);

    }
    document.body.appendChild(form);

 Document.get().getBody().appendChild(form);

    form.submit();

 form.submit();

    document.body.removeChild(form);

 form.removeFromParent(); // this is a very handy shortcut provided by GWT!   
 }-*/;

-- 
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: how to pass hash map to native java script method

2011-06-10 Thread rsutton
when I do a post from gwt, the generated html page is returned in an
object. there are 2 problems with this.

1. I want the browser to render the returned page
2. this report could be excess of 1GB.

-- 
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: how to pass hash map to native java script method

2011-06-10 Thread rsutton
OK, I'll try this.

Thanks

On Jun 11, 12:03 am, Derek derekad...@gmail.com wrote:
 Actually I don't think it's as simple as you'd think. Gwt java objects
 are pretty opaque to JSNI. Depending on what you need, i'd suggest
 using JSONObject as a replacement for HashMap. That should probably
 work for you.

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



how to pass hash map to native java script method

2011-06-09 Thread rsutton
I am trying to pass a Hashmap to a native method as can be seen below.
I have been unable to find any suitable example code. Any assistance
would be greatly appreciated.

I know this is simple, I just haven't done it before.

Thanks.


public void onClick(ClickEvent event)
{
MapString, String params = new HashMapString, String();
params.putAll(definition.getParams());

   this is where my problem is, how to convert the params
object to a suitable
   object to work with the native openReportWindow method

openReportWindow(definition.getReportServletName(), params);
}

private static native void openReportWindow(String action,  values) /*-
{
   var form = document.createElement(form);
   form.setAttribute(method, post);
   form.setAttribute(action, action);


   // setting form target to a window named
'formresult'
   form.setAttribute(target, _blank);


   for (var i=0; ivalues.length; i++) {
var hiddenField = document.createElement(input);
hiddenField.setAttribute(name, values[i].name);
hiddenField.setAttribute(value, values[i].value);
form.appendChild(hiddenField);
   }
   document.body.appendChild(form);
   form.submit();
   document.body.removeChild(form);
   }-*/;

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