Groovy Documentation

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

java.lang.Object
  com.vaadin.ui.AbstractComponent
      com.vaadin.ui.AbstractField
          com.vaadin.ui.Button
              org.grails.plugin.vaadin.ui.GrailsButton

@SuppressWarnings("unchecked")
class GrailsButton
extends Button

Mimics the g:link tag.

Note one key benefit of the Vaadin button is that you can pass the domain instance itself using the 'instance' parameter, instead of using a params map.

Authors:
Francis McKenzie
See Also:
VaadinRequest


Field Summary
protected Map args

Link specified as map - contains for example 'controller', 'action' etc.

protected boolean rendered

Prevent rendering twice

 
Fields inherited from class Button
STYLE_LINK, UNITS_PIXELS, UNITS_POINTS, UNITS_PICAS, UNITS_EM, UNITS_EX, UNITS_MM, UNITS_CM, UNITS_INCH, UNITS_PERCENTAGE, SIZE_UNDEFINED, UNIT_SYMBOLS
 
Fields inherited from class AbstractField
UNITS_PIXELS, UNITS_POINTS, UNITS_PICAS, UNITS_EM, UNITS_EX, UNITS_MM, UNITS_CM, UNITS_INCH, UNITS_PERCENTAGE, SIZE_UNDEFINED, UNIT_SYMBOLS
 
Property Summary
String fragment

Specifies fragment we are linking to.

Closure onclick

Specify a closure that mimics the javascript 'onclick'.

 
Constructor Summary
GrailsButton()

Construct an empty button.

GrailsButton(String caption, Object args)

Construct a button using the specified caption and 'request' args.

GrailsButton(String caption, Object args, Closure onclick)

Construct a button using the specified caption, 'request' args and onclick closure.

 
Method Summary
void attach()

Render when attached

void dispatch()

Dispatches the request to the specified controller/action/fragment, without executing the onclick method.

String getAction()

Get the action of the link.

Object getController()

Get the controller of the link - either a logical property name, or the class itself.

String getId()

Get the domain class id of the link.

Object getInstance()

Get the domain class instance of the link.

Closure getOnclick()

Get the onclick closure of the link.

Map getParams()

Get the params of the link.

protected void render()

Renders the gsp body.

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

protected def requireVaadinTransactionManager()

Helper method for situations where a Vaadin Transaction Manager is required

void setAction(Object action)

Set the action of the link.

void setController(Object controller)

Set the controller of the link - either a logical property name, or the class itself.

void setId(Object id)

Set the domain class id of the link.

void setInstance(Object instance)

Set the domain class instance of the link.

void setOnclick(Closure onclick)

Set the onclick closure of the link.

void setParams(Map params)

Set the params of the link.

 
Methods inherited from class Button
booleanValue, getType, addListener, addListener, addListener, removeListener, removeListener, removeListener, paintContent, changeVariables, setImmediate, click, isSwitchMode, setSwitchMode, setClickShortcut, removeClickShortcut, isDisableOnClick, setDisableOnClick, setHtmlContentAllowed, isHtmlContentAllowed, toString, getValue, setReadOnly, isReadOnly, setValue, isValid, validate, isModified, getErrorMessage, commit, addListener, addListener, isRequired, setRequired, attach, removeListener, removeListener, readOnlyStatusChange, valueChange, setPropertyDataSource, getPropertyDataSource, detach, focus, getTabIndex, setTabIndex, isInvalidCommitted, setInvalidCommitted, discard, isWriteThrough, setWriteThrough, isReadThrough, setReadThrough, addValidator, getValidators, removeValidator, isInvalidAllowed, setInvalidAllowed, setRequiredError, getRequiredError, isValidationVisible, setValidationVisible, setCurrentBufferedSourceException, removeShortcutListener, addShortcutListener, removeAllValidators, constructField, getParent, setParent, getData, setLocale, getDescription, paint, getListeners, isVisible, isEnabled, setEnabled, setVisible, getLocale, getWidth, getHeight, setIcon, getIcon, setWidth, setWidth, setWidth, setDescription, 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, setHeight, getWidthUnits, setWidthUnits, getHeightUnits, setHeightUnits, setSizeFull, setSizeUndefined, getComponentError, setComponentError, handleError, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 
Methods inherited from class AbstractField
toString, getValue, setReadOnly, getType, isReadOnly, setValue, isValid, validate, isModified, getErrorMessage, commit, addListener, addListener, isRequired, setRequired, attach, removeListener, removeListener, readOnlyStatusChange, valueChange, setPropertyDataSource, getPropertyDataSource, paintContent, changeVariables, detach, focus, getTabIndex, setTabIndex, isInvalidCommitted, setInvalidCommitted, discard, isWriteThrough, setWriteThrough, isReadThrough, setReadThrough, addValidator, getValidators, removeValidator, isInvalidAllowed, setInvalidAllowed, setRequiredError, getRequiredError, isValidationVisible, setValidationVisible, setCurrentBufferedSourceException, removeShortcutListener, addShortcutListener, removeAllValidators, constructField, getParent, setParent, getData, setLocale, getDescription, paint, getListeners, isVisible, isEnabled, setEnabled, setVisible, getLocale, getWidth, getHeight, setIcon, getIcon, setWidth, setWidth, setWidth, setDescription, 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, setHeight, getWidthUnits, setWidthUnits, getHeightUnits, setHeightUnits, setSizeFull, setSizeUndefined, setImmediate, getComponentError, setComponentError, handleError, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 

