Groovy Documentation

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

java.lang.Object
  com.vaadin.ui.AbstractComponent
      com.vaadin.ui.AbstractComponentContainer
          com.vaadin.ui.AbstractLayout
              com.vaadin.ui.CustomLayout
                  org.grails.plugin.vaadin.ui.GspTemplateLayout

class GspTemplateLayout
extends CustomLayout

A Vaadin CustomLayout that contains a single org.grails.plugin.vaadin.ui.GrailsLayout.

The contained org.grails.plugin.vaadin.ui.GrailsLayout is built using the specified layout template.

A key benefit of this class is it allows changing the Gsp after the page has been built and rendered. This is achieved by replacing the contained org.grails.plugin.vaadin.ui.GrailsLayout with a new one.

Authors:
Francis McKenzie


Field Summary
protected boolean rendered

Prevent rendering twice

 
Property Summary
GspLayout gspLayout

The contained layout

String name

The layout name or URI of the Gsp to use as layout.

 
Constructor Summary
GspTemplateLayout()

Empty constructor

 
Method Summary
void attach()

Render when attached

protected void render()

Constructs the gsp

void requestRender(boolean force = false)

Requests the render to take place if not yet done.

protected def requireVaadinApplication()

Helper method for situations where a Vaadin Application is required

void setBody(Closure body)

Sets the body of the gsp layout tag

void setContext(Map gsp)

Sets the context of the Gsp template.

protected String toLayoutName(String name)

Converts the layout name to the URI of the Gsp.

void update()

Renders the Gsp corresponding to the configured layout name or URI, and replaces the existing Gsp in this container with the result.

void update(String name)

Changes the template used for rendering the Gsp.

void update(Map args)

Changes the template used for rendering the Gsp.

 
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
 
Methods inherited from class AbstractLayout
setMargin, setMargin, setMargin, getMargin, paintContent, changeVariables, setEnabled, setWidth, addComponent, addListener, addListener, attach, removeListener, removeListener, removeComponent, 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, setStyle, 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, getComponentIterator, replaceComponent
 

Field Detail

rendered

protected boolean rendered
Prevent rendering twice


 
Property Detail

gspLayout

GspLayout gspLayout
The contained layout


name

String name
The layout name or URI of the Gsp to use as layout.

If starts with '/' then is resolved relative to 'views' dir. Otherwise, is resolved relative to 'views/vaadin/layouts'


 
Constructor Detail

GspTemplateLayout

GspTemplateLayout()
Empty constructor


 
Method Detail

attach

void attach()
Render when attached


render

protected void render()
Constructs the gsp


requestRender

void requestRender(boolean force = false)
Requests the render to take place if not yet done.

Note that rendering should only be done after the component has been attached, as the Vaadin application is required.

Parameters:
force - Force the render, even if already done


requireVaadinApplication

protected def requireVaadinApplication()
Helper method for situations where a Vaadin Application is required


setBody

void setBody(Closure body)
Sets the body of the gsp layout tag
Parameters:
body - The tag body


setContext

void setContext(Map gsp)
Sets the context of the Gsp template.
Parameters:
gsp - The gsp context args, which are listed below.
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.


toLayoutName

protected String toLayoutName(String name)
Converts the layout name to the URI of the Gsp.

If starts with '/' then is resolved relative to 'views' dir. Otherwise, is resolved relative to 'views/layouts'


update

void update()
Renders the Gsp corresponding to the configured layout name or URI, and replaces the existing Gsp in this container with the result.

Should only be called after this component is attached.


update

void update(String name)
Changes the template used for rendering the Gsp. The original body components are added to the new template.

Should only be called after this component is attached.

Parameters:
name - The layout name or URI of the Gsp to use as layout.


update

void update(Map args)
Changes the template used for rendering the Gsp. The original body components are added to the new template.

Should only be called after this component is attached.

Parameters:
name - The layout name or URI of the Gsp to use as layout.


 

Groovy Documentation