Tuesday, November 8, 2016

Re: Get data from a JavaScriptObject

with @jsinterop you can (untested of course)

@JsType(isNative = true)
public class JavaScriptFile {
  public String filename;
  public String anotherMember;
}

then __if__ you can cast JavaScriptObject to the @jsinterop type you can acces its fields directly.

with jsni you can do that (also untested)

public native String getFile(JavaScriptObject jsfile) /*-{
   return jsfile.filename;
}-*;

Afaik JSNI is not the proffered way of doing things in the GWT world.

Hope that helps


On Tue, Nov 8, 2016 at 1:49 PM, Rodolfo Raya <rmraya@gmail.com> wrote:

Hi,

I'm trying to use GWT Polymer from Vaadin and JavaScriptObject is killing me.

The Upload widget returns a JavaScript object that is supposed to be a JavaScript 'File' and I can't extract the file name from it. How can I convert this JavaScriptObject to a useful Java object? 

Many thanks in advance,

Rodolfo M. Raya

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment