Re: JSNI Question

2016-02-05 Thread salk31
I didn't know that, are there bug reports I could get the details from?

On Friday, February 5, 2016 at 5:23:42 AM UTC, Stepan Koltsov wrote:
>
> Except there are lots of things that are not possible via jsinterop. (Or 
> maybe possible, but hard to find how to do it).
>
> For example:
>
> * JsArray still requires type parameter to extend JavaScriptObject, so you 
> cannot work with cannot work with arrays of @JsType
>
> * you cannot do index without JSNI (you cannot express foo[bar] in 
> jsinterop without JSNI and @JsOverlay).
>
> * you cannot catch `this` argument in function callback (which is used 
> heavily in jquery).
>
> -- 
> Stepan
>
>
> On Thursday, January 14, 2016 at 2:21:07 PM UTC+3, salk31 wrote:
>>
>> NB JSNI is being replaced by JsInterop... it is much nicer so if you are 
>> starting new code I'd strongly recommend you use it rather than JSNI.
>>
>> On Sunday, January 10, 2016 at 8:00:30 AM UTC, Gourab wrote:
>>>
>>> Let me understand your question.
>>>
>>> - You have a GWT application, where you want to expose few 
>>> functionality/UI via JavaScript Api.
>>>
>>> If thats what you want to achieve:
>>>
>>> - Can you check if you have  
>>> in the gwt module where the API is exposed ?
>>> - I dont think you need to prefaced anything with $wnd
>>>
>>> Regards
>>> Gourab.
>>>
>>>
>>>
>>>
>>> On Sat, Jan 9, 2016 at 10:00 PM, Eric Nissan  wrote:
>>>
 I never got a response to this.  Anyone know if this is an issue?

 Any help would be appreciated.

 Thanks,
 Eric


 On Tuesday, December 29, 2015 at 5:55:28 PM UTC-5, Eric Nissan wrote:
>
> I am using JSNI to reference a javascript library.  My initial call is 
> fine, but then somewhere down they chain I get a null pointer inside the 
> javascript library.
>
> I am referencing the library like this
>
> $wnd.TradingView.widget({});
>
> which is a valid reference.  
>
> This then seems to load in other javascript files.  the object it 
> loads are not referenced as $wnd (because that is a GWT thing), and I 
> eventually get a "cannot read property 'init' of undefined".
>
> My question is, could this be causing my problems?  
> for example I am getting this error on this call.  Is this because it 
> is not prefaced with $wnd?
> $.i18n.init({})
>
 -- 
 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+unsubscr...@googlegroups.com.
 To post to this group, send email to google-we...@googlegroups.com.
 Visit this group at https://groups.google.com/group/google-web-toolkit.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>

-- 
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+unsubscr...@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.


Re: JSNI Question

2016-02-04 Thread Stepan Koltsov
Except there are lots of things that are not possible via jsinterop. (Or 
maybe possible, but hard to find how to do it).

For example:

* JsArray still requires type parameter to extend JavaScriptObject, so you 
cannot work with cannot work with arrays of @JsType

* you cannot do index without JSNI (you cannot express foo[bar] in 
jsinterop without JSNI and @JsOverlay).

* you cannot catch `this` argument in function callback (which is used 
heavily in jquery).

-- 
Stepan


On Thursday, January 14, 2016 at 2:21:07 PM UTC+3, salk31 wrote:
>
> NB JSNI is being replaced by JsInterop... it is much nicer so if you are 
> starting new code I'd strongly recommend you use it rather than JSNI.
>
> On Sunday, January 10, 2016 at 8:00:30 AM UTC, Gourab wrote:
>>
>> Let me understand your question.
>>
>> - You have a GWT application, where you want to expose few 
>> functionality/UI via JavaScript Api.
>>
>> If thats what you want to achieve:
>>
>> - Can you check if you have  
>> in the gwt module where the API is exposed ?
>> - I dont think you need to prefaced anything with $wnd
>>
>> Regards
>> Gourab.
>>
>>
>>
>>
>> On Sat, Jan 9, 2016 at 10:00 PM, Eric Nissan  wrote:
>>
>>> I never got a response to this.  Anyone know if this is an issue?
>>>
>>> Any help would be appreciated.
>>>
>>> Thanks,
>>> Eric
>>>
>>>
>>> On Tuesday, December 29, 2015 at 5:55:28 PM UTC-5, Eric Nissan wrote:

 I am using JSNI to reference a javascript library.  My initial call is 
 fine, but then somewhere down they chain I get a null pointer inside the 
 javascript library.

 I am referencing the library like this

 $wnd.TradingView.widget({});

 which is a valid reference.  

 This then seems to load in other javascript files.  the object it loads 
 are not referenced as $wnd (because that is a GWT thing), and I eventually 
 get a "cannot read property 'init' of undefined".

 My question is, could this be causing my problems?  
 for example I am getting this error on this call.  Is this because it 
 is not prefaced with $wnd?
 $.i18n.init({})

