Skip to content

Instantly share code, notes, and snippets.

@chanwit
Created June 7, 2009 23:39
Show Gist options
  • Save chanwit/125532 to your computer and use it in GitHub Desktop.
Save chanwit/125532 to your computer and use it in GitHub Desktop.
import org.zkoss.zkgrails.*
import org.codehaus.groovy.grails.scaffolding.*
class ScaffoldComposer extends GrailsComposer {
static scaffold = Event
def grailsApplication
def lblTitle
def boxMain
// TODO
// 1. wire events
// 2. add paginate
// 3. add annotation (if possible)
// 4. refactor it to another class,
// probably in to org.zkoss.zkgrails.scaffolding.DefaultScaffoldingTemplate
// 5. name to Name, createdDate to Created Date
// 6. i18n
def afterCompose = { window ->
// lblTitle.value = scaffold.name
def dc = grailsApplication.getDomainClass(scaffold.name)
def props = (dc.properties as Object[]).findAll {
it.name != "id" && it.name != "version"
}
props = props.sort(new DomainClassPropertyComparator(dc))
boxMain.append {
listbox(id: "lstToDo", multiple:true, rows: 10) {
listhead {
props.each { p ->
listheader(label:"${p.name}")
}
}
}
groupbox {
caption(label: "${scaffold.name}")
hbox {
button(id:"btnAdd", label:"add")
button(id:"btnUpdate", label:"update")
button(id:"btnDelete", label:"delete")
button(id:"btnRefresh", label:"refresh")
}
separator(bar: true)
grid {
rows {
props.each { p ->
row {
label(value:"${p.name}:")
textbox(id: "fd${p.name}")
}}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment