|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectorg.grails.plugin.vaadin.VaadinDispatcher
class VaadinDispatcher
Wires VaadinControllers to GSP views using the concept of a VaadinRequest.
Note that a VaadinRequest is not a JavaEE ServletRequest. It is simply a construct for capturing a (user's) request to display a given Vaadin 'page'. See the VaadinRequest javadocs for more details.
This class also automatically listens to changes to browser URI fragments. The listening is started either by explicitly calling startFragmentListener or else it is started automatically after the first 'request' is dispatched.
Field Summary | |
---|---|
protected String |
currentController
Controller of most recent browser page |
protected String |
currentPage
Most recent browser page |
protected boolean |
fragmentListenerStarted
Ensures we only start fragment utility once |
protected UriFragmentUtility |
fragmentUtility
Fragment utility for responding to browser fragment changes |
protected boolean |
stopped
If true, the dispatcher is stopped and will not send requests to controllers |
Property Summary | |
---|---|
static String |
defaultController
The default controller to use if no controller specified |
static String |
defaultPage
The default page to use if no controller and action specified |
def |
log
|
Application |
vaadinApplication
Vaadin Application for this dispatcher |
Constructor Summary | |
VaadinDispatcher(Application application)
Create a dispatcher for the specified VaadinApplication. |
Method Summary | |
---|---|
protected void
|
attachPage(Component page)
Adds the specified component as the main window's top-level page component. |
def
|
dispatch(String fragment)
Dispatches a 'request' to show a particular Vaadin 'page' using the specified URI fragment, for example '#book/show/15' |
def
|
dispatch(Map requestArgs)
Dispatches a 'request' to show a particular Vaadin 'page' using the specified args, containing 'controller', 'action', 'id' etc. |
protected def
|
dispatch(VaadinRequest request)
Dispatches a 'request' to show a particular Vaadin 'page' using the specified {@org.grails.plugin.vaadin.VaadinRequest}. |
void
|
error(Throwable t, String fragment = null)
Dispatches to the error page for the specified error |
protected Component
|
executeRequest(VaadinRequest request, org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication, boolean attach = false)
Executes the controller and view (if not redirected) for specified request. |
protected UriFragmentUtility
|
getOrCreateFragmentUtility()
Delay creation of fragment utility until first called. |
boolean
|
getStopped()
If true, the dispatcher is stopped and will not send requests to controllers |
def
|
refresh()
Dispatches the active page request again, or goes to home page if no active page |
protected String
|
renderDefaultErrorHTML(Throwable exception)
|
Component
|
request(String fragment)
Executes a new request using the specified using the specified URI fragment, and returns the generated view Vaadin Component. |
Component
|
request(Map requestArgs)
Executes a new request using the specified args, and returns the generated view Vaadin Component. |
protected Component
|
request(VaadinRequest request, boolean attach = false)
Executes the specified {@org.grails.plugin.vaadin.VaadinRequest}, and returns the generated view Vaadin Component. |
void
|
start()
Starts the dispatcher |
def
|
startFragmentListener()
Listens for changes to browser fragment, and dispatches requests to vaadin controllers. |
void
|
stop()
Stops the dispatcher |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
protected String currentController
protected String currentPage
protected boolean fragmentListenerStarted
protected UriFragmentUtility fragmentUtility
protected boolean stopped
Property Detail |
---|
static String defaultController
static String defaultPage
def log
Application vaadinApplication
Constructor Detail |
---|
VaadinDispatcher(Application application)
application
- The Vaadin Application for this dispatcher
Method Detail |
---|
protected void attachPage(Component page)
def dispatch(String fragment)
fragment
- The URI fragment
def dispatch(Map requestArgs)
Attaches the result to the application's main window, and updates the browser fragment.
If a valid request, it is set as the active page request, so that all future requests will be executed relative to this request.
requestArgs
- The args containing the details of the request
protected def dispatch(VaadinRequest request)
Attaches the result to the application's main window, and updates the browser fragment.
If a valid request, it is set as the active request, so that all future requests will be executed relative to this request.
request
- The 'request' containing e.g. the 'controller' etc.
void error(Throwable t, String fragment = null)
t
- The error
protected Component executeRequest(VaadinRequest request, org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication, boolean attach = false)
request
- The request to executegrailsApplication
- The grailsApplication that holds the controllersattach
- If true, the component will be attached to the application's mainWindow before being returned
protected UriFragmentUtility getOrCreateFragmentUtility()
Allows the user to create the mainWindow first.
boolean getStopped()
def refresh()
protected String renderDefaultErrorHTML(Throwable exception)
Component request(String fragment)
fragment
- The URI fragment
Component request(Map requestArgs)
requestArgs
- The args containing the details of the request
protected Component request(VaadinRequest request, boolean attach = false)
request
- The 'request' containing e.g. the 'controller' etc.attach
- If true, the component will be attached to the application's mainWindow before being returned
void start()
def startFragmentListener()
If no request has been dispatched yet, this dispatches a request to the home page.
void stop()
Groovy Documentation