>>> -- 
>>> 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+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-we...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/google-web-toolkit.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
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+unsubscr...@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.


Re: JSNI Question

2016-01-14 Thread salk31
NB JSNI is being replaced by JsInterop... it is much nicer so if you are 
starting new code I'd strongly recommend you use it rather than JSNI.

On Sunday, January 10, 2016 at 8:00:30 AM UTC, Gourab wrote:
>
> Let me understand your question.
>
> - You have a GWT application, where you want to expose few 
> functionality/UI via JavaScript Api.
>
> If thats what you want to achieve:
>
> - Can you check if you have  
> in the gwt module where the API is exposed ?
> - I dont think you need to prefaced anything with $wnd
>
> Regards
> Gourab.
>
>
>
>
> On Sat, Jan 9, 2016 at 10:00 PM, Eric Nissan  > wrote:
>
>> I never got a response to this.  Anyone know if this is an issue?
>>
>> Any help would be appreciated.
>>
>> Thanks,
>> Eric
>>
>>
>> On Tuesday, December 29, 2015 at 5:55:28 PM UTC-5, Eric Nissan wrote:
>>>
>>> I am using JSNI to reference a javascript library.  My initial call is 
>>> fine, but then somewhere down they chain I get a null pointer inside the 
>>> javascript library.
>>>
>>> I am referencing the library like this
>>>
>>> $wnd.TradingView.widget({});
>>>
>>> which is a valid reference.  
>>>
>>> This then seems to load in other javascript files.  the object it loads 
>>> are not referenced as $wnd (because that is a GWT thing), and I eventually 
>>> get a "cannot read property 'init' of undefined".
>>>
>>> My question is, could this be causing my problems?  
>>> for example I am getting this error on this call.  Is this because it is 
>>> not prefaced with $wnd?
>>> $.i18n.init({})
>>>
>> -- 
>> 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+unsubscr...@googlegroups.com .
>> To post to this group, send email to google-we...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/google-web-toolkit.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@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.


Re: JSNI Question

2016-01-10 Thread Gourab Panda
Let me understand your question.

- You have a GWT application, where you want to expose few functionality/UI
via JavaScript Api.

If thats what you want to achieve:

- Can you check if you have  in
the gwt module where the API is exposed ?
- I dont think you need to prefaced anything with $wnd

Regards
Gourab.




On Sat, Jan 9, 2016 at 10:00 PM, Eric Nissan  wrote:

> I never got a response to this.  Anyone know if this is an issue?
>
> Any help would be appreciated.
>
> Thanks,
> Eric
>
>
> On Tuesday, December 29, 2015 at 5:55:28 PM UTC-5, Eric Nissan wrote:
>>
>> I am using JSNI to reference a javascript library.  My initial call is
>> fine, but then somewhere down they chain I get a null pointer inside the
>> javascript library.
>>
>> I am referencing the library like this
>>
>> $wnd.TradingView.widget({});
>>
>> which is a valid reference.
>>
>> This then seems to load in other javascript files.  the object it loads
>> are not referenced as $wnd (because that is a GWT thing), and I eventually
>> get a "cannot read property 'init' of undefined".
>>
>> My question is, could this be causing my problems?
>> for example I am getting this error on this call.  Is this because it is
>> not prefaced with $wnd?
>> $.i18n.init({})
>>
> --
> 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+unsubscr...@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.
>

