001    /*
002     * Copyright 2007 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 1.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/ecl1.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     */
016    package edu.sampleu.travel.krad.controller;
017    
018    import javax.servlet.http.HttpServletRequest;
019    import javax.servlet.http.HttpServletResponse;
020    
021    import org.kuali.rice.krad.web.controller.UifControllerBase;
022    import org.kuali.rice.krad.web.form.UifFormBase;
023    import org.springframework.stereotype.Controller;
024    import org.springframework.validation.BindingResult;
025    import org.springframework.web.bind.annotation.ModelAttribute;
026    import org.springframework.web.bind.annotation.RequestMapping;
027    import org.springframework.web.bind.annotation.RequestMethod;
028    import org.springframework.web.servlet.ModelAndView;
029    
030    import edu.sampleu.travel.krad.form.UILayoutTestForm;
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")
039    public class UILayoutTestController extends UifControllerBase {
040    
041            @Override
042        protected UILayoutTestForm createInitialForm(HttpServletRequest request) {
043            return new UILayoutTestForm();
044        }
045    
046            @Override
047            @RequestMapping(params = "methodToCall=start")
048            public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
049                            HttpServletRequest request, HttpServletResponse response) {
050                UILayoutTestForm uiTestForm = (UILayoutTestForm) form;
051    
052                    return super.start(uiTestForm, result, request, response);
053            }
054    
055            @RequestMapping(method = RequestMethod.POST, params = "methodToCall=save")
056            public ModelAndView save(@ModelAttribute("KualiForm") UILayoutTestForm uiTestForm, BindingResult result,
057                            HttpServletRequest request, HttpServletResponse response) {
058    
059                    return getUIFModelAndView(uiTestForm, uiTestForm.getViewId(), "page2");
060            }
061            
062            @RequestMapping(method = RequestMethod.POST, params = "methodToCall=close")
063            public ModelAndView close(@ModelAttribute("KualiForm") UILayoutTestForm uiTestForm, BindingResult result,
064                            HttpServletRequest request, HttpServletResponse response) {
065    
066                    return getUIFModelAndView(uiTestForm, uiTestForm.getViewId(), "page1");
067            }
068    
069    }