TDD in Gwt

2011-04-24 Thread Uberto Barbini
Hi I just presented a session on working in tdd with gwt (Goos style
for the connoisseurs ;)).

http://www.slideshare.net/ubertobarbini/develop-gwt-application-in-tdd

I hope the slides could be useful to somebody else too.

Any feedback would be very welcome.

Happy Easter!

Uberto

-- 
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: some problem about GWT

2011-04-24 Thread Carlos
right this can be a solution

On 24 avr, 05:02, 何剑涛 hejiant...@gmail.com wrote:
 it is said that i must write it in server side,right?

 2011/4/22 Carlos hbazz...@gmail.com:







  hi,

  you are writing your code in the client side.
  thats why it can't recognize the javax.servlet.http.HttpServlet since
  it is not supported by the gwt libraries.

  On 22 avr, 07:28, 剑涛 何 hejiant...@gmail.com wrote:
  I code a servlet in GWT:
  Line 8:   public class AddServvlet extends HttpServlet{
  private static final long serialV = 1L;
  protected void doPost(HttpServletRequest req,HttpServletResponse 
  res)
  {
  int a = Integer.parseInt(req.getParameter(a));
  int b = Integer.parseInt(req.getParameter(b));
  try {
  res.getWriter().print(a+b);
  } catch (IOException e) {
  // TODO: handle exception
  }
  }}

  when I run the project in IE,it say:[ERROR] [hellogwt] - Line 
  8: No
  source code is available for type javax.servlet.http.HttpServlet; did
  you forget to inherit a required module?
  [ERROR] [hellogwt] - Line 10: No source code is available 
  for type
  javax.servlet.http.HttpServletRequest; did you forget to inherit a
  required module?
  [ERROR] [hellogwt] - Line 10: No source code is available 
  for type
  javax.servlet.http.HttpServletResponse; did you forget to inherit a
  required module?
  thank you!

  --
  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 
  athttp://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-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: Why Composite?

2011-04-24 Thread Gilles B
This is true but keep in mind that if you use inheritance to extent a
widget your object must follow the Is A... rule.
Il you extent a button with a new child class MyButton or
MyToolbar you inherit all present and future methods, your object
can be cast and used as a parent representative, it is also a Button
and a Widget as example. So may be MyToolbar is not a good idea here
because it is a button set and no a single button (The Rule Is A
Button is not respected). The composite is a good way to build a new
widget mays be with various smaller widgets and java code as glue
(another one is wrapping the JS component using native methods).
Inheritance has to keep the original widget idea with only
specialisation like button with image as a sort of button or
IntegerTextBox as a interger input dedicate TextBox. So if (and only
if) the Is A rule apply it seems better to inherit.
Hope it help a little bit. G. ;-)

On 24 avr, 01:10, Harald Schilly harald.schi...@gmail.com wrote:
 When you want to design your own widget that modifies some data, you can
 combine more than one widget in such a Composite, additionally implement for
 example a HasValueChangeHandlers... interface, and much more. That helps
 to isolate all this into one class and you can use this as a bigger block
 when designing the UI.

 H

-- 
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: Giving wrong value for Date of month

2011-04-24 Thread Gilles B
It seems to work perfectly, but what is the gwt version, the
application context, the browser, the date object (java.util) ?
Don't forget java Date Month start from 0 (January) to 11 (december).

Date today = new Date();
GWTLog.debug(Today month is +today.getMonth());
// Display Today month is 3 = April

On 23 avr, 20:14, andy andy.anand1...@gmail.com wrote:
 intstartMonth=startDate.getMonth();
 int endMonth = endDate.getMonth();
 giving wrong value 
 what to do now?

-- 
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: how to draw a line using gwt?

2011-04-24 Thread Gilles B
Drawing a Line inside a browser a well know problem, just look for
java script line drawing in your search engine. The basic idea is to
use a set of div tags to draw various points, ie 1px*1px rectangles
with background-color but with performance problems. An idea is to
agregate adjacent rectangles in a same column or in the same row to
optimize this drawing. Various js libraries exists depending on the
drawing and graphics complexity you are looking for.