-- 
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+unsubscr...@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.


Re: JSNI Question

2016-01-09 Thread Eric Nissan
I never got a response to this.  Anyone know if this is an issue?

Any help would be appreciated.

Thanks,
Eric

On Tuesday, December 29, 2015 at 5:55:28 PM UTC-5, Eric Nissan wrote:
>
> I am using JSNI to reference a javascript library.  My initial call is 
> fine, but then somewhere down they chain I get a null pointer inside the 
> javascript library.
>
> I am referencing the library like this
>
> $wnd.TradingView.widget({});
>
> which is a valid reference.  
>
> This then seems to load in other javascript files.  the object it loads 
> are not referenced as $wnd (because that is a GWT thing), and I eventually 
> get a "cannot read property 'init' of undefined".
>
> My question is, could this be causing my problems?  
> for example I am getting this error on this call.  Is this because it is 
> not prefaced with $wnd?
> $.i18n.init({})
>

-- 
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+unsubscr...@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.


JSNI Question

2015-12-29 Thread Eric Nissan
I am using JSNI to reference a javascript library.  My initial call is 
fine, but then somewhere down they chain I get a null pointer inside the 
javascript library.

I am referencing the library like this

$wnd.TradingView.widget({});

which is a valid reference.  

This then seems to load in other javascript files.  the object it loads are 
not referenced as $wnd (because that is a GWT thing), and I eventually get 
a "cannot read property 'init' of undefined".

My question is, could this be causing my problems?  
for example I am getting this error on this call.  Is this because it is 
not prefaced with $wnd?
$.i18n.init({})

-- 
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+unsubscr...@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.


Re: JSNI Question

2012-12-20 Thread Thomas Broyer

On Thursday, December 20, 2012 1:10:00 AM UTC+1, EMan wrote:
>
> How do I call a JSNI method from another JSNI Method?  for example, how 
> can I get something1 to call something2?
>
> public static native void something1() /*-{
> something2();
> }-*/;
>
> public static native void something2() /*-{
> $wind.alert("something2");
> }-*/;
>
> Thanks.
>

Like any other Java method:

public static native void something1() /*-{
   @my.app.client.MyClass::something2()();
}-*/;

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/9ELMpVi89VAJ.
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.



JSNI Question

2012-12-19 Thread EMan
How do I call a JSNI method from another JSNI Method?  for example, how can 
I get something1 to call something2?

public static native void something1() /*-{
something2();
}-*/;

public static native void something2() /*-{
$wind.alert("something2");
}-*/;

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Ng_ggqLt1jUJ.
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.



JSNI question

2010-02-03 Thread Paul Stockley
Is there a way I can get the obfuscated name of a JAVA object's field
from within a JSNI method? I can get the actual value by using:

