Search in sources :

Example 41 with FormKey

use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.

the class ValidationRulesEditorAction method do_Save_Clicked.

/**
 * Clicked event handler for the field Save.
 * @return The FormKey.
 */
public FormKey do_Save_Clicked() {
    FormKey fk = null;
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    try {
        // Copy the values from Form to Component
        myForm.doValidate(request);
        // save the file contents
        myComp.performSave();
    } catch (ApplicationExceptions e) {
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
    } catch (FrameworkException e) {
        log.error(null, e);
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
    }
    if (fk == null)
        fk = myComp.determineFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Example 42 with FormKey

use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.

the class ValidationRulesEditorAction method do_CoreRulesUrl_Clicked.

/**
 * Invoked if the core-rules URL is clicked
 * @return The FormKey for the Update screen.
 */
public FormKey do_CoreRulesUrl_Clicked() {
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    FormKey fk = null;
    try {
        String fileName = (String) Config.getProperty(Config.PROP_RULES_ENGINE_CORE_RULES_URL, null);
        if (!fileName.equals(myComp.getValidationRulesFile())) {
            myComp.setFileContents(null);
            myComp.setValidationRulesFile(fileName);
            myComp.loadFileContents();
        }
        myComp.determineAndSetNextScreen();
    } catch (ApplicationExceptions e) {
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
    } catch (FrameworkException e) {
        log.error(null, e);
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
    }
    // Direct User back to current form
    if (fk == null)
        fk = myComp.determineFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Example 43 with FormKey

use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.

the class ValidationRulesEditorAction method do_ValidatorsUrls_Update_Clicked.

/**
 * Invoked if a update button on a row is selected.
 * @param rowId The selected row on the screen.
 * @return The FormKey for the Update screen.
 */
public FormKey do_ValidatorsUrls_Update_Clicked(String rowId) {
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    FormKey fk = null;
    GridModel model = (GridModel) myForm.getValidatorsUrlsWM();
    GridModelRow selectedRow = model.getRowById(Integer.parseInt(rowId));
    if (selectedRow != null) {
        try {
            String fileName = (String) selectedRow.get("validatorsUrl");
            if (!fileName.equals(myComp.getValidationRulesFile())) {
                myComp.setFileContents(null);
                myComp.setValidationRulesFile(fileName);
                myComp.loadFileContents();
            }
            myComp.determineAndSetNextScreen();
        } catch (ApplicationExceptions e) {
            myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
        } catch (FrameworkException e) {
            log.error(null, e);
            myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
        }
    }
    // Direct User back to current form
    if (fk == null)
        fk = myComp.determineFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) FormKey(org.jaffa.presentation.portlet.FormKey) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 44 with FormKey

use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.

the class ValidationRulesEditorAction method do_Rules_Update_Clicked.

/**
 * Invoked if a update button on a row is selected.
 * @param rowId The selected row on the screen.
 * @return The FormKey for the Update screen.
 */
public FormKey do_Rules_Update_Clicked(String rowId) {
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    FormKey fk = null;
    GridModel model = (GridModel) myForm.getRulesWM();
    GridModelRow selectedRow = model.getRowById(Integer.parseInt(rowId));
    if (selectedRow != null) {
        try {
            String fileName = (String) selectedRow.get("name");
            if (!fileName.equals(myComp.getValidationRulesFile())) {
                myComp.setFileContents(null);
                myComp.setValidationRulesFile(fileName);
                myComp.loadFileContents();
            }
            myComp.determineAndSetNextScreen();
        } catch (ApplicationExceptions e) {
            myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
        } catch (FrameworkException e) {
            log.error(null, e);
            myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
        }
    }
    // Direct User back to current form
    if (fk == null)
        fk = myComp.determineFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) FormKey(org.jaffa.presentation.portlet.FormKey) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 45 with FormKey

use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.

the class ValidationRulesEditorAction method do_Refresh_Clicked.

/**
 * Clicked event handler for the field Refresh.
 * @return The FormKey.
 */
public FormKey do_Refresh_Clicked() {
    FormKey fk = null;
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    myComp.setFileContents(null);
    try {
        myComp.loadFileContents();
    } catch (ApplicationExceptions e) {
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
    } catch (FrameworkException e) {
        log.error(null, e);
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
    }
    if (fk == null)
        fk = myComp.determineFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Aggregations

FormKey (org.jaffa.presentation.portlet.FormKey)231 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)205 FrameworkException (org.jaffa.exceptions.FrameworkException)205 GridModel (org.jaffa.presentation.portlet.widgets.model.GridModel)106 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)104 ApplicationException (org.jaffa.exceptions.ApplicationException)4 CheckBoxModel (org.jaffa.presentation.portlet.widgets.model.CheckBoxModel)4 File (java.io.File)3 IOException (java.io.IOException)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 Method (java.lang.reflect.Method)2 Iterator (java.util.Iterator)2 FormSelectionException (org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException)2 FormSelectionMaintenanceOutRowDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutRowDto)2 Component (org.jaffa.presentation.portlet.component.Component)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 AccessControlException (java.security.AccessControlException)1