@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Factory
Controller class.
Methods annotated with this annotation can be refereed on .crux.xml and .view.xml pages.
A method must obey the following constraints to be exposed as a factory:
1) Be annotated with @Factory annotation.
2) Have public visibility.
3) Have only one parameter (The factory input).
4) Return a value (not void). This is the factory output.
For example:
@Controller("myController") public class MyController {@Factory public Label myWidgetFactory(Person person) { return new Label(person.getName()); } }
It can be used on a .crux.xml or .view.xml page, as illustrated by the following example:
<htmlxmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://www.cruxframework.org/crux" xmlns:g="http://www.cruxframework.org/crux/gwt">xmlns:faces="http://www.cruxframework.org/crux/smart-faces"<body><c:screenuseController="myController" useDataSource="personDS"/><faces:widgetList dataSource="personDS" id="people" autoLoadData="true" pageSize="20" width="100%" height="100%"> <faces:widgetFactoryOnController onCreateWidget="myController.myWidgetFactory"/> </faces:widgetList></body></html>
ControllerCopyright © 2015. All rights reserved.