Skip to content
Extensions for Groovy
Java Groovy
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


GroovyWicket adds some additional functionality and syntactic sugar to the Wicket framework through the means of a Groovy Category along with a few simple implementations of certain Wicket components.

To use GroovyWicket you need wrap the code block where it is to be used as shown below.

use(GroovyWicket) {
    //do stuff

What Can It Do?

class MyPage extends WebPage {
    MyPage(PageParameters params) {
        use(GroovyWicket) {
            //create and add a MarkupContainer to the page
            panel(id) {MarkupContainer panel->
                //add a ListView to panel
                panel << ["Item 1","Item 2","Item 3"].listView("itemList") {ListItem<String> item->
                    //add a Label to the ListItem
                //create and add a BookmarkablePageLink to any MarkupContainer
                panel.bookmarkLink("home",HomePage) {Link<HomePage> link->


Currently not much is here except for a Groovy Category for working with the Java Calendar api.


Some code examples

use(SensibleCalendar) {
    def cal = Calendar.instance
    println cal.time
    assert cal.year() == 1972
    assert cal.month() == JAN
    assert == 2

use(SensibleCalendar) {
    def cal = new Date().toCalendar()
    assert cal instanceof Calendar

use(SensibleCalendar) {
    def cal = [
            year: 1981, month: 2, day: 22
    assert cal instanceof Calendar

    println cal.time
    assert cal.year() == 1981
    assert cal.month() == FEB
    assert == 22

use(SensibleCalendar) {
    def result = "jan".month
    println "jan.month==$result"
    assert result == JAN

    result = "december".month
    println "december.month==$result"
    assert result == DEC

use(SensibleCalendar) {
    def result = "PST".timeZone()
    println "PST.timeZone==$result"
    assert result instanceof TimeZone
    assert result.ID == "PST"

use(SensibleCalendar) {
    withCal {
        println it
        assert it instanceof Calendar
    def result = withCal([year:123,month:AUG,day:7]) {cal->
        println cal
        assert cal instanceof Calendar
        assert cal.year() == 123
        assert cal.month() == AUG
        assert == 7
        return cal
    assert result instanceof Calendar
Something went wrong with that request. Please try again.