1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package edu.sampleu.travel.krad.controller; |
17 | |
|
18 | |
import javax.servlet.http.HttpServletRequest; |
19 | |
import javax.servlet.http.HttpServletResponse; |
20 | |
|
21 | |
import org.kuali.rice.krad.uif.UifParameters; |
22 | |
import org.kuali.rice.krad.util.GlobalVariables; |
23 | |
import org.kuali.rice.krad.web.controller.UifControllerBase; |
24 | |
import org.kuali.rice.krad.web.form.UifFormBase; |
25 | |
import org.springframework.stereotype.Controller; |
26 | |
import org.springframework.validation.BindingResult; |
27 | |
import org.springframework.web.bind.annotation.ModelAttribute; |
28 | |
import org.springframework.web.bind.annotation.RequestMapping; |
29 | |
import org.springframework.web.bind.annotation.RequestMethod; |
30 | |
import org.springframework.web.servlet.ModelAndView; |
31 | |
|
32 | |
import edu.sampleu.travel.krad.form.UILayoutTestForm; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | 0 | @Controller |
40 | |
@RequestMapping(value = "/uicomponents") |
41 | 0 | public class UIComponentsTestController extends UifControllerBase { |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
@Override |
47 | |
protected UILayoutTestForm createInitialForm(HttpServletRequest request) { |
48 | 0 | return new UILayoutTestForm(); |
49 | |
} |
50 | |
|
51 | |
@Override |
52 | |
@RequestMapping(params = "methodToCall=start") |
53 | |
public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
54 | |
HttpServletRequest request, HttpServletResponse response) { |
55 | 0 | UILayoutTestForm uiTestForm = (UILayoutTestForm) form; |
56 | |
|
57 | 0 | return super.start(uiTestForm, result, request, response); |
58 | |
} |
59 | |
|
60 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=save") |
61 | |
public ModelAndView save(@ModelAttribute("KualiForm") UILayoutTestForm uiTestForm, BindingResult result, |
62 | |
HttpServletRequest request, HttpServletResponse response) { |
63 | |
|
64 | 0 | return getUIFModelAndView(uiTestForm, "page2"); |
65 | |
} |
66 | |
|
67 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=close") |
68 | |
public ModelAndView close(@ModelAttribute("KualiForm") UILayoutTestForm uiTestForm, BindingResult result, |
69 | |
HttpServletRequest request, HttpServletResponse response) { |
70 | |
|
71 | 0 | return getUIFModelAndView(uiTestForm, "page1"); |
72 | |
} |
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=navigate") |
78 | |
public ModelAndView navigate(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
79 | |
HttpServletRequest request, HttpServletResponse response) { |
80 | 0 | String pageId = form.getActionParamaterValue(UifParameters.NAVIGATE_TO_PAGE_ID); |
81 | |
|
82 | 0 | if(pageId.equals("uifpage7")){ |
83 | 0 | GlobalVariables.getMessageMap().putError("gField1", "serverTestError"); |
84 | 0 | GlobalVariables.getMessageMap().putError("gField1", "serverTestError2"); |
85 | 0 | GlobalVariables.getMessageMap().putError("gField2", "serverTestError"); |
86 | 0 | GlobalVariables.getMessageMap().putError("gField3", "serverTestError"); |
87 | 0 | GlobalVariables.getMessageMap().putWarning("gField1", "serverTestWarning"); |
88 | 0 | GlobalVariables.getMessageMap().putWarning("gField2", "serverTestWarning"); |
89 | 0 | GlobalVariables.getMessageMap().putInfo("gField2", "serverTestInfo"); |
90 | 0 | GlobalVariables.getMessageMap().putInfo("gField3", "serverTestInfo"); |
91 | |
} |
92 | |
|
93 | 0 | form.setRenderFullView(false); |
94 | |
|
95 | 0 | return getUIFModelAndView(form, pageId); |
96 | |
} |
97 | |
|
98 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=refreshProgGroup") |
99 | |
public ModelAndView refreshProgGroup(@ModelAttribute("KualiForm") UILayoutTestForm uiTestForm, BindingResult result, |
100 | |
HttpServletRequest request, HttpServletResponse response) { |
101 | |
|
102 | 0 | return updateComponent(uiTestForm, result, request, response); |
103 | |
} |
104 | |
} |