View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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 edu.sampleu.travel.krad.controller;
17  
18  import javax.servlet.http.HttpServletRequest;
19  import javax.servlet.http.HttpServletResponse;
20  
21  import edu.sampleu.demo.kitchensink.UITestObject;
22  import edu.sampleu.demo.kitchensink.UifComponentsTestForm;
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   * Controller for the Test UI Page
34   * 
35   * @author Kuali Rice Team (rice.collab@kuali.org)
36   */
37  @Controller
38  @RequestMapping(value = "/uilayouttest")
39  public class UILayoutTestController extends UifControllerBase {
40  
41      /**
42       * @see org.kuali.rice.krad.web.controller.UifControllerBase#createInitialForm(javax.servlet.http.HttpServletRequest)
43       */
44      @Override
45      protected UifComponentsTestForm createInitialForm() {
46          return new UifComponentsTestForm();
47      }
48  
49  	@Override
50  	@RequestMapping(params = "methodToCall=start")
51  	public ModelAndView start(UifFormBase form) {
52  	    UifComponentsTestForm uiTestForm = (UifComponentsTestForm) form;
53  
54          //Create a collection to be displayed in collection group table layout
55          for (int i = 0; i < 10; i++) {
56              ((UifComponentsTestForm) form).getList1generated().add(new UITestObject("A" + i, "B" + i, "C" + i,
57                      "D" + i));
58          }
59  
60  		return super.start(uiTestForm);
61  	}
62  
63  	@RequestMapping(method = RequestMethod.POST, params = "methodToCall=save")
64  	public ModelAndView save(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result,
65  			HttpServletRequest request, HttpServletResponse response) {
66  
67  		return getModelAndView(uiTestForm, "page2");
68  	}
69  	
70  	@RequestMapping(method = RequestMethod.POST, params = "methodToCall=close")
71  	public ModelAndView close(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result,
72  			HttpServletRequest request, HttpServletResponse response) {
73  
74  		return getModelAndView(uiTestForm, "page1");
75  	}
76  
77  }