Re: GWT compiler option to simply validate code

2009-11-23 Thread MonkeyMike
Now that I am using the -validateOnly option, I can see that it is a
much better option than the special Build module that I created.
The GWT compiler ignores unused code, and so much of the code in my
library was not being validated when I compiled via the Build
module.  But now that I am using the -validateOnly option, I can run
the compiler directly on the library, and it validates all of the
code.

Thanks again,
Mike

On Nov 19, 10:12 am, MonkeyMike mikebin...@gmail.com wrote:
 Awesome!  Thanks! :)

 On Nov 19, 2:19 am, Thomas Broyer t.bro...@gmail.com wrote:

  On Nov 19, 2:52 am, MonkeyMike mikebin...@gmail.com wrote:

   Hello,

      I am creating a GWT Overlay Type library, and have just written an
   ant build file for creating the JAR file that GWT applications will
   import.  To maintain code integrity, I make the JAR creation depend on
   a java compile of all the code, and also a gwt compile.  Obviously,
   this is meant to ensure that the code in the library is acceptable
   Java, and also that it is acceptable GWT.

      When I run the GWT compiler, however, I get an error related to the
   fact that my library has no entry point...

   -
   Buildfile: C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml
   javac-compile:
       [javac] Compiling 2 source files to C:\Data\Dev
   \EclipseWorkspaceTrunk\gwtgfx\build\javac
   gwt-compile:
        [java] Compiling module gwtgfx.GwtGfx
        [java]    [ERROR] Module has no entry points defined

   BUILD FAILED
   C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml:25: The following
   error occurred while executing this line:
   C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml:45: Java returned:
   1

   Total time: 3 seconds
   -

     Of course, it makes perfect sense that my library has no entry point
   since it is, in fact, a library... not an application.

      Is there an option for the GWT compiler to do only the parts that I
   want here?  I want the GWT compiler to ensure, for example, that all
   of my JavaScriptObject subclasses follow the specified restrictions
   (has a protected no-arg constructor, instance methods are final,
   etc)... and anything else that the GWT compiler might do now, or in
   the future, to check that the GWT code is valid.  If not having an
   entry point means that there is no reasonable way to do one or more of
   the compiler steps, then that should be okay because those steps
   probably aren't relevant for a library anyways.

      As a temporary hack, I guess I am going to include an entry point,
   but I really don't want to ship this.  Is there a better alternative?

   Thanks in advance. :)

  There's a -validateOnly flag that doesn't mandate an entry point (and
  should check that all public classes can be compiled).

--

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

Unknown type evolves from overriding functions in Javascript

2009-11-20 Thread MonkeyMike
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=.




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




Re: GWT compiler option to simply validate code

2009-11-19 Thread MonkeyMike
Awesome!  Thanks! :)

On Nov 19, 2:19 am, Thomas Broyer t.bro...@gmail.com wrote:
 On Nov 19, 2:52 am, MonkeyMike mikebin...@gmail.com wrote:



  Hello,

     I am creating a GWT Overlay Type library, and have just written an
  ant build file for creating the JAR file that GWT applications will
  import.  To maintain code integrity, I make the JAR creation depend on
  a java compile of all the code, and also a gwt compile.  Obviously,
  this is meant to ensure that the code in the library is acceptable
  Java, and also that it is acceptable GWT.

     When I run the GWT compiler, however, I get an error related to the
  fact that my library has no entry point...

  -
  Buildfile: C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml
  javac-compile:
      [javac] Compiling 2 source files to C:\Data\Dev
  \EclipseWorkspaceTrunk\gwtgfx\build\javac
  gwt-compile:
       [java] Compiling module gwtgfx.GwtGfx
       [java]    [ERROR] Module has no entry points defined

  BUILD FAILED
  C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml:25: The following
  error occurred while executing this line:
  C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml:45: Java returned:
  1

  Total time: 3 seconds
  -

    Of course, it makes perfect sense that my library has no entry point
  since it is, in fact, a library... not an application.

     Is there an option for the GWT compiler to do only the parts that I
  want here?  I want the GWT compiler to ensure, for example, that all
  of my JavaScriptObject subclasses follow the specified restrictions
  (has a protected no-arg constructor, instance methods are final,
  etc)... and anything else that the GWT compiler might do now, or in
  the future, to check that the GWT code is valid.  If not having an
  entry point means that there is no reasonable way to do one or more of
  the compiler steps, then that should be okay because those steps
  probably aren't relevant for a library anyways.

     As a temporary hack, I guess I am going to include an entry point,
  but I really don't want to ship this.  Is there a better alternative?

  Thanks in advance. :)

 There's a -validateOnly flag that doesn't mandate an entry point (and
 should check that all public classes can be compiled).

--

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