This Canvas library is a good thing but rely on new HTML 5 standard
and is not supported by a lot of browser (current IE and all the old
versions), may be it's a problem in your application. The Canvas class
is includes in GWT 2.2 but as: Experimental API: This API is still
under development and is subject to change. If this is not a problem
for you this is the best GWT complient solution. The previous post
give you the url of the google demo and examples
http://code.google.com/p/gwtcanvasdemo/

There is (was) another Canvas library in the incubator project and it
works fine in Web mode across the major browser working as JavaScript
wrapper but is not a good idea (now this library is obsolete)
http://code.google.com/p/google-web-toolkit-incubator/wiki/GWTCanvas

Another way is to build a graphic at run time in your server using a
graphics context from java and common drawing API to building an image
and then display it on your server. It's convenient with complex
images or to build a captcha as example. It is also possible to rely
on SVG tags, like LINE. These are simple XML tags but sometimes
requires a browser plugin. In fact there is multiple solutions
depending on your project environment and your targets.

On 24 avr, 05:20, 剑涛 何 hejiant...@gmail.com wrote:
 can you tell me something detail?

 On 4月23日, 下午10时20分, Gal Dolber gal.dol...@gmail.com wrote:



 http://gwtcanvasdemo.appspot.com/

  On Sat, Apr 23, 2011 at 10:54 AM, 剑涛 何 hejiant...@gmail.com wrote:
   if there are two coordinates -p1:(x1,y1),p2:(x2,y2) in the
   browser ,how to draw an arrow from p1 to p2?

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

  --
  Guit: Elegant, beautiful, modular and *production ready* gwt applications.

 http://code.google.com/p/guit/- Masquer le texte des messages précédents -

 - Afficher le texte des messages précédents -

-- 
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: GWT RPC - WebServiceClient

2011-04-24 Thread Sunit Katkar
Since Apache CXF or any other web service creates POJOs which are not
directly usable by GWT, we have taken extra pains to replicate the same
POJOs as GWT side POJOs. When servlet makes a call to the web service,
whatever objects we get back are anaylysed and then their 'copy' is made
into GWT side POJOs. Its tedious, but hey it works and scales too.

Thank you,
Sunit Katkar