[instance-exp...@class-name::field-name

but what I want is just the @class-name::field-name as a string. The
compiler gives an error if I omit the instance expression.

-- 
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: Simple JavaScript/JSNI question: how to setup a function on the enclosing doc from inside an iframe

2009-05-23 Thread Vitali Lovich
Try

private native void publish(MyWidget widget) /*-{
   $doc.myFunction =
widg...@com.myco.myapp::myMethod()();
 }-*/;

Then within the actual page, document.myFunction()


On Sat, May 23, 2009 at 1:43 PM, BR  wrote:

>
> For a reasons too long to explain here, my app is currently getting
> deployed in an iframe. I need to use JSNI to set up a JavaScript
> callback into my application. Both the iframe and the enclosing doc
> are loaded from the the same docbase, so there should be no security
> issues.
>
>
>private native void publish(MyWidget widget) /*-{
>$wnd..myFunction =
> widg...@com.myco.myapp::myMethod()();
>  }-*/;
>
> I am wondering what should go in . I
> tried parent, parent.window - but I am no JS expert.
>
> Thanks in advance!
> BR
> >
>

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



Simple JavaScript/JSNI question: how to setup a function on the enclosing doc from inside an iframe

2009-05-23 Thread BR

For a reasons too long to explain here, my app is currently getting
deployed in an iframe. I need to use JSNI to set up a JavaScript
callback into my application. Both the iframe and the enclosing doc
are loaded from the the same docbase, so there should be no security
issues.


private native void publish(MyWidget widget) /*-{
$wnd..myFunction =
widg...@com.myco.myapp::myMethod()();
  }-*/;

I am wondering what should go in . I
tried parent, parent.window - but I am no JS expert.

Thanks in advance!
BR
--~--~-~--~~~---~--~~
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: JSNI question (extending ManagedIFramePanel, wrapping some other methods)

2009-03-23 Thread Thomas Broyer



On 22 mar, 20:51, DanG  wrote:
> public native Document getFrameDocument()/*-{
>         var panel =
> th...@com.gwtext.client.widgets.component::getOrCreateJsObj()();
>         var doc = panel.getFrameDocument();
>         //alert(doc);
>         if (doc)
>                 return doc;
>         return null;
>     }-*/;
>
> if in my native javascript code (using a 3rd party library, i'm
> wrapping ManagedIFrame extension) I get back an object HTMLDocument.
> Can I just return this to a com.google.gwt.dom.client.Document? no
> type conversion needed?

Right.
(actually, you could return any javascript object --anything that's
not a String, Number or Boolean--, it would work... until you try to
call a method or access a field, that would most likely not exist on
the given object).

> well it doesn't seem to work and not sure how
> to proceed for debugging this.
>
> The commented out alert tells me me I have a [object HTMLDocument]
>
> but when I try to call methods (i.e. getNodeValue) on the returned
> document the debugger tells me (in eclipse)
> 'Method "getNodeValue" with signature "()Ljava/lang/String;" is not
> applicable on this object'

Evaluating things from the debugger just doesn't work for
JavaScriptObject's (or any "native"/JSNI method), it's a known issue
that won't be fixed anytime soon:
http://code.google.com/p/google-web-toolkit/issues/detail?id=2912

> How do I turn this HTMLDocument into a working Document? Obviously
> something I'm missing because I'm not familiar with this technology or
> the library in question.

Your code is OK, you just cannot use the debugger facilities...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



JSNI question (extending ManagedIFramePanel, wrapping some other methods)

2009-03-22 Thread DanG

public native Document getFrameDocument()/*-{
var panel =
th...@com.gwtext.client.widgets.component::getOrCreateJsObj()();
var doc = panel.getFrameDocument();
//alert(doc);
if (doc)
return doc;
return null;
}-*/;


if in my native javascript code (using a 3rd party library, i'm
wrapping ManagedIFrame extension) I get back an object HTMLDocument.
Can I just return this to a com.google.gwt.dom.client.Document? no
type conversion needed? well it doesn't seem to work and not sure how
to proceed for debugging this.

The commented out alert tells me me I have a [object HTMLDocument]

but when I try to call methods (i.e. getNodeValue) on the returned
document the debugger tells me (in eclipse)
'Method "getNodeValue" with signature "()Ljava/lang/String;" is not
applicable on this object'

the watch expression doc.toString() tells me
'An exception occurred:
com.google.gwt.core.client.JavaScriptException'

but I imagine this might be happening in the debugger only for the
toString part.

How do I turn this HTMLDocument into a working Document? Obviously
something I'm missing because I'm not familiar with this technology or
the library in question.

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



JSNI question

2008-11-10 Thread benw

Hi,

I need to create my own date class to handle UTC. When I try to
construct a MyDate object,
I get a "java.lang.NoSuchFieldError: mydate"  exception in this code:

private native void init(double date) /*-{
this.mydate = new Date(date);
  }-*/;

Anybody know why?

thanks for any help
-Ben

PS.

Here's the exception:

[WARN] Malformed JSNI reference 'mydate'; expect subsequent failures
java.lang.NoSuchFieldError: mydate

at com.google.gwt.dev.shell.CompilingClassLoader
$DispatchClassInfoOracle.getDispId(CompilingClassLoader.java:119)
at
com.google.gwt.dev.shell.CompilingClassLoader.getDispId(CompilingClassLoader.java:
531)
at
com.google.gwt.dev.shell.moz.GeckoDispatchAdapter.setField(GeckoDispatchAdapter.java:
105)
[..skipped..]
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
107)
at edu.mit.ll.wx.share.client.MyDate.init(MyDate.java)
at edu.mit.ll.wx.share.client.MyDate.(MyDate.java:23)
at edu.mit.ll.wx.share.client.Main.onModuleLoad(Main.java:205)
[..skipped..]
at com.google.gwt.dev.shell.moz.BrowserWidgetMoz.access
$000(BrowserWidgetMoz.java:35)

