Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Unknown type evolves from overriding functions in Javascript
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
MonkeyMike  
View profile  
 More options Nov 20 2009, 1:58 pm
From: MonkeyMike <mikebin...@gmail.com>
Date: Fri, 20 Nov 2009 10:58:52 -0800 (PST)
Local: Fri, Nov 20 2009 1:58 pm
Subject: Unknown type evolves from overriding functions in Javascript
I have some JSNI that the GWT compiler doesn't like...

----------------------
        public static native void declareCustomMoveable(String
customMoveableId, NativeCustomMoveableCallback callback) /*-{
                dojo.declare( customMoveableId, dojox.gfx.Moveable, {
                        onFirstMove: function(mover){

callba...@gwtgfx.client.callback.CustomMoveableCallback::onFirstMove
();
                        },
                        onMoving: function(mover, shift){
                                callba...@gwtgfx.client.callback.CustomMoveableCallback::onMoving(
                                        Lgwtgfx/client/definition/jsni/NativeTransformDefinition;
                                )(shift);
                        },
                        onMoved: function(mover, shift){
                                callba...@gwtgfx.client.callback.CustomMoveableCallback::onMoved(
                                        Lgwtgfx/client/definition/jsni/NativeTransformDefinition;
                                )(shift);
                        }
                });
        }-*/;
----------------------

   Note that I am using dojo's pattern for "subclassing"
dojox.gfx.Moveable, and overriding the methods onFirstMove, onMoving,
and onMoved.  In each of these, there is a call to the relevant method
from NativeCustomMoveableCallback.java (which is a Java interface, by
the way).  The GWT compiler is okay with the onFirstMove
implementation, but for both the onMoving and onMoved implementations,
I get the following error...

"Expected a valid parameter type signature in JSNI method reference"

   Note that I have indicated that "shift" is an instance of a
NativeTransformDefinition, which is a subclass of JavaScriptObject in
my library.  Isn't this valid?  I thought that the GWT compiler
"trusts" the developer to indicate types of objects that come from
JavaScript, so long as the types are subclasses of JavaScriptObject.

   So is it just that my syntax is somehow incorrect?  I'm using GWT
1.7.  If not, how can I refactor this to achieve a pattern which is
acceptable to the GWT compiler?

Thanks in advance! :)


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MonkeyMike  
View profile  
 More options Nov 20 2009, 2:03 pm
From: MonkeyMike <mikebin...@gmail.com>
Date: Fri, 20 Nov 2009 11:03:17 -0800 (PST)
Local: Fri, Nov 20 2009 2:03 pm
Subject: Re: Unknown type evolves from overriding functions in Javascript
Sorry for the strange formatting, by the way.  I simply copy-and-
pasted my code.

On Nov 20, 10:58 am, MonkeyMike <mikebin...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MonkeyMike  
View profile  
 More options Nov 23 2009, 9:02 pm
From: MonkeyMike <mikebin...@gmail.com>
Date: Mon, 23 Nov 2009 18:02:30 -0800 (PST)
Local: Mon, Nov 23 2009 9:02 pm
Subject: Re: Unknown type evolves from overriding functions in Javascript
Still looking for an answer on this one... I am puzzled as to how to
do this!

By the way, I realized during some other debugging that this bit of
code is one of many places where I was forgetting to state the "$wnd"
namespace.  So here is the latest version of the problematic code...

----------------------------
public static native void declareCustomMoveable(String
customMoveableId, NativeCustomMoveableCallback callback) /*-{
        $wnd.dojo.declare( customMoveableId, $wnd.dojox.gfx.Moveable, {
                onFirstMove: function(mover){
                        callba...@gwtgfx.client.callback.CustomMoveableCallback::onFirstMove
();
                },
                onMoving: function(mover, shift){
                        callba...@gwtgfx.client.callback.CustomMoveableCallback::onMoving(
                                Lgwtgfx/client/definition/jsni/NativeTransformDefinition;
                        )(shift);
                },
                onMoved: function(mover, shift){
                        callba...@gwtgfx.client.callback.CustomMoveableCallback::onMoved(
                                Lgwtgfx/client/definition/jsni/NativeTransformDefinition;
                        )(shift);
                }
        });

}-*/;

----------------------------

Looking forward to the solution!

Cheers,
Mike

On Nov 20, 11:03 am, MonkeyMike <mikebin...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MonkeyMike  
View profile  
 More options Nov 23 2009, 9:18 pm
From: MonkeyMike <mikebin...@gmail.com>
Date: Mon, 23 Nov 2009 18:18:13 -0800 (PST)
Local: Mon, Nov 23 2009 9:18 pm
Subject: Re: Unknown type evolves from overriding functions in Javascript
Wow... okay, I think I figured it out!  It turns out that, at least
with GWT 1.7.0, whitespace matters.  The following code turned out to
be valid...

-----------------------
        public static native void declareCustomMoveable(String
customMoveableId,
            NativeCustomMoveableCallback callback) /*-{
                $wnd.dojo.declare( customMoveableId, $wnd.dojox.gfx.Moveable, {
                        onFirstMove: function(mover){

callba...@gwtgfx.client.callback.CustomMoveableCallback::onFirstMove
();
                        },
                        onMoving: function(mover, shift){

callba...@gwtgfx.client.callback.jsni.NativeCustomMoveableCallback::onMoving
(Lgwtgfx/client/definition/jsni/NativeTransformDefinition;)(shift);
                        },
                        onMoved: function(mover, shift){

callba...@gwtgfx.client.callback.jsni.NativeCustomMoveableCallback::onMoved
(Lgwtgfx/client/definition/jsni/NativeTransformDefinition;)(shift);
                        }
                });
        }-*/;
-----------------------

   Please ignore the change in class and package names in this code,
compared to the previous posts.  I realize that there were other
errors there, but that's not what this is about.  The GWT compiler
didn't like how I was putting the type declarations on their own
lines.

   Sorry for the confusion... but I suppose this is still a useful
post, since I discovered how much whitespace matters here.

Cheers,
Mike

On Nov 23, 6:02 pm, MonkeyMike <mikebin...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google