Uploaded image for project: 'Labs (Retired)'
  1. Labs (Retired)
  2. LABS-491

[docs] Document form additional actions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • Current
    • Next
    • Magma
    • None

    Description

      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".

      Attachments

        Activity

          People

            Unassigned Unassigned
            massimo.guidi Massimo Guidi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: