Search in sources :

Example 21 with GridModelRow

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

the class FormDefinitionLookupAction method do_Rows_Update_Clicked.

// .//GEN-END:_do_Rows_View_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_Update_Clicked_1_be
/**
 * Invokes the updateObject() method on the component.
 * @param rowNum The selected row on the Results screen.
 * @return The FormKey for the Update screen.
 */
public FormKey do_Rows_Update_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:_do_Rows_Update_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_Rows_Update_Clicked_1
    // .//GEN-LAST:_do_Rows_Update_Clicked_1
    // .//GEN-BEGIN:_do_Rows_Update_Clicked_2_be
    FormDefinitionLookupForm myForm = (FormDefinitionLookupForm) form;
    FormDefinitionLookupComponent myComp = (FormDefinitionLookupComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRowsWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            // .//GEN-END:_do_Rows_Update_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:_do_Rows_Update_Clicked_2
            // .//GEN-LAST:_do_Rows_Update_Clicked_2
            // .//GEN-BEGIN:_do_Rows_Update_Clicked_3_be
            fk = myComp.updateObject((java.lang.Long) selectedRow.get("formId"));
        } catch (ApplicationExceptions e) {
            if (log.isDebugEnabled())
                log.debug("Update 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)

Example 22 with GridModelRow

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

the class BusinessEventLogViewerAction method do_RelatedAttachment_View_Clicked.

/**
 * Invokes the viewAttachment() method on the component.
 * @param rowNum The selected row on the Grid.
 * @return The FormKey for the View screen of the Attachment object.
 */
public FormKey do_RelatedAttachment_View_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:do_RelatedAttachment_View_Clicked_1_be
    // Add custom code before processing the action//GEN-FIRST:do_RelatedAttachment_View_Clicked_1
    // .//GEN-LAST:do_RelatedAttachment_View_Clicked_1
    // .//GEN-BEGIN:do_RelatedAttachment_View_Clicked_2_be
    BusinessEventLogViewerForm myForm = (BusinessEventLogViewerForm) form;
    BusinessEventLogViewerComponent myComp = (BusinessEventLogViewerComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRelatedAttachmentWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            // .//GEN-END:do_RelatedAttachment_View_Clicked_2_be
            // Add custom code before invoking the component//GEN-FIRST:do_RelatedAttachment_View_Clicked_2
            // .//GEN-LAST:do_RelatedAttachment_View_Clicked_2
            // .//GEN-BEGIN:do_RelatedAttachment_View_Clicked_3_be
            fk = myComp.viewAttachment((java.lang.String) selectedRow.get("attachmentId"));
        } catch (ApplicationExceptions e) {
            if (log.isDebugEnabled())
                log.debug("Viewer Failed");
            myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
        } catch (FrameworkException e) {
            log.error(null, e);
            myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
        }
    }
    // .//GEN-END:do_RelatedAttachment_View_Clicked_3_be
    // Add custom code before returning//GEN-FIRST:do_RelatedAttachment_View_Clicked_3
    // .//GEN-LAST:do_RelatedAttachment_View_Clicked_3
    // .//GEN-BEGIN:do_RelatedAttachment_View_Clicked_4_be
    // The Viewer will be rendered in a new window
    // We don't want to see the existing HistoryNav in that window
    // Hence, initialize the HistoryNav
    HistoryNav.initializeHistoryNav(request);
    // Direct User back to current form
    if (fk == null)
        fk = new FormKey(myForm.NAME, myComp.getComponentId());
    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 23 with GridModelRow

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

the class BusinessEventLogViewerAction method do_RelatedAttachment_ViewAttachmentData_Clicked.

// .//GEN-END:_do_Close_Clicked_2_be
// All the custom code goes here//GEN-FIRST:_custom
/**
 * Creates a temporary file with the attachment data and adds it as an attribute to the request stream.
 * Returns a FormKey pointing to Jaffa's FileExplorer servlet which downloads the temporary file.
 * @param rowNum The selected row on the Results screen.
 * @return the FormKey for the FileExplorer servlet. A null is returned if the input data is null.
 */
public FormKey do_RelatedAttachment_ViewAttachmentData_Clicked(String rowNum) {
    FormKey fk = null;
    BusinessEventLogViewerForm myForm = (BusinessEventLogViewerForm) form;
    BusinessEventLogViewerComponent myComp = (BusinessEventLogViewerComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRelatedAttachmentWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null)
        fk = AttachmentComponentHelper.loadAttachmentData(myForm, request, (String) selectedRow.get("originalFileName"), (byte[]) selectedRow.get("data"));
    if (fk == null)
        fk = myComp.getViewerFormKey();
    return fk;
}
Also used : GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) FormKey(org.jaffa.presentation.portlet.FormKey) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 24 with GridModelRow

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

the class MessageViewerForm method populateRelatedBusinessEventLog.

private void populateRelatedBusinessEventLog(GridModel rows) {
    rows.clearRows();
    MessageViewerOutDto outputDto = ((MessageViewerComponent) getComponent()).getMessageViewerOutDto();
    if (outputDto != null) {
        BusinessEventLogFinderOutDto businessEventLogOutDto = outputDto.getBusinessEventLog();
        if (businessEventLogOutDto != null) {
            GridModelRow row;
            for (int i = 0; i < businessEventLogOutDto.getRowsCount(); i++) {
                BusinessEventLogFinderOutRowDto rowDto = businessEventLogOutDto.getRows(i);
                row = rows.newRow();
                row.addElement("logId", rowDto.getLogId());
                row.addElement("messageId", rowDto.getMessageId());
                row.addElement("loggedOn", rowDto.getLoggedOn());
                row.addElement("processName", rowDto.getProcessName());
                row.addElement("subProcessName", rowDto.getSubProcessName());
                row.addElement("messageType", rowDto.getMessageType());
                row.addElement("messageText", rowDto.getMessageText());
            }
        }
    }
}
Also used : MessageViewerOutDto(org.jaffa.modules.messaging.components.messageviewer.dto.MessageViewerOutDto) BusinessEventLogFinderOutDto(org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderOutDto) BusinessEventLogFinderOutRowDto(org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderOutRowDto) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 25 with GridModelRow

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

the class MessageViewerForm method populateHeaders.

private void populateHeaders(GridModel rows) {
    rows.clearRows();
    MessageViewerOutDto outputDto = ((MessageViewerComponent) getComponent()).getMessageViewerOutDto();
    if (outputDto != null) {
        HeaderElementDto[] headerElements = outputDto.getHeaderElements();
        if (headerElements != null) {
            for (HeaderElementDto headerElement : headerElements) {
                if (headerElement.getLabel() != null) {
                    GridModelRow row = rows.newRow();
                    row.addElement("name", headerElement.getName());
                    row.addElement("value", headerElement.getValue());
                    row.addElement("label", headerElement.getLabel());
                }
            }
        }
    }
}
Also used : MessageViewerOutDto(org.jaffa.modules.messaging.components.messageviewer.dto.MessageViewerOutDto) HeaderElementDto(org.jaffa.modules.messaging.components.messageviewer.dto.HeaderElementDto) 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