| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ViewModel |
|
| 1.0;1 |
| 1 | /** | |
| 2 | * Copyright 2005-2011 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 | import org.kuali.rice.krad.uif.UifConstants.ViewType; | |
| 19 | ||
| 20 | import java.io.Serializable; | |
| 21 | import java.util.List; | |
| 22 | import java.util.Map; | |
| 23 | import java.util.Set; | |
| 24 | ||
| 25 | /** | |
| 26 | * Interface that must be implemented for clases the provide the backing data (model) for a {@link View} | |
| 27 | * | |
| 28 | * <p> | |
| 29 | * Since the View relies on helper properties from the model it is necessary the backing object implement this | |
| 30 | * interface. Note model objects can extend {@link org.kuali.rice.krad.web.form.UifFormBase} which implements | |
| 31 | * this interface | |
| 32 | * </p> | |
| 33 | * | |
| 34 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 35 | */ | |
| 36 | public interface ViewModel extends Serializable { | |
| 37 | ||
| 38 | /** | |
| 39 | * Unique Id for the <code>View</code> instance. This is specified for a | |
| 40 | * view in its definition by setting the 'id' property. | |
| 41 | * | |
| 42 | * @return String view id | |
| 43 | */ | |
| 44 | public String getViewId(); | |
| 45 | ||
| 46 | /** | |
| 47 | * Setter for the unique view id | |
| 48 | * | |
| 49 | * @param viewId | |
| 50 | */ | |
| 51 | public void setViewId(String viewId); | |
| 52 | ||
| 53 | /** | |
| 54 | * Name for the <code>View</code> instance. This is specified for a view in | |
| 55 | * its definition by setting the 'id' property. The name is not necessary | |
| 56 | * unique and cannot be used by itself to retrieve a view. Typically it is | |
| 57 | * used with other parameters to identify a view with a certain type (view | |
| 58 | * type) | |
| 59 | * | |
| 60 | * @return String view name | |
| 61 | */ | |
| 62 | public String getViewName(); | |
| 63 | ||
| 64 | /** | |
| 65 | * Setter for the view name | |
| 66 | * | |
| 67 | * @param viewName | |
| 68 | */ | |
| 69 | public void setViewName(String viewName); | |
| 70 | ||
| 71 | /** | |
| 72 | * Name for the type of view being requested. This can be used to find | |
| 73 | * <code>View</code> instances by request parameters (not necessary the | |
| 74 | * unique id) | |
| 75 | * | |
| 76 | * @return String view type name | |
| 77 | */ | |
| 78 | public ViewType getViewTypeName(); | |
| 79 | ||
| 80 | /** | |
| 81 | * Setter for the view type name | |
| 82 | * | |
| 83 | * @param viewTypeName | |
| 84 | */ | |
| 85 | public void setViewTypeName(ViewType viewTypeName); | |
| 86 | ||
| 87 | /** | |
| 88 | * Id for the current page being displayed within the view | |
| 89 | * | |
| 90 | * @return String page id | |
| 91 | */ | |
| 92 | public String getPageId(); | |
| 93 | ||
| 94 | /** | |
| 95 | * Setter for the current page id | |
| 96 | * | |
| 97 | * @param pageId | |
| 98 | */ | |
| 99 | public void setPageId(String pageId); | |
| 100 | ||
| 101 | /** | |
| 102 | * URL the form generated for the view should post to | |
| 103 | * | |
| 104 | * @return String form post URL | |
| 105 | */ | |
| 106 | public String getFormPostUrl(); | |
| 107 | ||
| 108 | /** | |
| 109 | * Setter for the form post URL | |
| 110 | * | |
| 111 | * @param formPostUrl | |
| 112 | */ | |
| 113 | public void setFormPostUrl(String formPostUrl); | |
| 114 | ||
| 115 | /** | |
| 116 | * Map of parameters that was used to configured the <code>View</code>. | |
| 117 | * Maintained on the form to rebuild the view on posts and session timeout | |
| 118 | * | |
| 119 | * @return Map<String, String> view parameters | |
| 120 | * @see org.kuali.rice.krad.uif.view.View.getViewRequestParameters() | |
| 121 | */ | |
| 122 | public Map<String, String> getViewRequestParameters(); | |
| 123 | ||
| 124 | /** | |
| 125 | * Setter for the view's request parameter map | |
| 126 | * | |
| 127 | * @param viewRequestParameters | |
| 128 | */ | |
| 129 | public void setViewRequestParameters(Map<String, String> viewRequestParameters); | |
| 130 | ||
| 131 | /** | |
| 132 | * List of fields that should be read only on the view | |
| 133 | * | |
| 134 | * <p> | |
| 135 | * If the view being rendered supports request setting of read-only fields, the readOnlyFields request parameter | |
| 136 | * can be sent to mark fields as read only that might not have been otherwise | |
| 137 | * </p> | |
| 138 | * | |
| 139 | * <p> | |
| 140 | * Note the paths specified should be the simple property names (not the full binding path). Therefore if the | |
| 141 | * property name appears multiple times in the view, all instances will be set as read only | |
| 142 | * </p> | |
| 143 | * | |
| 144 | * @return List<String> read only property names | |
| 145 | * @see View#isSupportsReadOnlyFieldsOverride() | |
| 146 | */ | |
| 147 | public List<String> getReadOnlyFieldsList(); | |
| 148 | ||
| 149 | /** | |
| 150 | * Setter for the list of read only fields | |
| 151 | * | |
| 152 | * @param readOnlyFieldsList | |
| 153 | */ | |
| 154 | public void setReadOnlyFieldsList(List<String> readOnlyFieldsList); | |
| 155 | ||
| 156 | /** | |
| 157 | * Holds instances for collection add lines. The key of the Map gives the | |
| 158 | * collection name the line instance applies to, the Map value is an | |
| 159 | * instance of the collection object class that holds the new line data | |
| 160 | * | |
| 161 | * @return Map<String, Object> new collection lines | |
| 162 | */ | |
| 163 | public Map<String, Object> getNewCollectionLines(); | |
| 164 | ||
| 165 | /** | |
| 166 | * Setter for the new collection lines Map | |
| 167 | * | |
| 168 | * @param newCollectionLines | |
| 169 | */ | |
| 170 | public void setNewCollectionLines(Map<String, Object> newCollectionLines); | |
| 171 | ||
| 172 | /** | |
| 173 | * Map of parameters sent for the invoked action | |
| 174 | * | |
| 175 | * <p> | |
| 176 | * Many times besides just setting the method to call actions need to send | |
| 177 | * additional parameters. For instance the method being called might do a | |
| 178 | * redirect, in which case the action needs to send parameters for the | |
| 179 | * redirect URL. An example of this is redirecting to a <code>Lookup</code> | |
| 180 | * view. In some cases the parameters that need to be sent conflict with | |
| 181 | * properties already on the form, and putting all the action parameters as | |
| 182 | * form properties would grow massive (in addition to adds an additional | |
| 183 | * step from the XML config). So this general map solves those issues. | |
| 184 | * </p> | |
| 185 | * | |
| 186 | * @return Map<String, String> action parameters | |
| 187 | */ | |
| 188 | public Map<String, String> getActionParameters(); | |
| 189 | ||
| 190 | /** | |
| 191 | * Setter for the action parameters map | |
| 192 | * | |
| 193 | * @param actionParameters | |
| 194 | */ | |
| 195 | public void setActionParameters(Map<String, String> actionParameters); | |
| 196 | ||
| 197 | /** | |
| 198 | * Map that is populated from the component state maintained on the client | |
| 199 | * | |
| 200 | * <p> | |
| 201 | * Used when a request is made that refreshes part of the view. The current state for components (which | |
| 202 | * have state that can be changed on the client), is populated into this map which is then used by the | |
| 203 | * <code>ViewHelperService</code> to update the components so that the state is maintained when they render. | |
| 204 | * </p> | |
| 205 | * | |
| 206 | * @return Map<String, Object> map where key is name of property or component id, and value is the property | |
| 207 | * value or another map of component key/value pairs | |
| 208 | */ | |
| 209 | public Map<String, Object> getClientStateForSyncing(); | |
| 210 | ||
| 211 | /** | |
| 212 | * Holds Set of String identifiers for lines that were selected in a collection | |
| 213 | * | |
| 214 | * <p> | |
| 215 | * When the select field is enabled for a <code>CollectionGroup</code>, the framework will be | |
| 216 | * default bind the selected identifier strings to this property. The key of the map uniquely identifies the | |
| 217 | * collection by the full binding path to the collection, and the value is a set of Strings for the checked | |
| 218 | * lines. | |
| 219 | * </p> | |
| 220 | * | |
| 221 | * @return Map<String, Set<String>> map of collections and their selected lines | |
| 222 | * @see org.kuali.rice.krad.service.DataObjectMetaDataService#getDataObjectIdentifierString(java.lang.Object) | |
| 223 | */ | |
| 224 | public Map<String, Set<String>> getSelectedCollectionLines(); | |
| 225 | ||
| 226 | /** | |
| 227 | * Setter for the map that holds selected collection lines | |
| 228 | * | |
| 229 | * @param selectedCollectionLines | |
| 230 | */ | |
| 231 | public void setSelectedCollectionLines(Map<String, Set<String>> selectedCollectionLines); | |
| 232 | ||
| 233 | /** | |
| 234 | * Indicates whether the form has had default values from the configured | |
| 235 | * <code>View</code> applied. This happens only once for each form instance | |
| 236 | * | |
| 237 | * @return boolean true if default values have been applied, false if not | |
| 238 | */ | |
| 239 | public boolean isDefaultsApplied(); | |
| 240 | ||
| 241 | /** | |
| 242 | * Setter for the defaults applied indicator | |
| 243 | * | |
| 244 | * @param defaultsApplied | |
| 245 | */ | |
| 246 | public void setDefaultsApplied(boolean defaultsApplied); | |
| 247 | ||
| 248 | } |