On Fri, Apr 22, 2011 at 2:01 PM, Armishev, Sergey sarmis...@idirect.netwrote:

 I did this GWT-RPC-WSDL integration and it works fine. Maybe not very much
 efficient but it works and I made quicly what I needed. I used wscompile to
 generate POJO java classes from WSDL. That are classes that Web server user
 for web services communication. They are server side classes. Then I copied
 server classes to client package and manually editted generated POJO classes
 to be  GWT RPC compatible. Yes, it is duplication and bad and I would like
 to have the same classes for both sides but… don’t have time to develop full
 solution  Then ,Cxf knows nothing about GWT so even POJO classes has
 references on unsupported Java classes such as Calendar (see below example).
 I manually editted those file to be GWT RPC compatible. Not a big deal Then
 I add  “ implements java.io.Serializable”  implementation to class
 definition. And then in run time translate server side classes to client and
 back.

 Below is POJO file generated by cxf and corresponding class which is
 GWT-RPC compatible. See Calendar class that is not supported.



 Let me know if you need more help

 -Sergey



 // This class was generated by the JAXRPC SI, do not edit.

 // Contents subject to change without notice.

 // JAX-RPC Standard Implementation (1.1.3, build R1)

 // Generated source version: 1.1.3



 package com.idirect.webnms.*server*.toolkit;





 public class NmsErrorCondition extends 
 com.idirect.webnms.*server*.toolkit.NmsObject
 {

 *protected java.util.Calendar timeStamp;*

 protected com.idirect.webnms.client.toolkit.NmsErrorSeverity
 errorSeverity;

 protected java.lang.String errorMessage;



 public NmsErrorCondition() {

 }



 public NmsErrorCondition(int objectType, boolean initialized,
 java.util.Calendar timeStamp,
 com.idirect.webnms.client.toolkit.NmsErrorSeverity errorSeverity,
 java.lang.String errorMessage) {

 this.objectType = objectType;

 this.initialized = initialized;

 this.timeStamp = timeStamp;

 this.errorSeverity = errorSeverity;

 this.errorMessage = errorMessage;

 }



 *public java.util.Calendar getTimeStamp() {*

 *return timeStamp;*

 *}*



 public void setTimeStamp(java.util.Calendar timeStamp) {

 this.timeStamp = timeStamp;

 }



 public com.idirect.webnms.client.toolkit.NmsErrorSeverity
 getErrorSeverity() {

 return errorSeverity;

 }



 public void
 setErrorSeverity(com.idirect.webnms.client.toolkit.NmsErrorSeverity
 errorSeverity) {

 this.errorSeverity = errorSeverity;

 }



 public java.lang.String getErrorMessage() {

 return errorMessage;

 }



 public void setErrorMessage(java.lang.String errorMessage) {

 this.errorMessage = errorMessage;

 }

 }



 And you translate it to

 // This class was generated by the JAXRPC SI, do not edit.

 // Contents subject to change without notice.

 // JAX-RPC Standard Implementation (1.1.3, build R1)

 // Generated source version: 1.1.3



 package com.idirect.webnms.*client*.toolkit;





 public class NmsErrorCondition extends 
 com.idirect.webnms.*client*.toolkit.NmsObject
 {

 *protected java.util.Date timeStamp;*

 protected com.idirect.webnms.client.toolkit.NmsErrorSeverity
 errorSeverity;

 protected java.lang.String errorMessage;

 public NmsErrorCondition() {

 }



 public NmsErrorCondition(int objectType, boolean initialized,
 java.util.Date timeStamp, com.idirect.webnms.client.toolkit.NmsErrorSeverity
 errorSeverity, java.lang.String errorMessage) {

 this.objectType = objectType;

 this.initialized = initialized;

 this.timeStamp = timeStamp;

 this.errorSeverity = errorSeverity;

 this.errorMessage = errorMessage;

 }



 *public java.util.Date getTimeStamp() {*

 *return timeStamp;*

 *}*



 public void setTimeStamp(java.util.Date timeStamp) {

 this.timeStamp = timeStamp;

 }



 public com.idirect.webnms.client.toolkit.NmsErrorSeverity
 getErrorSeverity() {

 return errorSeverity;

 }



 public void
 setErrorSeverity(com.idirect.webnms.client.toolkit.NmsErrorSeverity
 errorSeverity) {

 this.errorSeverity = errorSeverity;

 }



 public java.lang.String getErrorMessage() {

 return errorMessage;

 }



 public void setErrorMessage(java.lang.String errorMessage) {

 this.errorMessage = errorMessage;

 }



 }



 And then you need  

Re: gwt-maven-plugin woes

2011-04-24 Thread cri
Update:

The problem was that the launch configuration created by the gwt-maven-
plugin was missing the module specification. Once I added this, the
app did come up when invoking Run As/Web Application.

The current problem that I'm working on is that my app compiled for
web mode isn't coming up. Instead I get a dialog box saying the module
may need to be recompiled. Its looking like there are files missing
from the war file.

Wish me luck. Obviously, GPE/Eclipse functionality hasn't been very
well tested by the plugin developers.

