click-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <sab...@gmail.com>
Subject Using Groovy with Click
Date Fri, 17 Oct 2008 16:50:39 GMT
Hi all,

Today I played a bit with Groovy which promises seamless integration 
with Java code. Thus one can use a dynamic language together with a 
Java framework such as Click.

 From the little testing I did it seems possible to author Click pages 
using Groovy. Below is my GroovyPage.groovy class:


class GroovyPage extends Page {

   onInit() {
       def form = new Form("form");
       form.add(new TextField("field");
       addControl(form);

       def label = new Label("label");

       // Note usage of multiline string below
       label.setLabel("""
           Hello
           <br>
           World!""");

       addControl(label);
   }
}

One thing which is not yet supported in Groovy is anonymous inner 
classes. But the rest should work fine. ;-)

bob

Mime
View raw message