001/**
002 * Copyright 2005-2012 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.UifComponentsTestForm;
022import org.kuali.rice.krad.web.controller.UifControllerBase;
023import org.kuali.rice.krad.web.form.UifFormBase;
024import org.springframework.stereotype.Controller;
025import org.springframework.validation.BindingResult;
026import org.springframework.web.bind.annotation.ModelAttribute;
027import org.springframework.web.bind.annotation.RequestMapping;
028import org.springframework.web.bind.annotation.RequestMethod;
029import org.springframework.web.servlet.ModelAndView;
030
031/**
032 * Controller for the Test UI Page
033 * 
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036@Controller
037@RequestMapping(value = "/uilayouttest")
038public class UILayoutTestController extends UifControllerBase {
039
040    /**
041     * @see org.kuali.rice.krad.web.controller.UifControllerBase#createInitialForm(javax.servlet.http.HttpServletRequest)
042     */
043    @Override
044    protected UifComponentsTestForm createInitialForm(HttpServletRequest request) {
045        return new UifComponentsTestForm();
046    }
047
048        @Override
049        @RequestMapping(params = "methodToCall=start")
050        public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
051                        HttpServletRequest request, HttpServletResponse response) {
052            UifComponentsTestForm uiTestForm = (UifComponentsTestForm) form;
053
054                return super.start(uiTestForm, result, request, response);
055        }
056
057        @RequestMapping(method = RequestMethod.POST, params = "methodToCall=save")
058        public ModelAndView save(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result,
059                        HttpServletRequest request, HttpServletResponse response) {
060
061                return getUIFModelAndView(uiTestForm, "page2");
062        }
063        
064        @RequestMapping(method = RequestMethod.POST, params = "methodToCall=close")
065        public ModelAndView close(@ModelAttribute("KualiForm") UifComponentsTestForm uiTestForm, BindingResult result,
066                        HttpServletRequest request, HttpServletResponse response) {
067
068                return getUIFModelAndView(uiTestForm, "page1");
069        }
070
071}