1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.controller;
17
18 import org.kuali.rice.krad.demo.uif.form.KradSampleAppForm;
19 import org.kuali.rice.krad.demo.uif.form.ServerPagingTestForm;
20 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
21 import org.kuali.rice.krad.uif.view.ViewTheme;
22 import org.kuali.rice.krad.web.controller.UifControllerBase;
23 import org.kuali.rice.krad.web.form.UifFormBase;
24 import org.springframework.stereotype.Controller;
25 import org.springframework.validation.BindingResult;
26 import org.springframework.web.bind.annotation.ModelAttribute;
27 import org.springframework.web.bind.annotation.RequestMapping;
28 import org.springframework.web.bind.annotation.RequestMethod;
29 import org.springframework.web.servlet.ModelAndView;
30
31 import javax.servlet.http.HttpServletRequest;
32 import javax.servlet.http.HttpServletResponse;
33
34
35
36
37
38
39 @Controller
40 @RequestMapping(value = "/serverpaging")
41 public class ServerPagingTestController extends UifControllerBase {
42
43 @Override
44 protected ServerPagingTestForm createInitialForm() {
45 ServerPagingTestForm form = new ServerPagingTestForm();
46 form.setViewId("Demo-CollectionServerPaging-View");
47
48 return form;
49 }
50
51 @Override
52 @RequestMapping(params = "methodToCall=start")
53 public ModelAndView start(UifFormBase form) {
54 return super.start(form);
55 }
56
57 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=changeTheme")
58 public ModelAndView changeTheme(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
59 HttpServletRequest request, HttpServletResponse response) {
60 changeTheme(form);
61
62 return getModelAndView(form);
63 }
64
65 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=validateView")
66 public ModelAndView validateView(@ModelAttribute("KualiForm") UifFormBase uiTestForm, BindingResult result,
67 HttpServletRequest request, HttpServletResponse response) {
68 KRADServiceLocatorWeb.getViewValidationService().validateView(uiTestForm);
69
70 return getModelAndView(uiTestForm);
71 }
72
73 private void changeTheme(UifFormBase form) {
74 String theme = ((KradSampleAppForm) form).getThemeName();
75 if (theme != null) {
76 ViewTheme newTheme = (ViewTheme) (KRADServiceLocatorWeb.getDataDictionaryService().getDictionaryBean(
77 theme));
78
79 if (newTheme != null) {
80 form.getView().setTheme(newTheme);
81 }
82 }
83 }
84 }