001/**
002 * Copyright 2005-2015 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 org.kuali.rice.krad.uif.view;
017
018/**
019 * Provides configuration for <code>View</code> instances that render an HTML
020 * form
021 * 
022 * @author Kuali Rice Team (rice.collab@kuali.org)
023 */
024public class FormView extends View {
025        private static final long serialVersionUID = -3291164284675273147L;
026
027        private boolean renderForm;
028        private boolean validateServerSide;
029        private boolean validateClientSide;
030
031        private String formPostUrl;
032
033        public FormView() {
034                renderForm = true;
035                validateServerSide = true;
036                validateClientSide = true;
037                setValidateDirty(true);
038        }
039
040        /**
041         * Indicates whether a Form element should be rendered for the View. This is
042         * necessary for pages that need to submit data back to the server. Note
043         * that even if a page is read-only, a form element is generally needed for
044         * the navigation. Defaults to true
045         * 
046         * @return true if the form element should be rendered, false if it should
047         *         not be
048         */
049        public boolean isRenderForm() {
050                return this.renderForm;
051        }
052
053        /**
054         * Setter for the render form indicator
055         * 
056         * @param renderForm
057         */
058        public void setRenderForm(boolean renderForm) {
059                this.renderForm = renderForm;
060        }
061
062        /**
063         * Indicates whether to perform the validate model phase of the view
064         * lifecycle. This phase will validate the model against configured
065         * dictionary validations and report errors. Defaults to true
066         * 
067         * @return boolean true if model data should be validated, false if it
068         *         should not be
069         * @see
070         */
071        public boolean isValidateServerSide() {
072                return this.validateServerSide;
073        }
074
075        /**
076         * Setter for the validate server side indicator
077         * 
078         * @param validateServerSide
079         */
080        public void setValidateServerSide(boolean validateServerSide) {
081                this.validateServerSide = validateServerSide;
082        }
083
084        /**
085         * Indicates whether to perform on-the-fly validation on the client using js
086         * during user data entry. Defaults to true
087         * 
088         * @return the validateClientSide
089         */
090        public boolean isValidateClientSide() {
091                return validateClientSide;
092        }
093
094        /**
095         * Setter for the validate client side indicator
096         * 
097         * @param validateClientSide
098         */
099        public void setValidateClientSide(boolean validateClientSide) {
100                this.validateClientSide = validateClientSide;
101        }
102
103        /**
104         * Specifies the URL the view's form should post to
105         * 
106         * <p>
107         * Any valid form post URL (full or relative) can be specified. If left
108         * empty, the form will be posted to the same URL of the preceding request
109         * URL.
110         * </p>
111         * 
112         * @return String post URL
113         */
114        public String getFormPostUrl() {
115                return this.formPostUrl;
116        }
117
118        /**
119         * Setter for the form post URL
120         * 
121         * @param formPostUrl
122         */
123        public void setFormPostUrl(String formPostUrl) {
124                this.formPostUrl = formPostUrl;
125        }
126
127}