Search in sources :

Example 81 with GridModel

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

the class PrinterDefinitionLookupAction method do_Rows_View_Clicked.

// .//GEN-END:_do_CreateFromResults_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_View_Clicked_1_be
/**
 * Invokes the viewObject() method on the component.
 * @param rowNum The selected row on the Results screen.
 * @return The FormKey for the View screen.
 */
public FormKey do_Rows_View_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:_do_Rows_View_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_Rows_View_Clicked_1
    // .//GEN-LAST:_do_Rows_View_Clicked_1
    // .//GEN-BEGIN:_do_Rows_View_Clicked_2_be
    PrinterDefinitionLookupForm myForm = (PrinterDefinitionLookupForm) form;
    PrinterDefinitionLookupComponent myComp = (PrinterDefinitionLookupComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRowsWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            // .//GEN-END:_do_Rows_View_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:_do_Rows_View_Clicked_2
            // .//GEN-LAST:_do_Rows_View_Clicked_2
            // .//GEN-BEGIN:_do_Rows_View_Clicked_3_be
            fk = myComp.viewObject((java.lang.String) selectedRow.get("printerId"));
        } 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_Rows_View_Clicked_3_be
    // Add custom code after returning from the component //GEN-FIRST:_do_Rows_View_Clicked_3
    // .//GEN-LAST:_do_Rows_View_Clicked_3
    // .//GEN-BEGIN:_do_Rows_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 = 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 82 with GridModel

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

the class PrinterDefinitionLookupAction 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
    PrinterDefinitionLookupForm myForm = (PrinterDefinitionLookupForm) form;
    PrinterDefinitionLookupComponent myComp = (PrinterDefinitionLookupComponent) 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.String) selectedRow.get("printerId"));
        }
    } 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)

Example 83 with GridModel

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

the class ItemFinderResultsForm method getRowsWM.

/**
 * Getter for property rows. This is invoked by the custom tag, when the jsp is rendered, to get the current value.
 * This gets the current data from the component.
 * @return Value of property qty.
 */
public GridModel getRowsWM() {
    if (w_rows == null) {
        w_rows = (GridModel) getWidgetCache().getModel("rows");
        if (w_rows == null) {
            w_rows = new GridModel();
            getWidgetCache().addModel("rows", w_rows);
            populateRows();
        }
    }
    return w_rows;
}
Also used : GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel)

Example 84 with GridModel

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

the class ItemFinderResultsForm method populateRows.

// .//GEN-END:_2_be
// .//GEN-BEGIN:_populateRows_1_be
private void populateRows() {
    GridModel rows = getRowsWM();
    rows.clearRows();
    ItemFinderOutDto outputDto = ((ItemFinderComponent) getComponent()).getItemFinderOutDto();
    if (outputDto != null) {
        GridModelRow row;
        for (int i = 0; i < outputDto.getRowsCount(); i++) {
            ItemFinderOutRowDto rowDto = outputDto.getRows(i);
            row = rows.newRow();
            row.addElement("segregationCode", rowDto.getSegregationCode());
            row.addElement("itemId", rowDto.getItemId());
            row.addElement("partNo", rowDto.getPartNo());
            row.addElement("serial", rowDto.getSerial());
            row.addElement("qty", rowDto.getQty());
        // .//GEN-END:_populateRows_1_be
        // Add custom code for the row //GEN-FIRST:_populateRows_1
        // .//GEN-LAST:_populateRows_1
        // .//GEN-BEGIN:_populateRows_2_be
        }
    }
}
Also used : ItemFinderOutDto(org.jaffa.applications.test.modules.material.components.itemfinder.dto.ItemFinderOutDto) GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) ItemFinderOutRowDto(org.jaffa.applications.test.modules.material.components.itemfinder.dto.ItemFinderOutRowDto) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 85 with GridModel

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

the class UserTimeEntryFinderAction method do_Rows_View_Clicked.

// .//GEN-END:_do_CreateFromResults_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_View_Clicked_1_be
/**
 * Invokes the viewObject() method on the component.
 * @param rowNum The selected row on the Results screen.
 * @return The FormKey for the View screen.
 */
public FormKey do_Rows_View_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:_do_Rows_View_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_Rows_View_Clicked_1
    // .//GEN-LAST:_do_Rows_View_Clicked_1
    // .//GEN-BEGIN:_do_Rows_View_Clicked_2_be
    UserTimeEntryFinderForm myForm = (UserTimeEntryFinderForm) form;
    UserTimeEntryFinderComponent myComp = (UserTimeEntryFinderComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRowsWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            // .//GEN-END:_do_Rows_View_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:_do_Rows_View_Clicked_2
            // .//GEN-LAST:_do_Rows_View_Clicked_2
            // .//GEN-BEGIN:_do_Rows_View_Clicked_3_be
            fk = myComp.viewObject((java.lang.String) selectedRow.get("userName"), (java.lang.String) selectedRow.get("projectCode"), (java.lang.String) selectedRow.get("task"), (org.jaffa.datatypes.DateTime) selectedRow.get("periodStart"), (org.jaffa.datatypes.DateTime) selectedRow.get("periodEnd"));
        } 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_Rows_View_Clicked_3_be
    // Add custom code after returning from the component //GEN-FIRST:_do_Rows_View_Clicked_3
    // .//GEN-LAST:_do_Rows_View_Clicked_3
    // .//GEN-BEGIN:_do_Rows_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 = 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

GridModel (org.jaffa.presentation.portlet.widgets.model.GridModel)135 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)113 FormKey (org.jaffa.presentation.portlet.FormKey)106 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)104 FrameworkException (org.jaffa.exceptions.FrameworkException)101 CheckBoxModel (org.jaffa.presentation.portlet.widgets.model.CheckBoxModel)6 EditBoxModel (org.jaffa.presentation.portlet.widgets.model.EditBoxModel)6 DateTime (org.jaffa.datatypes.DateTime)3 DateTimeModel (org.jaffa.presentation.portlet.widgets.model.DateTimeModel)3 DropDownModel (org.jaffa.presentation.portlet.widgets.model.DropDownModel)3 Method (java.lang.reflect.Method)2 FormSelectionException (org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException)2 FormSelectionMaintenanceOutDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutDto)2 FormSelectionMaintenanceOutRowDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutRowDto)2 ImageModel (org.jaffa.presentation.portlet.widgets.model.ImageModel)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Enumeration (java.util.Enumeration)1