@Retention(value=RUNTIME) @Target(value=TYPE) public @interface Global
Controller class.
A Global controller does not need to be imported on a screen to be used. All application views will automatically import the controller.
For example:
@Global@Controller("myController") public class MyController {@Exposepublic void myEventHandler() { Window.alert("event dispatched!"); } //Only can handle click events@Exposepublic void myClickEventHandler(ClickEventevent) { Window.alert("event dispatched!"); } }
It can be used on a .crux.xml or .view.xml page, as illustrated by the following example:
NOTE: Only use this annotation when needed. Using this indiscriminately, can decrease the performance, spending unnecessary memory on client.<htmlxmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://www.cruxframework.org/crux" xmlns:g="http://www.cruxframework.org/crux/gwt"><body><g:buttonid="myButton" onClick="myController.myClickEventHandler" onDoubleClick="myController.myEventHandler" text="My Button"></g:button></body></html>
ControllerCopyright © 2015. All rights reserved.