@SingleJsoImpl in GWT 2.0??

2009-11-18 Thread MonkeyMike
Dear GWT 2.0 developers,

   I noticed the latest announcement about GWT 2.0, Milestone 2,
here...

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/15f20608f0a73b73

...and I noticed that it does not make any mention of the
@SingleJsoImpl feature, which is described here...

http://code.google.com/p/google-web-toolkit/wiki/OverlayTypes

   Can we still expect this feature in GWT 2.0?


   To provide a little more detail:  I have been creating a GWT
Overlay Type library for Dojo's GFX library, and I have encountered
the difficulty of creating access to an overlay type without an
intermediate type.  My solution, for now, is to create public access
to all of the overlay types and have a delegate library of types
that use the overlay types.  The pur;pose of the delegate types are
to offer a more acceptable Java API, since they are not subclasses of
JavaScriptObject and therefore do not have the JavaScriptObject
restrictions.  So, for example, where an overlay type can only provide
a final method, the corresponding delegate type can provide a non-
final method, which calls the overlay type's final method.  However,
these delegate types are problematic because they involve a lot of
extra object creation that does not occur when using the overlay types
directly.  So it seems like I can resolve some of this with the use of
@SingleJsoImpl, and I am wondering whether or not I can surely expect
this in GWT 2.0.

--

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: @SingleJsoImpl in GWT 2.0??

2009-11-18 Thread MonkeyMike
That's great!  Thanks for the quick reply. :)

On Nov 18, 12:43 pm, Chris Ramsdale cramsd...@google.com wrote:
 The functionality that you are looking for is in 2.0. The compiler simply
 figures it out, so there's no need for an explicit annotation.

 - Chris

 On Wed, Nov 18, 2009 at 3:25 PM, MonkeyMike mikebin...@gmail.com wrote:
  Dear GWT 2.0 developers,

    I noticed the latest announcement about GWT 2.0, Milestone 2,
  here...

 http://groups.google.com/group/google-web-toolkit/browse_thread/threa...

  ...and I noticed that it does not make any mention of the
  @SingleJsoImpl feature, which is described here...

 http://code.google.com/p/google-web-toolkit/wiki/OverlayTypes

    Can we still expect this feature in GWT 2.0?

    To provide a little more detail:  I have been creating a GWT
  Overlay Type library for Dojo's GFX library, and I have encountered
  the difficulty of creating access to an overlay type without an
  intermediate type.  My solution, for now, is to create public access
  to all of the overlay types and have a delegate library of types
  that use the overlay types.  The pur;pose of the delegate types are
  to offer a more acceptable Java API, since they are not subclasses of
  JavaScriptObject and therefore do not have the JavaScriptObject
  restrictions.  So, for example, where an overlay type can only provide
  a final method, the corresponding delegate type can provide a non-
  final method, which calls the overlay type's final method.  However,
  these delegate types are problematic because they involve a lot of
  extra object creation that does not occur when using the overlay types
  directly.  So it seems like I can resolve some of this with the use of
  @SingleJsoImpl, and I am wondering whether or not I can surely expect
  this in GWT 2.0.

  --

  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.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.

--

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




GWT compiler option to simply validate code

2009-11-18 Thread MonkeyMike
Hello,

   I am creating a GWT Overlay Type library, and have just written an
ant build file for creating the JAR file that GWT applications will
import.  To maintain code integrity, I make the JAR creation depend on
a java compile of all the code, and also a gwt compile.  Obviously,
this is meant to ensure that the code in the library is acceptable
Java, and also that it is acceptable GWT.

   When I run the GWT compiler, however, I get an error related to the
fact that my library has no entry point...

-
Buildfile: C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml
javac-compile:
[javac] Compiling 2 source files to C:\Data\Dev
\EclipseWorkspaceTrunk\gwtgfx\build\javac
gwt-compile:
 [java] Compiling module gwtgfx.GwtGfx
 [java][ERROR] Module has no entry points defined

BUILD FAILED
C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml:25: The following
error occurred while executing this line:
C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml:45: Java returned:
1

Total time: 3 seconds
-

  Of course, it makes perfect sense that my library has no entry point
since it is, in fact, a library... not an application.

   Is there an option for the GWT compiler to do only the parts that I
want here?  I want the GWT compiler to ensure, for example, that all
of my JavaScriptObject subclasses follow the specified restrictions
(has a protected no-arg constructor, instance methods are final,
etc)... and anything else that the GWT compiler might do now, or in
the future, to check that the GWT code is valid.  If not having an
entry point means that there is no reasonable way to do one or more of
the compiler steps, then that should be okay because those steps
probably aren't relevant for a library anyways.

   As a temporary hack, I guess I am going to include an entry point,
