01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.module.kra.budget.web.struts.action;
17:
18: import javax.servlet.http.HttpServletRequest;
19: import javax.servlet.http.HttpServletResponse;
20:
21: import org.apache.struts.action.ActionForm;
22: import org.apache.struts.action.ActionForward;
23: import org.apache.struts.action.ActionMapping;
24: import org.kuali.module.kra.budget.web.struts.form.BudgetForm;
25:
26: /**
27: * Action for BudgetNonpersonnelCopyOver page.
28: */
29: public class BudgetNonpersonnelCopyOverAction extends BudgetAction {
30:
31: public ActionForward update(ActionMapping mapping, ActionForm form,
32: HttpServletRequest request, HttpServletResponse response)
33: throws Exception {
34: BudgetForm budgetForm = (BudgetForm) form;
35:
36: // ensures that origin item checkboxes and totals are displaied correctly
37: budgetForm.getBudgetNonpersonnelCopyOverFormHelper().refresh(
38: budgetForm.getBudgetDocument().getBudget().getPeriods()
39: .size());
40:
41: return super .update(mapping, form, request, response);
42: }
43:
44: /**
45: * Handling the return to nonpersonnel page. It deconstructs the BudgetNonpersonnelCopyOverFormHelper and resets the tab states.
46: *
47: * @param mapping
48: * @param form
49: * @param request
50: * @param response
51: * @return
52: * @throws Exception
53: */
54: public ActionForward returnNonpersonnel(ActionMapping mapping,
55: ActionForm form, HttpServletRequest request,
56: HttpServletResponse response) throws Exception {
57: BudgetForm budgetForm = (BudgetForm) form;
58:
59: // deconstruct BudgetNonpersonnelCopyOverFormHelper
60: budgetForm.getBudgetNonpersonnelCopyOverFormHelper()
61: .deconstruct(budgetForm);
62:
63: // This is so that tab states are not shared between pages.
64: budgetForm.newTabState(false, false);
65:
66: return mapping.findForward("nonpersonnel");
67: }
68:
69: /**
70: * Handling the return to nonpersonnel page. It only resets the tab states.
71: *
72: * @param mapping
73: * @param form
74: * @param request
75: * @param response
76: * @return
77: * @throws Exception
78: */
79: public ActionForward cancel(ActionMapping mapping, ActionForm form,
80: HttpServletRequest request, HttpServletResponse response)
81: throws Exception {
82: BudgetForm budgetForm = (BudgetForm) form;
83:
84: // user cancelled, so no deconstruction necessary because data is junked
85:
86: // This is so that tab states are not shared between pages.
87: budgetForm.newTabState(false, false);
88:
89: return mapping.findForward("nonpersonnel");
90: }
91: }
|