Groovy Documentation

org.grails.plugin.vaadin.ui
[Groovy] Class GspLayout

java.lang.Object
  com.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.

Authors:
Francis McKenzie


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
 
Methods inherited from class CustomLayout
getComponent, getComponentCount, setMargin, setMargin, addComponent, addComponent, setStyle, removeComponent, removeComponent, getComponentIterator, paintContent, replaceComponent, getTemplateName, getTemplateContents, setTemplateName, setTemplateContents, setMargin, getMargin, changeVariables, setEnabled, setWidth, addListener, addListener, attach, removeListener, removeListener, removeAllComponents, requestRepaintAll, moveComponentsFrom, detach, setHeight, getParent, setReadOnly, isReadOnly, setParent, getData, setLocale, getDescription, paint, getListeners, isVisible, isEnabled, setVisible, getLocale, getWidth, getHeight, setIcon, getIcon, setWidth, setWidth, setDescription, getErrorMessage, setErrorHandler, getErrorHandler, addListener, addListener, addListener, addListener, getStyle, setData, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, getStyleName, setStyleName, addStyleName, removeStyleName, getCaption, setCaption, getWindow, getApplication, childRequestedRepaint, setDebugId, getDebugId, requestRepaintRequests, isImmediate, setHeight, setHeight, getWidthUnits, setWidthUnits, getHeightUnits, setHeightUnits, setSizeFull, setSizeUndefined, setImmediate, getComponentError, setComponentError, handleError, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Property Detail

attributes

Map attributes
The attributes for the request


controllerName

String controllerName
The controller name for the Gsp


flash

Map flash
The flash for the Gsp


log

def log


model

Map model
The model for the Gsp


params

Map params
The params for the Gsp


uri

String uri
The URI of the Gsp


 
Constructor Detail

GspLayout

GspLayout()
Create an empty layout


GspLayout

GspLayout(Closure body)
Create a layout from a Gsp body


GspLayout

GspLayout(GspBodyLayout other, String uri)
Initialises this GspLayout from the other specified layout, except with a different template.

Note that this method will remove all body components from the specified layout and add them to this one instead.

Parameters:
layout - The existing layout to apply the new template to
uri - The uri of the new template Gsp to apply


 
Method Detail

render

protected void render()
Renders the GSP template and/or body


renderGsp

protected void renderGsp(String gsp, Map params, Map model, Map flash, String controllerName)
Initialises the superclass CustomLayout using the specified GSP as the template.

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.


setGsp

void setGsp(Map props)
Set the Gsp to use as a template for this layout.
Parameters:
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.


toString

String toString()
This component as a String - mainly useful for logging purposes.


 

Groovy Documentation