|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectcom.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponentContainer
com.vaadin.ui.AbstractLayout
com.vaadin.ui.CustomLayout
org.grails.plugin.vaadin.ui.GspBodyLayout
org.grails.plugin.vaadin.ui.GspLayout
class GspLayout extends GspBodyLayout
A Vaadin CustomLayout that uses a Grails GSP file as the template.
This is distinct from Vaadin's custom layout, which typically requires the template to be a static HTML file.
This class facilitates mixing normal Grails tags such as <g:message> with Vaadin tags such as <v:label> in the same GSP. The aim is that you get the best of both worlds.
The GSP file can be a view, template or resource. See GspResourceLocator
Note that this class uses a 'mock' HttpRequest/HttpResponse when rendering the GSP. Currently, this implementation does not support Sitemesh layouts in GSPs. However, a GSP can use another GSP as a template by utilising the <v:layout> tag instead.
Field Summary |
---|
Fields inherited from class GspBodyLayout | |
---|---|
bodyComponents, rendered |
Property Summary | |
---|---|
Map |
attributes
The attributes for the request |
String |
controllerName
The controller name for the Gsp |
Map |
flash
The flash for the Gsp |
def |
log
|
Map |
model
The model for the Gsp |
Map |
params
The params for the Gsp |
String |
uri
The URI of the Gsp |
Constructor Summary | |
GspLayout()
Create an empty layout |
|
GspLayout(Closure body)
Create a layout from a Gsp body |
|
GspLayout(GspBodyLayout other, String uri)
Initialises this GspLayout from the other specified layout, except with a different template. |
Method Summary | |
---|---|
protected void
|
render()
Renders the GSP template and/or body |
protected void
|
renderGsp(String gsp, Map params, Map model, Map flash, String controllerName)
Initialises the superclass CustomLayout using the specified GSP as the template. |
void
|
setGsp(Map props)
Set the Gsp to use as a template for this layout. |
String
|
toString()
This component as a String - mainly useful for logging purposes. |
Methods inherited from class GspBodyLayout | |
---|---|
attach, removeBodyComponents, render, renderBody, replaceBodyComponents, requestRender, requireVaadinApplication, toString |
Property Detail |
---|
Map attributes
String controllerName
Map flash
def log
Map model
Map params
String uri
Constructor Detail |
---|
GspLayout()
GspLayout(Closure body)
GspLayout(GspBodyLayout other, String uri)
Note that this method will remove all body components from the specified layout and add them to this one instead.
layout
- The existing layout to apply the new template touri
- The uri of the new template Gsp to apply
Method Detail |
---|
protected void render()
protected void renderGsp(String gsp, Map params, Map model, Map flash, String controllerName)
The GSP is retrieved using a GspResourceLocator, and rendered using a GspResourcePageRenderer.
Any Vaadin Components in the GSP are automatically added to this CustomLayout, in the order in which they appear.
void setGsp(Map props)
props
- The properties of the gsp, as follows:uri
- The uri of the GSP view, template or resource.params
- The params map to use when rendering the GSP.model
- The model map to use when rendering the GSP.flash
- The flash scope object to use when rendering the GSP.controllerName
- The controller name to use when rendering the GSP.
String toString()
Groovy Documentation