Wednesday, November 24, 2010

Setting up your favourites in Eclipse

I have started to use the corematchers from org.hamcrest, and find them very useful and easy to understand. They give a grammatical touch to my assert-statements that the regular assertEquals(...) does not. E.g. assertTrue(a > 0) can be written as assertThat( a , is(greaterThan(0))), which can be easier for non-technical people to understand.

Anyway, to avoid manual static imports, let eclipse do the job for you. Configure it as follows:

Wednesday, November 10, 2010

Remote logging with GWT

Remote logging was introduced in gwt 2.1, but the documentation is still a bit incomplete. To enable remote logging you will have to


  1. Add configuration-stuff in your .gwt.xml file:

    < inherits name="com.google.gwt.logging.Logging" >
    < set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" >
    < /set-property >
    < /inherits >

  2. Add the remote logging servlet in your web.xml (remember to replace YOURPROJECT with your projects name):
    < servlet >
    < servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl </servlet-class >
    < servlet-name >logger < /servlet-name >
    < /servlet >
    < servlet-mapping >
    < servlet-name>logger </servlet-name >
    < url-pattern>/YOURPROJECT/remote_logging </url-pattern >
    < /servlet-mapping >
Happy logging!

Friday, February 5, 2010

Declarative UI programming with GWT

If you have tried programming something on the GWT - 'platform' you should take at declarative UI programming at the guide at DevGuideUiBinder.html .oHowever, you should NOT add the panels with Document.get().appendChild( new MyBrandNewUIWidget().getElement()) as NONE of your events will ever trigger. You should however add your new widgets the old fashioned way with RootPanel.get().add( new MyBrandNewUIWidget());

Happy programming!

(Maybe I should put out an example of how great the new GWT 2.0 is, it's a lot of fun!)