Sunday, April 24, 2011

Re: How to share code between Server and Client with DateTimeFormat

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate