Search in sources :

Example 1 with GridModelRow

use of org.jaffa.presentation.portlet.widgets.model.GridModelRow in project jaffa-framework by jaffa-projects.

the class FormGroupViewerForm method populateRelatedFormUsage.

private void populateRelatedFormUsage(GridModel rows) {
    rows.clearRows();
    FormGroupViewerOutDto outputDto = ((FormGroupViewerComponent) getComponent()).getFormGroupViewerOutDto();
    if (outputDto != null) {
        GridModelRow row = null;
        FormUsageDto[] formUsage = outputDto.getFormUsage();
        for (int i = 0; i < formUsage.length; i++) {
            FormUsageDto rowDto = formUsage[i];
            row = rows.newRow();
            row.addElement("eventName", rowDto.getEventName());
            row.addElement("formAlternate", rowDto.getFormAlternate());
            row.addElement("copies", rowDto.getCopies());
            row.addElement("description", rowDto.getDescription());
        // .//GEN-END:RelatedFormUsage_1_be
        // Add custom code for the row//GEN-FIRST:RelatedFormUsage_1
        // .//GEN-LAST:RelatedFormUsage_1
        // .//GEN-BEGIN:RelatedFormUsage_2_be
        }
    }
}
Also used : FormUsageDto(org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto) FormGroupViewerOutDto(org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 2 with GridModelRow

use of org.jaffa.presentation.portlet.widgets.model.GridModelRow in project jaffa-framework by jaffa-projects.

the class FormSelectionMaintenanceAction method do_Rows_ShowForm_Clicked.

public FormKey do_Rows_ShowForm_Clicked(String rowNum) {
    FormKey fk = null;
    FormSelectionMaintenanceForm myForm = (FormSelectionMaintenanceForm) form;
    FormSelectionMaintenanceComponent myComp = (FormSelectionMaintenanceComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRowsWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            myComp.setFileNames("");
            fk = myComp.doShowForm(selectedRow);
        } 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.getResultsFormKey();
    }
    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 3 with GridModelRow

use of org.jaffa.presentation.portlet.widgets.model.GridModelRow in project jaffa-framework by jaffa-projects.

the class FormSelectionMaintenanceAction method do_Rows_UpdateDetail_Clicked.

public FormKey do_Rows_UpdateDetail_Clicked(String rowNum) {
    FormKey fk = null;
    FormSelectionMaintenanceForm myForm = (FormSelectionMaintenanceForm) form;
    FormSelectionMaintenanceComponent myComp = (FormSelectionMaintenanceComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRowsWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            fk = myComp.doUpdateDetail(selectedRow, this.mapping.getPath());
        } 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.getResultsFormKey();
    }
    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 4 with GridModelRow

use of org.jaffa.presentation.portlet.widgets.model.GridModelRow in project jaffa-framework by jaffa-projects.

the class FormSelectionMaintenanceComponent method print.

/**
 * Generates all forms and/or labels for the current Event and Keyset.
 * This method should be used when a User Interface is not needed.
 * Prior to calling this method, set the Event and Keyset using
 * setEvent(), setKey1(), setValue1(), setKey2(), setValue2(),setKey3(), setValue3(),
 * setKey4(), setValue4(), setKey5(), setValue5(), setKey6(), setValue6().
 * The forms and/or labels that match the current
 * Event and Keyset will be printed and/or emailed.
 * @throws ApplicationExceptions - When an exception occurs for a given
 * Form or Label, the exception will be caught and added to the
 * ApplicationExceptions.ApplicationExceptionArray.  Therefore multiple
 * exceptions may be caught and finally thrown at the end of this method.
 * Forms and/or Labels that do not experience an exception will be
 * generated successfully.
 */
public void print() throws ApplicationExceptions, Exception {
    if (log.isDebugEnabled()) {
        log.debug(" Begin generating forms and labels. ");
        log.debug("Event = " + getEvent() + ".");
        log.debug("Key 1 " + getKey1() + " = " + getValue1() + ".");
        log.debug("Key 2 " + getKey2() + " = " + getValue2() + ".");
        log.debug("Key 3 " + getKey3() + " = " + getValue3() + ".");
        log.debug("Key 4 " + getKey4() + " = " + getValue4() + ".");
        log.debug("Key 5 " + getKey5() + " = " + getValue5() + ".");
        log.debug("Key 6 " + getKey6() + " = " + getValue6() + ".");
    }
    ApplicationExceptions appExps = new ApplicationExceptions();
    GridModel gridModelRows = new GridModel();
    FormSelectionMaintenanceOutDto finderOutDto = null;
    setFormUserId(SecurityManager.getPrincipal() != null ? SecurityManager.getPrincipal().getName() : null);
    // Validate that Event and Key1 are populated at a minimum.
    if (getEvent() == null) {
        throw new ApplicationExceptions(new MandatoryFieldException("[label.Jaffa.Printing.FormSelection.Event]"));
    }
    if (getKey1() == null || getValue1() == null) {
        throw new ApplicationExceptions(new MandatoryFieldException("[label.Jaffa.Printing.FormSelection.Key1]"));
    }
    try {
        finderOutDto = (FormSelectionMaintenanceOutDto) doInquiry2();
    } catch (Exception ex) {
        throw new ApplicationExceptions(new ApplicationException(ex.getMessage()));
    }
    if (finderOutDto != null && finderOutDto.getRowsCount() > 0) {
        EditBoxModel printerModel = null;
        GridModelRow gridModelRow = null;
        FormSelectionMaintenanceOutRowDto[] rows = finderOutDto.getRows();
        for (FormSelectionMaintenanceOutRowDto row : rows) {
            gridModelRow = gridModelRows.newRow();
            gridModelRow.addElement("select", new CheckBoxModel(Boolean.TRUE));
            gridModelRow.addElement("formName", row.getFormName());
            gridModelRow.addElement("formAlternateName", row.getFormAlternateName());
            gridModelRow.addElement("formVariation", row.getFormVariation());
            gridModelRow.addElement("event", row.getEvent());
            gridModelRow.addElement("key1", row.getKey1());
            gridModelRow.addElement("key2", row.getKey2());
            gridModelRow.addElement("key3", row.getKey3());
            gridModelRow.addElement("key4", row.getKey4());
            gridModelRow.addElement("key5", row.getKey5());
            gridModelRow.addElement("key6", row.getKey6());
            gridModelRow.addElement("value1", row.getValue1());
            gridModelRow.addElement("value2", row.getValue2());
            gridModelRow.addElement("value3", row.getValue3());
            gridModelRow.addElement("value4", row.getValue4());
            gridModelRow.addElement("value5", row.getValue5());
            gridModelRow.addElement("value6", row.getValue6());
            printerModel = new EditBoxModel(row.getPrinter(), PrinterDefinitionMeta.META_PRINTER_ID);
            printerModel.setMandatory(false);
            gridModelRow.addElement("printer", printerModel);
            gridModelRow.addElement("email", new EditBoxModel(getEmailAddress()));
            gridModelRow.addElement("publish", new CheckBoxModel(Boolean.FALSE));
            gridModelRow.addElement("copies", new EditBoxModel(row.getCopies()));
            gridModelRow.addElement("object", row);
            try {
                ApplicationExceptions aes = new ApplicationExceptions();
                validateFields(gridModelRow, aes, false);
                if (aes != null && aes.size() > 0) {
                    for (Iterator i = aes.iterator(); i.hasNext(); ) {
                        ApplicationException appEx = (ApplicationException) i.next();
                        appExps.add(appEx);
                    }
                } else {
                    m_tx.dispatchPrintRequest(createPrintRequestObject(gridModelRow, false));
                }
            } catch (Exception ex) {
                appExps.add(new ApplicationException(ex.getMessage()));
            }
        }
    } else {
        if (appExps.size() == 0) {
            appExps.add(new FormSelectionException(FormSelectionException.NO_FORM_DEFINED_FOR_EVENT, getEvent()));
        }
    }
    if (appExps != null && appExps.size() > 0) {
        throw appExps;
    }
    if (log.isDebugEnabled()) {
        log.debug(" Finished generating forms and labels. ");
    }
}
Also used : FormSelectionException(org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) MandatoryFieldException(org.jaffa.datatypes.exceptions.MandatoryFieldException) FrameworkException(org.jaffa.exceptions.FrameworkException) FormSelectionException(org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException) ApplicationException(org.jaffa.exceptions.ApplicationException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MandatoryFieldException(org.jaffa.datatypes.exceptions.MandatoryFieldException) CheckBoxModel(org.jaffa.presentation.portlet.widgets.model.CheckBoxModel) ApplicationException(org.jaffa.exceptions.ApplicationException) FormSelectionMaintenanceOutRowDto(org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutRowDto) EditBoxModel(org.jaffa.presentation.portlet.widgets.model.EditBoxModel) Iterator(java.util.Iterator) FormSelectionMaintenanceOutDto(org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutDto) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 5 with GridModelRow

use of org.jaffa.presentation.portlet.widgets.model.GridModelRow in project jaffa-framework by jaffa-projects.

the class FormTemplateFinderAction method do_Rows_Delete_Clicked.

// .//GEN-END:_do_Rows_Update_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_Delete_Clicked_1_be
/**
 * Invokes the deleteObject() method on the component.
 * @param rowNum The selected row on the Results screen.
 * @return The FormKey for the Delete screen.
 */
public FormKey do_Rows_Delete_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:_do_Rows_Delete_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_Rows_Delete_Clicked_1
    // .//GEN-LAST:_do_Rows_Delete_Clicked_1
    // .//GEN-BEGIN:_do_Rows_Delete_Clicked_2_be
    FormTemplateFinderForm myForm = (FormTemplateFinderForm) form;
    FormTemplateFinderComponent myComp = (FormTemplateFinderComponent) myForm.getComponent();
    try {
        // This will stop double submits
        performTokenValidation(request);
        GridModel model = (GridModel) myForm.getRowsWM();
        GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
        if (selectedRow != null) {
            // .//GEN-END:_do_Rows_Delete_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:_do_Rows_Delete_Clicked_2
            // .//GEN-LAST:_do_Rows_Delete_Clicked_2
            // .//GEN-BEGIN:_do_Rows_Delete_Clicked_3_be
            fk = myComp.deleteObject((java.lang.Long) selectedRow.get("formId"));
        }
    } catch (ApplicationExceptions e) {
        if (log.isDebugEnabled())
            log.debug("Delete Failed");
        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.getResultsFormKey();
    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)

Aggregations

GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)136 GridModel (org.jaffa.presentation.portlet.widgets.model.GridModel)113 FormKey (org.jaffa.presentation.portlet.FormKey)104 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)103 FrameworkException (org.jaffa.exceptions.FrameworkException)100 CheckBoxModel (org.jaffa.presentation.portlet.widgets.model.CheckBoxModel)9 EditBoxModel (org.jaffa.presentation.portlet.widgets.model.EditBoxModel)8 Iterator (java.util.Iterator)6 SimpleWidgetModel (org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)4 DateTime (org.jaffa.datatypes.DateTime)3 MessageViewerOutDto (org.jaffa.modules.messaging.components.messageviewer.dto.MessageViewerOutDto)3 DateTimeModel (org.jaffa.presentation.portlet.widgets.model.DateTimeModel)3 DropDownModel (org.jaffa.presentation.portlet.widgets.model.DropDownModel)3 File (java.io.File)2 IOException (java.io.IOException)2 Method (java.lang.reflect.Method)2 BusinessEventLogFinderOutDto (org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderOutDto)2 BusinessEventLogFinderOutRowDto (org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderOutRowDto)2 HeaderElementDto (org.jaffa.modules.messaging.components.messageviewer.dto.HeaderElementDto)2 FormSelectionException (org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException)2