On Apr 21, 11:39 am, cri chuck.irvine...@gmail.com wrote:
 I'm trying to use gwt project generated by using the gwt-maven-plugin
 archetype but don't very far. I feel I must be making a simple
 mistake.

 It would be great ifmavensupport was provided directly by GWT.

 Here is are the steps I followed with gwt-maven-plugin (from the 
 gwt-maven-plugin documentation):

 1) Generate a gwt project as described 
 here:http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html.
 2) Import the project into eclipse using eclipse command Import -
 ExistingMavenProject. (I'm not sure that this is correct. There is
 also an eclipse command Import - Existing Projects into Workspace.
 Which is the correct command?)
 3) Configure project to use GPE by checking checkbox at Properties -
 Google - Web Toolkit - Use Google Web Toolkit.
 4) Create a launch file running gwt:eclipse. This creates a launch
 file and copy it to .metadata/.plugins/
 org.eclipse.debug.core/.launches. as described 
 herehttp://mojo.codehaus.org/gwt-maven-plugin/user-guide/comfortable_debu
 5) Restart eclipse.
 6) Right click on the launch file created in step 4 and invoke Debug
 As - launch file name.

 At this point the launch fails with the info below.
 It would be great if someone could help me get through this. Its
 probably something simple that I'm not experienced enough to
 recognize.

 Launch failure info:

 Missing required argument 'module[s]'
 Google Web Toolkit 2.2.0
 DevMode [-noserver] [-port port-number | auto] [-whitelist whitelist-
 string] [-blacklist blacklist-string] [-logdir directory] [-logLevel
 level] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort
 port-number | auto] [-server servletContainerLauncher[:args]] [-
 startupUrl url] [-war dir] [-deploy dir] [-extra dir] [-workDir dir]
 module[s]

 where
   -noserver        Prevents the embedded web server from running
   -port            Specifies the TCP port for the embedded web server
 (defaults to )
   -whitelist       Allows the user to browse URLs that match the
 specified regexes (comma or space separated)
   -blacklist       Prevents the user browsing URLs that match the
 specified regexes (comma or space separated)
   -logdir          Logs to a file in the given directory, as well as
 graphically
   -logLevel        The level of logging detail: ERROR, WARN, INFO,
 TRACE, DEBUG, SPAM, or ALL
   -gen             Debugging: causes normally-transient generated
 types to be saved in the specified directory
   -bindAddress     Specifies the bind address for the code server and
 web server (defaults to 127.0.0.1)
   -codeServerPort  Specifies the TCP port for the code server
 (defaults to 9997)
   -server          Specify a different embedded web server to run
 (must implement ServletContainerLauncher)
   -startupUrl      Automatically launches the specified URL
   -war             The directory into which deployable output files
 will be written (defaults to 'war')
   -deploy          The directory into which deployable but not
 servable output files will be written (defaults to 'WEB-INF/deploy'
 under the -war directory/jar, and may be the same as the -extra
 directory/jar)
   -extra           The directory into which extra files, not intended
 for deployment, will be written
   -workDir         The compiler's working directory for internal use
 (must be writeable; defaults to a system temp dir)
 and
   module[s]        Specifies the name(s) of the module(s) to host
  Reply
  Forward

-- 
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: How to share code between Server and Client with DateTimeFormat

2011-04-24 Thread Adligo
Hi I,

 use this class
http://cvs.adligo.org/viewvc/i_util/src/org/adligo/i/util/client/CommonTime.java?view=markup

Then when in JSE (on the Server) it delegates to
http://cvs.adligo.org/viewvc/jse_util/src/org/adligo/jse/util/JSETextFormatter.java?view=markup

And in GWT it delegates to
http://cvs.adligo.org/viewvc/gwt_util/src/org/adligo/gwt/util/client/GwtTextFormatter.java?view=markup


So to use it do this somewhere on the server;
  static {
46  try {
47  JSEPlatform.init();
48  } catch (Exception x) {
49  x.printStackTrace();
50  }
51  }
For instance in ;
http://cvs.adligo.org/viewvc/adi_server_config/src/org/adligo/i/adi/server_config/ExternalConfigListener.java?view=markup
...
http://cvs.adligo.org/viewvc/adi_server_config/src/org/adligo/i/adi/server_config/ServerConfig.java?view=markup

And on the client do;
try {
39  GwtPlatform.init();
40  GwtLogFactory.init();
41  } catch (Exception x) {
42  x.printStackTrace();
43  log.error(x.getMessage(), x);
44  }
as in this example;
http://cvs.adligo.org/viewvc/gwt_util_demo/src/org/adligo/gwt/util/demo/client/DemoEntryPoint.java?view=markup

Then simply use the static methods in CommonTime.java and constants to
get the same date formatted on client or server.

Cheers,
Scott

On Apr 23, 11:06 pm, Mauro mauro.no...@gmail.com wrote:
 Hi, would you give me a sample on where the initialization code for server
 goes? Thanks

-- 
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: gwt-maven-plugin woes

2011-04-24 Thread cri
Update (final one I hope!):

After creating the initial project with the gwt-maven-plugin
archetype, it appears that you should not use import... - existing
maven projects (which comes from m2eclipse I think). Instead, you
should use eclipse's native import... - existing projects into
workspace. In the latter case, the module specification will *not*
get left off program arguments when launching in debug mode.

