labs-labs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Massimo Guidi (JIRA)" <j...@apache.org>
Subject [jira] Created: (LABS-491) [docs] Document form additional actions
Date Tue, 20 Oct 2009 17:09:59 GMT
[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: labs-unsubscribe@labs.apache.org
For additional commands, e-mail: labs-help@labs.apache.org


Mime
View raw message