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