On Apr 24, 11:52 am, cri chuck.irvine...@gmail.com wrote:
 Update:

 The problem was that the launch configuration created by the gwt-maven-
 plugin was missing the module specification. Once I added this, the
 app did come up when invoking Run As/Web Application.

 The current problem that I'm working on is that my app compiled for
 web mode isn't coming up. Instead I get a dialog box saying the module
 may need to be recompiled. Its looking like there are files missing
 from the war file.

 Wish me luck. Obviously, GPE/Eclipse functionality hasn't been very
 well tested by the plugin developers.

 On Apr 21, 11:39 am, cri chuck.irvine...@gmail.com wrote:







  I'm trying to use gwt project generated by using the gwt-maven-plugin
  archetype but don't very far. I feel I must be making a simple
  mistake.

  It would be great ifmavensupport was provided directly by GWT.

  Here is are the steps I followed with gwt-maven-plugin (from the 
  gwt-maven-plugin documentation):

  1) Generate a gwt project as described 
  here:http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html.
  2) Import the project into eclipse using eclipse command Import -
  ExistingMavenProject. (I'm not sure that this is correct. There is
  also an eclipse command Import - Existing Projects into Workspace.
  Which is the correct command?)
  3) Configure project to use GPE by checking checkbox at Properties -
  Google - Web Toolkit - Use Google Web Toolkit.
  4) Create a launch file running gwt:eclipse. This creates a launch
  file and copy it to .metadata/.plugins/
  org.eclipse.debug.core/.launches. as described 
  herehttp://mojo.codehaus.org/gwt-maven-plugin/user-guide/comfortable_debu
  5) Restart eclipse.
  6) Right click on the launch file created in step 4 and invoke Debug
  As - launch file name.

  At this point the launch fails with the info below.
  It would be great if someone could help me get through this. Its
  probably something simple that I'm not experienced enough to
  recognize.

  Launch failure info:

  Missing required argument 'module[s]'
  Google Web Toolkit 2.2.0
  DevMode [-noserver] [-port port-number | auto] [-whitelist whitelist-
  string] [-blacklist blacklist-string] [-logdir directory] [-logLevel
  level] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort
  port-number | auto] [-server servletContainerLauncher[:args]] [-
  startupUrl url] [-war dir] [-deploy dir] [-extra dir] [-workDir dir]
  module[s]

  where
    -noserver        Prevents the embedded web server from running
    -port            Specifies the TCP port for the embedded web server
  (defaults to )
    -whitelist       Allows the user to browse URLs that match the
  specified regexes (comma or space separated)
    -blacklist       Prevents the user browsing URLs that match the
  specified regexes (comma or space separated)
    -logdir          Logs to a file in the given directory, as well as
  graphically
    -logLevel        The level of logging detail: ERROR, WARN, INFO,
  TRACE, DEBUG, SPAM, or ALL
    -gen             Debugging: causes normally-transient generated
  types to be saved in the specified directory
    -bindAddress     Specifies the bind address for the code server and
  web server (defaults to 127.0.0.1)
    -codeServerPort  Specifies the TCP port for the code server
  (defaults to 9997)
    -server          Specify a different embedded web server to run
  (must implement ServletContainerLauncher)
    -startupUrl      Automatically launches the specified URL
    -war             The directory into which deployable output files
  will be written (defaults to 'war')
    -deploy          The directory into which deployable but not
  servable output files will be written (defaults to 'WEB-INF/deploy'
  under the -war directory/jar, and may be the same as the -extra
  directory/jar)
    -extra           The directory into which extra files, not intended
  for deployment, will be written
    -workDir         The compiler's working directory for internal use
  (must be writeable; defaults to a system temp dir)
  and
    module[s]        Specifies the name(s) of the module(s) to host
   Reply
   Forward

-- 
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: Giving wrong value for Date of month

2011-04-24 Thread Richard
You aren't saying what the type is for startDate and endDate.
If they are java.util.Date, I suggest looking ate the javadoc b/c the
method returns 0-11 and is also deprecated.

Richard

On Apr 23, 11:14 am, andy andy.anand1...@gmail.com wrote:
 int startMonth = startDate.getMonth();
 int endMonth = endDate.getMonth();
 giving wrong value 
 what to do now?

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