Re: Unknown type evolves from overriding functions in Javascript

2009-11-23 Thread MonkeyMike
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:
 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:

  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! :)

--

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: Unknown type evolves from overriding functions in Javascript

2009-11-23 Thread MonkeyMike
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:
 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:

  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:

   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 

Re: Unknown type evolves from overriding functions in Javascript

2009-11-20 Thread MonkeyMike
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:
 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! :)

--

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