001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package edu.sampleu.travel.krad.controller; 017 018import javax.servlet.http.HttpServletRequest; 019import javax.servlet.http.HttpServletResponse; 020 021import edu.sampleu.demo.kitchensink.UITestObject; 022import edu.sampleu.demo.kitchensink.UifComponentsTestForm; 023import org.kuali.rice.krad.web.controller.UifControllerBase; 024import org.kuali.rice.krad.web.form.UifFormBase; 025import org.springframework.stereotype.Controller; 026import org.springframework.validation.BindingResult; 027import org.springframework.web.bind.annotation.ModelAttribute; 028import org.springframework.web.bind.annotation.RequestMapping; 029import org.springframework.web.bind.annotation.RequestMethod; 030import org.springframework.web.servlet.ModelAndView; 031 032/** 033 * Controller for the Test UI Page 034 * 035 * @author Kuali Rice Team (rice.collab@kuali.org) 036 */ 037@Controller 038@RequestMapping(value = "/uilayouttest") 039public class UILayoutTestController extends UifControllerBase { 040 041 /** 042 * @see org.kuali.rice.krad.web.controller.UifControllerBase#createInitialForm(javax.servlet.http.HttpServletRequest) 043 */ 044 @Override 045 protected UifComponentsTestForm createInitialForm() { 046 return new UifComponentsTestForm(); 047 } 048 049 @Override 050 @RequestMapping(params = "methodToCall=start") 051 public ModelAndView start(UifFormBase form) { 052 UifComponentsTestForm uiTestForm = (UifComponentsTestForm) form; 053 054 //Create a collection to be displayed in collection group table layout 055 for (int i = 0; i < 10; i++) { 056 ((UifComponentsTestForm) form).getList1generated().add(new UITestObject("A" + i, "B" + i, "C" + i, 057 "D" + i)); 058 } 059 060 return super.start(uiTestForm); 061 } 062 063 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=save") 064 public ModelAndView save(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result, 065 HttpServletRequest request, HttpServletResponse response) { 066 067 return getModelAndView(uiTestForm, "page2"); 068 } 069 070 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=close") 071 public ModelAndView close(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result, 072 HttpServletRequest request, HttpServletResponse response) { 073 074 return getModelAndView(uiTestForm, "page1"); 075 } 076 077}