| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ComparableInfo |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2011 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 1.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/ecl1.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.modifier; | |
| 17 | ||
| 18 | import org.kuali.rice.krad.uif.core.Ordered; | |
| 19 | ||
| 20 | import java.io.Serializable; | |
| 21 | ||
| 22 | ||
| 23 | /** | |
| 24 | * Provides configuration for comparing an object with another object | |
| 25 | * | |
| 26 | * <p> | |
| 27 | * Used with a comparison view (such as in maintenance documents edit mode) | |
| 28 | * where two objects with the same properties are compared. This class | |
| 29 | * configures the object paths for the objects that will be compared, and has | |
| 30 | * additional configuration for the generated comparison group | |
| 31 | * </p> | |
| 32 | * | |
| 33 | * <p> | |
| 34 | * All comparison objects must have the same fields and collection rows | |
| 35 | * </p> | |
| 36 | * | |
| 37 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 38 | * @see org.kuali.rice.krad.uif.modifier.CompareFieldCreateModifier | |
| 39 | */ | |
| 40 | public class ComparableInfo implements Serializable, Ordered { | |
| 41 | private static final long serialVersionUID = -5926058412202550266L; | |
| 42 | ||
| 43 | private String bindingObjectPath; | |
| 44 | private String headerText; | |
| 45 | private boolean readOnly; | |
| 46 | ||
| 47 | private int order; | |
| 48 | private String idSuffix; | |
| 49 | ||
| 50 | private boolean compareToForValueChange; | |
| 51 | private boolean highlightValueChange; | |
| 52 | ||
| 53 | 0 | public ComparableInfo() { |
| 54 | 0 | readOnly = false; |
| 55 | 0 | compareToForValueChange = false; |
| 56 | 0 | highlightValueChange = true; |
| 57 | 0 | } |
| 58 | ||
| 59 | /** | |
| 60 | * Returns the path (from the form) for the object to compare to | |
| 61 | * | |
| 62 | * <p> | |
| 63 | * When a comparison view is rendered, a group will be rendered for each | |
| 64 | * comparison object using the fields defined on the view. This gives the | |
| 65 | * path to one of the comparison objects | |
| 66 | * </p> | |
| 67 | * | |
| 68 | * <p> | |
| 69 | * e.g. For maintenance documents the compare object paths would be | |
| 70 | * document.newMaintainableObject.businessObject and | |
| 71 | * document.oldMaintainableObject.businessObject | |
| 72 | * </p> | |
| 73 | * | |
| 74 | * @return String path to the compare object | |
| 75 | */ | |
| 76 | public String getBindingObjectPath() { | |
| 77 | 0 | return this.bindingObjectPath; |
| 78 | } | |
| 79 | ||
| 80 | /** | |
| 81 | * Setter for the path to the compare object | |
| 82 | * | |
| 83 | * @param bindingObjectPath | |
| 84 | */ | |
| 85 | public void setBindingObjectPath(String bindingObjectPath) { | |
| 86 | 0 | this.bindingObjectPath = bindingObjectPath; |
| 87 | 0 | } |
| 88 | ||
| 89 | /** | |
| 90 | * Text that should display on the header for the compare group | |
| 91 | * | |
| 92 | * <p> | |
| 93 | * In the comparison view each compare group can be labeled, this gives the | |
| 94 | * text that should be used for that label. For example in the maintenance | |
| 95 | * view the compare record is labeled 'Old' to indicate it is the old | |
| 96 | * version of the record | |
| 97 | * </p> | |
| 98 | * | |
| 99 | * @return String header text | |
| 100 | */ | |
| 101 | public String getHeaderText() { | |
| 102 | 0 | return this.headerText; |
| 103 | } | |
| 104 | ||
| 105 | /** | |
| 106 | * Setter for the compare group header text | |
| 107 | * | |
| 108 | * @param headerText | |
| 109 | */ | |
| 110 | public void setHeaderText(String headerText) { | |
| 111 | 0 | this.headerText = headerText; |
| 112 | 0 | } |
| 113 | ||
| 114 | /** | |
| 115 | * Indicates whether the compare group should be read-only | |
| 116 | * | |
| 117 | * @return boolean true if the group should be read-only, false if edits are | |
| 118 | * allowed | |
| 119 | */ | |
| 120 | public boolean isReadOnly() { | |
| 121 | 0 | return this.readOnly; |
| 122 | } | |
| 123 | ||
| 124 | /** | |
| 125 | * Setter for the read-only indicator | |
| 126 | * | |
| 127 | * @param readOnly | |
| 128 | */ | |
| 129 | public void setReadOnly(boolean readOnly) { | |
| 130 | 0 | this.readOnly = readOnly; |
| 131 | 0 | } |
| 132 | ||
| 133 | /** | |
| 134 | * Sets the order value that will be used to determine where the compare | |
| 135 | * group should be placed in relation to the other compare groups | |
| 136 | * | |
| 137 | * <p> | |
| 138 | * For example if the compare groups are being rendered from left to right | |
| 139 | * in columns, a lower order value would be placed to the left of a compare | |
| 140 | * group with a higher order value | |
| 141 | * </p> | |
| 142 | * | |
| 143 | * @see org.springframework.core.Ordered#getOrder() | |
| 144 | */ | |
| 145 | public int getOrder() { | |
| 146 | 0 | return this.order; |
| 147 | } | |
| 148 | ||
| 149 | /** | |
| 150 | * Setter for the compare object order | |
| 151 | * | |
| 152 | * @param order | |
| 153 | */ | |
| 154 | public void setOrder(int order) { | |
| 155 | 0 | this.order = order; |
| 156 | 0 | } |
| 157 | ||
| 158 | /** | |
| 159 | * Specifies an id suffix to use for the generated comparison fields | |
| 160 | * | |
| 161 | * <p> | |
| 162 | * For the given string, all components created for the comparison group | |
| 163 | * will contain the string on their id. This can be helpful for scripting. | |
| 164 | * If not given, the items will receive a default id suffix | |
| 165 | * </p> | |
| 166 | * | |
| 167 | * @return String id suffix for comparison group | |
| 168 | */ | |
| 169 | public String getIdSuffix() { | |
| 170 | 0 | return this.idSuffix; |
| 171 | } | |
| 172 | ||
| 173 | /** | |
| 174 | * Setter for the id prefix to use for the generated comparison components | |
| 175 | * | |
| 176 | * @param idSuffix | |
| 177 | */ | |
| 178 | public void setIdSuffix(String idSuffix) { | |
| 179 | 0 | this.idSuffix = idSuffix; |
| 180 | 0 | } |
| 181 | ||
| 182 | /** | |
| 183 | * Indicates whether this comparable group's field values should be compared | |
| 184 | * to when highlighting changes of values between comparables (versions) | |
| 185 | * | |
| 186 | * @return boolean true if this comparable group should be used for | |
| 187 | * comparison, false if not | |
| 188 | * @see #isHighlightValueChange | |
| 189 | */ | |
| 190 | public boolean isCompareToForValueChange() { | |
| 191 | 0 | return this.compareToForValueChange; |
| 192 | } | |
| 193 | ||
| 194 | /** | |
| 195 | * Setter for the use comparable group values for comparison indicator | |
| 196 | * | |
| 197 | * @param compareToForValueChange | |
| 198 | */ | |
| 199 | public void setCompareToForValueChange(boolean compareToForValueChange) { | |
| 200 | 0 | this.compareToForValueChange = compareToForValueChange; |
| 201 | 0 | } |
| 202 | ||
| 203 | /** | |
| 204 | * Indicates whether the fields in this comparable group should be | |
| 205 | * highlighted if their values defer from the comparable group marked for | |
| 206 | * comparison | |
| 207 | * | |
| 208 | * @return boolean true if the comparable fields should be highlighted, | |
| 209 | * false if they should not be highlighted (no comparison will be | |
| 210 | * performed) | |
| 211 | * @see #isCompareToForValueChange | |
| 212 | */ | |
| 213 | public boolean isHighlightValueChange() { | |
| 214 | 0 | return this.highlightValueChange; |
| 215 | } | |
| 216 | ||
| 217 | /** | |
| 218 | * Setter for the highlight comparable field value changed indicator | |
| 219 | * | |
| 220 | * @param highlightValueChange | |
| 221 | */ | |
| 222 | public void setHighlightValueChange(boolean highlightValueChange) { | |
| 223 | 0 | this.highlightValueChange = highlightValueChange; |
| 224 | 0 | } |
| 225 | ||
| 226 | } |