001: // .//GEN-BEGIN:_1_be
002: package org.jaffa.applications.test.modules.material.components.itemfinder.ui;
003:
004: import java.util.*;
005: import org.apache.log4j.Logger;
006: import org.apache.struts.action.ActionErrors;
007: import org.jaffa.presentation.portlet.ActionBase;
008: import org.jaffa.presentation.portlet.FormKey;
009: import org.jaffa.exceptions.FrameworkException;
010: import org.jaffa.exceptions.ApplicationExceptions;
011: import org.jaffa.exceptions.ApplicationException;
012: import org.jaffa.presentation.portlet.widgets.model.GridModel;
013: import org.jaffa.presentation.portlet.widgets.model.GridModelRow;
014:
015: // .//GEN-END:_1_be
016: // Add additional imports//GEN-FIRST:_imports
017:
018: // .//GEN-LAST:_imports
019: // .//GEN-BEGIN:_2_be
020: /** The Action class for handling events related to the Results screen.
021: */
022: public class ItemFinderResultsAction extends ActionBase {
023: private static final Logger log = Logger
024: .getLogger(ItemFinderResultsAction.class);
025:
026: // .//GEN-END:_2_be
027: // .//GEN-BEGIN:_do_ModifySearch_Clicked_1_be
028: /** Start a new search. This invokes the display() method on the component.
029: * @return The FormKey for the Criteria screen.
030: */
031: public FormKey do_ModifySearch_Clicked() {
032: FormKey fk = null;
033: // .//GEN-END:_do_ModifySearch_Clicked_1_be
034: // Add custom code before processing the action //GEN-FIRST:_do_ModifySearch_Clicked_1
035:
036: // .//GEN-LAST:_do_ModifySearch_Clicked_1
037: // .//GEN-BEGIN:_do_ModifySearch_Clicked_2_be
038: ItemFinderResultsForm myForm = (ItemFinderResultsForm) form;
039: ItemFinderComponent myComp = (ItemFinderComponent) myForm
040: .getComponent();
041:
042: try {
043: // .//GEN-END:_do_ModifySearch_Clicked_2_be
044: // Add custom code before invoking the component //GEN-FIRST:_do_ModifySearch_Clicked_2
045:
046: // .//GEN-LAST:_do_ModifySearch_Clicked_2
047: // .//GEN-BEGIN:_do_ModifySearch_Clicked_3_be
048: fk = myComp.displayCriteria();
049: } catch (ApplicationExceptions e) {
050: log.error(null, e);
051: myForm.raiseError(request, ActionErrors.GLOBAL_ERROR, e);
052: } catch (FrameworkException e) {
053: log.error(null, e);
054: myForm.raiseError(request, ActionErrors.GLOBAL_ERROR,
055: "error.framework.general");
056: }
057: // .//GEN-END:_do_ModifySearch_Clicked_3_be
058: // Add custom code after returning from the component //GEN-FIRST:_do_ModifySearch_Clicked_3
059:
060: // .//GEN-LAST:_do_ModifySearch_Clicked_3
061: // .//GEN-BEGIN:_do_ModifySearch_Clicked_4_be
062: // Direct User back to current form
063: if (fk == null)
064: fk = new FormKey(myForm.NAME, myComp.getComponentId());
065: return fk;
066: }
067:
068: // .//GEN-END:_do_ModifySearch_Clicked_4_be
069: // .//GEN-BEGIN:_do_Refresh_Clicked_1_be
070: /** Re-executes the search, using the same criteria as used before.
071: * @return The FormKey for the Results screen.
072: */
073: public FormKey do_Refresh_Clicked() {
074: FormKey fk = null;
075: // .//GEN-END:_do_Refresh_Clicked_1_be
076: // Add custom code before processing the action //GEN-FIRST:_do_Refresh_Clicked_1
077:
078: // .//GEN-LAST:_do_Refresh_Clicked_1
079: // .//GEN-BEGIN:_do_Refresh_Clicked_2_be
080: ItemFinderResultsForm myForm = (ItemFinderResultsForm) form;
081: ItemFinderComponent myComp = (ItemFinderComponent) myForm
082: .getComponent();
083:
084: try {
085: // .//GEN-END:_do_Refresh_Clicked_2_be
086: // Add custom code before invoking the component //GEN-FIRST:_do_Refresh_Clicked_2
087:
088: // .//GEN-LAST:_do_Refresh_Clicked_2
089: // .//GEN-BEGIN:_do_Refresh_Clicked_3_be
090: fk = myComp.displayResults();
091: } catch (ApplicationExceptions e) {
092: log.error(null, e);
093: myForm.raiseError(request, ActionErrors.GLOBAL_ERROR, e);
094: } catch (FrameworkException e) {
095: log.error(null, e);
096: myForm.raiseError(request, ActionErrors.GLOBAL_ERROR,
097: "error.framework.general");
098: }
099: // .//GEN-END:_do_Refresh_Clicked_3_be
100: // Add custom code after returning from the component //GEN-FIRST:_do_Refresh_Clicked_3
101:
102: // .//GEN-LAST:_do_Refresh_Clicked_3
103: // .//GEN-BEGIN:_do_Refresh_Clicked_4_be
104: // Direct User back to current form
105: if (fk == null)
106: fk = new FormKey(myForm.NAME, myComp.getComponentId());
107: return fk;
108: }
109:
110: // .//GEN-END:_do_Refresh_Clicked_4_be
111: // .//GEN-BEGIN:_do_Close_Clicked_1_be
112: /** Quits the component and returns the FormKey for the calling screen.
113: * @return The FormKey for the caling screen. A null will be returned, if no calling screen was specified.
114: */
115: public FormKey do_Close_Clicked() {
116: // .//GEN-END:_do_Close_Clicked_1_be
117: // Add custom code before processing the action //GEN-FIRST:_do_Close_Clicked_1
118:
119: // .//GEN-LAST:_do_Close_Clicked_1
120: // .//GEN-BEGIN:_do_Close_Clicked_2_be
121: return ((ItemFinderResultsForm) form).getComponent()
122: .quitAndReturnToCallingScreen();
123: }
124: // .//GEN-END:_do_Close_Clicked_2_be
125: // All the custom code goes here //GEN-FIRST:_custom
126:
127: // .//GEN-LAST:_custom
128: }
|