So as some of you may know I've been updating the Grails Wicket plug-in.
There is quite a few users on the Grails list who have shown interest in it
and the ability to use a component framework backed onto the rest of the
Grails stack (GORM, transactional services, plugin system etc.) 

However, the plugin provides a very basic level of integration and I was
thinking it would be nice to create a Groovy DSL for Wicket. I looked into
the WicketBuilder, but really I think we can take this further. So based on
the example here:
http://www.theserverside.com/tt/articles/article.tss?l=IntroducingApacheWicket

I came up with the below syntax to represent this application (note i havent
actually implemented anything yet this is just a syntax proposal).
Thoughts/feedback/suggestions welcome:

class BasePage extends BuildablePage {
    public build() {
        stylesheet "main"
        panel "searchPanel" {
            form "searchForm" {
                def model = [:]
                bookmarkablePageLink "addContact", EditContact
                textField "searchString", model:model
                onSubmit {
                    redirect page:ListContacts, [searchString:
model.searchString]
                }
            }
        }
    }
}
class ListContacts extends BasePage {

    public build() {
        super.build();

        def contactsModel = {
Contact.findByNameLike("%${params.searchString}%") }  as
LoadableDetachableModel

        listView "contacts", contactsModel { item ->
            def view = link( "view", item.model ) {
                onClick {
                     redirect page:new ViewContact(item.model.id)
                }
            }
            view << label("firstName", new PropertyModel(item.model,
"firstName"))
            view << label("lastName", new PropertyModel(item.model,
"lastName"))

            item << view

            item << link("edit", item.model) {
                onClick {
                    redirect page:new EditContact(model.id)
                }
            }
            item << link("delete", item.model) {
                onClick {
                    item.model.delete()
                    redirect page:ListContacts  
                }
            }
            
        }
        
    }
    
}
-- 
View this message in context: 
http://www.nabble.com/Feedback-on-proposed-Groovy-DSL-syntax-for-Wicket-tp15873183p15873183.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to