Here's my code:

public class MyDate
{

  public MyDate(long millisec) {
init(millisec);
  }

 private native void init(double date) /*-{
this.mydate = new Date(date);
  }-*/;

  public native int getUTCFullYear() /*-{
return this.mydate.getUTCFullYear();
  }-*/;

- Hide quoted text -
- Show quoted text -
}
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



JSNI question

2008-11-10 Thread bw

Hi,

I need to create my own date class to handle UTC. When I try to
construct a MyDate object,
I get a "java.lang.NoSuchFieldError: mydate"  exception in this code:

private native void init(double date) /*-{
this.mydate = new Date(date);
  }-*/;

Anybody know why?

thanks for any help
-Ben

PS.

Here's the exception:

[WARN] Malformed JSNI reference 'mydate'; expect subsequent failures
java.lang.NoSuchFieldError: mydate

at com.google.gwt.dev.shell.CompilingClassLoader
$DispatchClassInfoOracle.getDispId(CompilingClassLoader.java:119)
at
com.google.gwt.dev.shell.CompilingClassLoader.getDispId(CompilingClassLoader.java:
531)
at
com.google.gwt.dev.shell.moz.GeckoDispatchAdapter.setField(GeckoDispatchAdapter.java:
105)
[..skipped..]
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
107)
at edu.mit.ll.wx.share.client.MyDate.init(MyDate.java)
at edu.mit.ll.wx.share.client.MyDate.(MyDate.java:23)
at edu.mit.ll.wx.share.client.Main.onModuleLoad(Main.java:205)
[..skipped..]
at com.google.gwt.dev.shell.moz.BrowserWidgetMoz.access
$000(BrowserWidgetMoz.java:35)

Here's my code:

public class MyDate
{

  public MyDate(long millisec) {
init(millisec);
  }

 private native void init(double date) /*-{
this.mydate = new Date(date);
  }-*/;

  public native int getUTCFullYear() /*-{
return this.mydate.getUTCFullYear();
  }-*/;

- Hide quoted text -
- Show quoted text -
}
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



JSNI question

2008-11-10 Thread bw

Hi,

I need to create my own date class to handle UTC. When I try to
construct a MyDate object,
I get a "java.lang.NoSuchFieldError: mydate"  exception in this code:

private native void init(double date) /*-{
this.mydate = new Date(date);
  }-*/;

Anybody know why?

thanks for any help
-Ben


PS.

Here's the exception:

[WARN] Malformed JSNI reference 'mydate'; expect subsequent failures
java.lang.NoSuchFieldError: mydate

at com.google.gwt.dev.shell.CompilingClassLoader
$DispatchClassInfoOracle.getDispId(CompilingClassLoader.java:119)
at
com.google.gwt.dev.shell.CompilingClassLoader.getDispId(CompilingClassLoader.java:
531)
at
com.google.gwt.dev.shell.moz.GeckoDispatchAdapter.setField(GeckoDispatchAdapter.java:
105)
[..skipped..]
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
107)
at edu.mit.ll.wx.share.client.MyDate.init(MyDate.java)
at edu.mit.ll.wx.share.client.MyDate.(MyDate.java:23)
at edu.mit.ll.wx.share.client.Main.onModuleLoad(Main.java:205)
[..skipped..]
at com.google.gwt.dev.shell.moz.BrowserWidgetMoz.access
$000(BrowserWidgetMoz.java:35)



Here's my code:


public class MyDate
{


  public MyDate(long millisec) {
init(millisec);
  }


 private native void init(double date) /*-{
this.mydate = new Date(date);
  }-*/;


  public native int getUTCFullYear() /*-{
return this.mydate.getUTCFullYear();
  }-*/;

}


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---