Field Detail

args

protected Map args
Link specified as map - contains for example 'controller', 'action' etc.


rendered

protected boolean rendered
Prevent rendering twice


 
Property Detail

fragment

String fragment
Specifies fragment we are linking to. Ignored if we specify other parameters such as 'controller' or 'action'


onclick

Closure onclick
Specify a closure that mimics the javascript 'onclick'. I.e. if it returns false, we don't action the link.


 
Constructor Detail

GrailsButton

GrailsButton()
Construct an empty button.


GrailsButton

GrailsButton(String caption, Object args)
Construct a button using the specified caption and 'request' args.

Note that the args can be a map containing 'controller', 'action' etc. or simply a URI fragment, e.g. "#/book/list"

See VaadinRequest for the valid list of args that can be used for a Vaadin 'request'.

Parameters:
caption - The button caption to display
args - Either a map of args or a URI fragment string
See Also:
VaadinRequest


GrailsButton

GrailsButton(String caption, Object args, Closure onclick)
Construct a button using the specified caption, 'request' args and onclick closure.

Note that the args can be a map containing 'controller', 'action' etc. or simply a URI fragment, e.g. "#/book/list"

See VaadinRequest for the valid list of args that can be used for a Vaadin 'request'.

arg:
onclick Specify a closure that mimics the javascript 'onclick'. I.e. if it returns false, we don't action the link.
Parameters:
caption - The button caption to display
args - Either a map of args or a URI fragment string
See Also:
VaadinRequest


 
Method Detail

attach

void attach()
Render when attached


dispatch

void dispatch()
Dispatches the request to the specified controller/action/fragment, without executing the onclick method.

If no controller/action/fragment is specified, then this silently does nothing.

Note that the button must be attached before this method is called.


getAction

String getAction()
Get the action of the link.


getController

Object getController()
Get the controller of the link - either a logical property name, or the class itself.


getId

String getId()
Get the domain class id of the link.


getInstance

Object getInstance()
Get the domain class instance of the link.


getOnclick

Closure getOnclick()
Get the onclick closure of the link.


getParams

Map getParams()
Get the params of the link.


render

protected void render()
Renders the gsp body.


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


requireVaadinTransactionManager

protected def requireVaadinTransactionManager()
Helper method for situations where a Vaadin Transaction Manager is required


setAction

void setAction(Object action)
Set the action of the link.


setController

void setController(Object controller)
Set the controller of the link - either a logical property name, or the class itself.


setId

void setId(Object id)
Set the domain class id of the link.


setInstance

void setInstance(Object instance)
Set the domain class instance of the link.


setOnclick

void setOnclick(Closure onclick)
Set the onclick closure of the link.


setParams

void setParams(Map params)
Set the params of the link.


 

Groovy Documentation