but I really don't want to ship this.  Is there a better alternative?

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




Re: GWT compiler option to simply validate code

2009-11-18 Thread MonkeyMike
Although I'm still very interested to get an answer to my previous
post, I have just implemented the temporary hack that I mentioned,
and I actually would say that it's a good approach.  I created a
Build gwt module, which has an entry point, and inherits the overlay
type library.  I edited my ant file's gwt-compile target so that it
runs a gwt-compile on the Build module, and the gwt-compile
succeeded.  There are 2 nice things about this approach...

1) The make-jar target can create a jar file which only contains
code from the library, and so I don't have to ship the build module.

2) The Build module's entry point actually is a nice space to write
some code which uses the library, as another set of tests.  I haven't
done this yet, but in theory I could write some code which calls all
of the code in the library, and this would ensure that the intended
usage of the library is compliant with the GWT compiler as well.
However, perhaps this is redundant if the library has a suite of unit
tests.

Anyways, as I said, I'm still curious to know how I might be able to
run the gwt-compiler to execute only those compile steps which are
relevant to a library (as opposed to an application).

Cheers,
Mike


On Nov 18, 5:52 pm, MonkeyMike mikebin...@gmail.com wrote:
 Hello,

    I am creating a GWT Overlay Type library, and have just written an
 ant build file for creating the JAR file that GWT applications will
 import.  To maintain code integrity, I make the JAR creation depend on
 a java compile of all the code, and also a gwt compile.  Obviously,
 this is meant to ensure that the code in the library is acceptable
 Java, and also that it is acceptable GWT.

    When I run the GWT compiler, however, I get an error related to the
 fact that my library has no entry point...

 -
 Buildfile: C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml
 javac-compile:
     [javac] Compiling 2 source files to C:\Data\Dev
 \EclipseWorkspaceTrunk\gwtgfx\build\javac
 gwt-compile:
      [java] Compiling module gwtgfx.GwtGfx
      [java]    [ERROR] Module has no entry points defined

 BUILD FAILED
 C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml:25: The following
 error occurred while executing this line:
 C:\Data\Dev\EclipseWorkspaceTrunk\gwtgfx\build.xml:45: Java returned:
 1

 Total time: 3 seconds
 -

   Of course, it makes perfect sense that my library has no entry point
 since it is, in fact, a library... not an application.

    Is there an option for the GWT compiler to do only the parts that I
 want here?  I want the GWT compiler to ensure, for example, that all
 of my JavaScriptObject subclasses follow the specified restrictions
 (has a protected no-arg constructor, instance methods are final,
 etc)... and anything else that the GWT compiler might do now, or in
 the future, to check that the GWT code is valid.  If not having an
 entry point means that there is no reasonable way to do one or more of
 the compiler steps, then that should be okay because those steps
 probably aren't relevant for a library anyways.

    As a temporary hack, I guess I am going to include an entry point,
 but I really don't want to ship this.  Is there a better alternative?

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




Problem with Element.getFirstChildElement()

2009-03-27 Thread MonkeyMike

I think I may have found a GWT bug.  Please let me know if there is a
better place to post this...

   Consider this code from a JSTL tag…


div id=existingFriendsAddressBook
ul
c:forEach items=${friends} var=friend
c:set 
var=friendEmail${fn:toLowerCase(friend.email)}/c:set
li
input type=checkbox 
id=existingFriend_${friendEmail} / $
{friendEmail}
/li
/c:forEach
/ul
/div


   …and this GWT code, which tries to get a reference to each of the
checkboxes created in that tag…


@Override
protected void build() {
DivElement existingFriendsAddressBook =
DivElement.as(DOM.getElementById
(existingFriendsAddressBook));
UListElement list =
UListElement.as
(existingFriendsAddressBook.getFirstChildElement());
NodeListNode children = list.getChildNodes();
int numFriends = children.getLength();
for (int i = 0; i  numFriends; i++) {
LIElement row = LIElement.as((Element) children.getItem(i));
Element firstChild = row.getFirstChildElement();
InputElement checkbox = InputElement.as(firstChild);
String checkboxId = checkbox.getId();
[do stuff with checkboxId, unrelated to this post]
}
}


   It turns out that IN FIREFOX ONLY, the variable “firstChild” is
null, and I believe this is a bug in Element’s getFirstChildElement
().  I changed the code to the following, and there is no longer an
error…


LIElement row = LIElement.as((Element) children.getItem(i));
NodeListNode subchildren = row.getChildNodes();
InputElement checkbox = InputElement.as((Element) subchildren.getItem
(0));
String checkboxId = checkbox.getId();


A call to GWT.getVersion() returns 1.5.2

As you can see, I have found a work-around, so this isn't urgent...
just a heads-up! :)

-Monkey Mike

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