1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.demo.kitchensink;
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
33
34
35
36
37 @Controller
38 @RequestMapping(value = "/uicomponents")
39 public class UifComponentsTestController extends UifControllerBase {
40
41
42
43
44 @Override
45 protected UifComponentsTestForm createInitialForm(HttpServletRequest request) {
46 return new UifComponentsTestForm();
47 }
48
49 @Override
50 @RequestMapping(params = "methodToCall=start")
51 public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
52 HttpServletRequest request, HttpServletResponse response) {
53 UifComponentsTestForm uiTestForm = (UifComponentsTestForm) form;
54
55 return super.start(uiTestForm, result, request, response);
56 }
57
58 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=save")
59 public ModelAndView save(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result,
60 HttpServletRequest request, HttpServletResponse response) {
61
62 return getUIFModelAndView(uiTestForm, "page2");
63 }
64
65 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=close")
66 public ModelAndView close(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result,
67 HttpServletRequest request, HttpServletResponse response) {
68
69 return getUIFModelAndView(uiTestForm, "page1");
70 }
71
72
73
74
75 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=navigate")
76 public ModelAndView navigate(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
77 HttpServletRequest request, HttpServletResponse response) {
78 String pageId = form.getActionParamaterValue(UifParameters.NAVIGATE_TO_PAGE_ID);
79
80 if(pageId.equals("UifCompView-Page8")){
81 GlobalVariables.getMessageMap().putError("gField1", "serverTestError");
82 GlobalVariables.getMessageMap().putError("gField1", "serverTestError2");
83 GlobalVariables.getMessageMap().putError("gField2", "serverTestError");
84 GlobalVariables.getMessageMap().putError("gField3", "serverTestError");
85 GlobalVariables.getMessageMap().putWarning("gField1", "serverTestWarning");
86 GlobalVariables.getMessageMap().putWarning("gField2", "serverTestWarning");
87 GlobalVariables.getMessageMap().putInfo("gField2", "serverTestInfo");
88 GlobalVariables.getMessageMap().putInfo("gField3", "serverTestInfo");
89 }
90
91 form.setRenderFullView(false);
92
93 return getUIFModelAndView(form, pageId);
94 }
95
96 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=refreshProgGroup")
97 public ModelAndView refreshProgGroup(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result,
98 HttpServletRequest request, HttpServletResponse response) {
99
100 return updateComponent(uiTestForm, result, request, response);
101 }
102 }