Feedback on proposed Groovy DSL syntax for Wicket

2008-03-06 Thread graemer

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]



New Wicket Grails Plug-in Available + about the Groovy wicket builder

2008-03-04 Thread graemer

Hi Wicket users!

We've published a new version of the Wicket plugin for Grails that works
with Wicket 1.3. See announcement  here:
http://docs.codehaus.org/display/GRAILS/2008/03/04/Wicket+1.3+Grails+Plug-in+Released

And more info here: http://docs.codehaus.org/display/GRAILS/Wicket+Plugin

One thing I wanted to do at some point was integration the Wicket Groovy
builder (http://wicketstuff.org/confluence/display/STUFFWIKI/WicketBuilder)
but it seems that the code in SVN head is out of the date and the 1.3 branch
here has been removed: 

https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/branches/wicket-1.3/wicket-contrib-groovy

Is there any version of the code that works with 1.3? If not are the
original developers of the plug-in interested in porting it to 1.3 and
including it in the Grails wicket plugin?

Cheers!
Graeme
-- 
View this message in context: 
http://www.nabble.com/New-Wicket-Grails-Plug-in-Available-%2B-about-the-Groovy-wicket-builder-tp15828796p15828796.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]