1 /** 2 * Copyright 2005-2012 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 org.kuali.rice.krad.uif.view; 17 18 /** 19 * Provides configuration for <code>View</code> instances that render an HTML 20 * form 21 * 22 * @author Kuali Rice Team (rice.collab@kuali.org) 23 */ 24 public class FormView extends View { 25 private static final long serialVersionUID = -3291164284675273147L; 26 27 private boolean renderForm; 28 private boolean validateServerSide; 29 private boolean validateClientSide; 30 31 private String formPostUrl; 32 33 public FormView() { 34 renderForm = true; 35 validateServerSide = true; 36 validateClientSide = true; 37 setValidateDirty(true); 38 } 39 40 /** 41 * Indicates whether a Form element should be rendered for the View. This is 42 * necessary for pages that need to submit data back to the server. Note 43 * that even if a page is read-only, a form element is generally needed for 44 * the navigation. Defaults to true 45 * 46 * @return true if the form element should be rendered, false if it should 47 * not be 48 */ 49 public boolean isRenderForm() { 50 return this.renderForm; 51 } 52 53 /** 54 * Setter for the render form indicator 55 * 56 * @param renderForm 57 */ 58 public void setRenderForm(boolean renderForm) { 59 this.renderForm = renderForm; 60 } 61 62 /** 63 * Indicates whether to perform the validate model phase of the view 64 * lifecycle. This phase will validate the model against configured 65 * dictionary validations and report errors. Defaults to true 66 * 67 * @return boolean true if model data should be validated, false if it 68 * should not be 69 * @see 70 */ 71 public boolean isValidateServerSide() { 72 return this.validateServerSide; 73 } 74 75 /** 76 * Setter for the validate server side indicator 77 * 78 * @param validateServerSide 79 */ 80 public void setValidateServerSide(boolean validateServerSide) { 81 this.validateServerSide = validateServerSide; 82 } 83 84 /** 85 * Indicates whether to perform on-the-fly validation on the client using js 86 * during user data entry. Defaults to true 87 * 88 * @return the validateClientSide 89 */ 90 public boolean isValidateClientSide() { 91 return validateClientSide; 92 } 93 94 /** 95 * Setter for the validate client side indicator 96 * 97 * @param validateClientSide 98 */ 99 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 }