|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=RUNTIME) @Target(value=TYPE) public @interface Controller
This annotation can be used to expose a class as a Crux controller.
Controller classes can be refereed from a view page (.crux.xml and .view.xml files) and contain the methods
used to handle events triggered by the user interface (the pages).
For example, see the following controller:
@Controller("myController") public class MyController {@Exposepublic void myEventHandler() { Window.alert("event dispatched!"); } }
It can be used inside a .crux.xml page, as illustrated by the following example:
On the previous example, the controller<htmlxmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://www.cruxframework.org/crux" xmlns:g="http://www.cruxframework.org/crux/gwt"><body><c:screenuseController="myController"/><g:buttonid="myButton" onClick="myController.myEventHandler" text="My Button"></g:button></body></html>
myController is imported into the screen
(through the <c:screen> tag) and the method myEventHandler of this controller
is associated with click events of the widget myButton.
Expose,
Inject| Required Element Summary | |
|---|---|
String |
value
The name associated with the controller. |
| Optional Element Summary | |
|---|---|
boolean |
lazy
If this property is true, the controller is only instantiated by Crux engine when it is first required to handle an event. |
boolean |
stateful
A Statefull controller keeps its state between two controller calls. |
DeviceAdaptive.Device[] |
supportedDevices
You can choose to use the annotated class only for a restricted list of devices. |
| Element Detail |
|---|
public abstract String value
.crux.xml and .view.xml
pages to identify the controller.
public abstract boolean stateful
public abstract boolean lazy
public abstract DeviceAdaptive.Device[] supportedDevices
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||