[docs] Document form additional actions
---------------------------------------
Key: LABS-491
URL: https://issues.apache.org/jira/browse/LABS-491
Project: Labs
Issue Type: Improvement
Components: Magma
Affects Versions: Current
Reporter: Massimo Guidi
Fix For: Current
Magma provide a simple way to enhance your forms by adding your custom actions.
In example we can simply create a class that extends CompleteCrudHandler to add
to our cruds a "Save and Go Back to List" action.
public class AddAdminActionsWebHandler<T> extends CompleteCrudHandler<T>{
public AddAdminActionsWebHandler(Class<T> myBeanClass){
super(myBeanClass);
}
public HtmlProducer hiddenSaveAndBackToList(T bean){
new Database().save(bean);
return super.handleList().do_default();
}
@Override
public SmartForm handleNew(){
return super.handleNew()
.addAction(new FormAction("Save and go back to the
list", "hiddenSaveAndBackToList", true, true));
}
}
As you can see this class simply override the CompleteCrudHandler's handleNew()
method adding the SmartForm's addAction(String label, String method, boolean
parametrized, boolean validate) method.
You can use this simple method directly in your own handlers simply using
"addAction".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]