| 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.kns.uif.modifier; | |
| 17 | ||
| 18 | import java.io.Serializable; | |
| 19 | ||
| 20 | import org.kuali.rice.kns.uif.core.Ordered; | |
| 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.kns.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 | 0 | public ComparableInfo() { |
| 51 | 0 | readOnly = false; |
| 52 | 0 | } |
| 53 | ||
| 54 | /** | |
| 55 | * Returns the path (from the form) for the object to compare to | |
| 56 | * | |
| 57 | * <p> | |
| 58 | * When a comparison view is rendered, a group will be rendered for each | |
| 59 | * comparison object using the fields defined on the view. This gives the | |
| 60 | * path to one of the comparison objects | |
| 61 | * </p> | |
| 62 | * | |
| 63 | * <p> | |
| 64 | * e.g. For maintenance documents the compare object paths would be | |
| 65 | * document.newMaintainableObject.businessObject and | |
| 66 | * document.oldMaintainableObject.businessObject | |
| 67 | * </p> | |
| 68 | * | |
| 69 | * @return String path to the compare object | |
| 70 | */ | |
| 71 | public String getBindingObjectPath() { | |
| 72 | 0 | return this.bindingObjectPath; |
| 73 | } | |
| 74 | ||
| 75 | /** | |
| 76 | * Setter for the path to the compare object | |
| 77 | * | |
| 78 | * @param bindingObjectPath | |
| 79 | */ | |
| 80 | public void setBindingObjectPath(String bindingObjectPath) { | |
| 81 | 0 | this.bindingObjectPath = bindingObjectPath; |
| 82 | 0 | } |
| 83 | ||
| 84 | /** | |
| 85 | * Text that should display on the header for the compare group | |
| 86 | * | |
| 87 | * <p> | |
| 88 | * In the comparison view each compare group can be labeled, this gives the | |
| 89 | * text that should be used for that label. For example in the maintenance | |
| 90 | * view the compare record is labeled 'Old' to indicate it is the old | |
| 91 | * version of the record | |
| 92 | * </p> | |
| 93 | * | |
| 94 | * @return String header text | |
| 95 | */ | |
| 96 | public String getHeaderText() { | |
| 97 | 0 | return this.headerText; |
| 98 | } | |
| 99 | ||
| 100 | /** | |
| 101 | * Setter for the compare group header text | |
| 102 | * | |
| 103 | * @param headerText | |
| 104 | */ | |
| 105 | public void setHeaderText(String headerText) { | |
| 106 | 0 | this.headerText = headerText; |
| 107 | 0 | } |
| 108 | ||
| 109 | /** | |
| 110 | * Indicates whether the compare group should be read-only | |
| 111 | * | |
| 112 | * @return boolean true if the group should be read-only, false if edits are | |
| 113 | * allowed | |
| 114 | */ | |
| 115 | public boolean isReadOnly() { | |
| 116 | 0 | return this.readOnly; |
| 117 | } | |
| 118 | ||
| 119 | /** | |
| 120 | * Setter for the read-only indicator | |
| 121 | * | |
| 122 | * @param readOnly | |
| 123 | */ | |
| 124 | public void setReadOnly(boolean readOnly) { | |
| 125 | 0 | this.readOnly = readOnly; |
| 126 | 0 | } |
| 127 | ||
| 128 | /** | |
| 129 | * Sets the order value that will be used to determine where the compare | |
| 130 | * group should be placed in relation to the other compare groups | |
| 131 | * | |
| 132 | * <p> | |
| 133 | * For example if the compare groups are being rendered from left to right | |
| 134 | * in columns, a lower order value would be placed to the left of a compare | |
| 135 | * group with a higher order value | |
| 136 | * </p> | |
| 137 | * | |
| 138 | * @see org.springframework.core.Ordered#getOrder() | |
| 139 | */ | |
| 140 | public int getOrder() { | |
| 141 | 0 | return this.order; |
| 142 | } | |
| 143 | ||
| 144 | /** | |
| 145 | * Setter for the compare object order | |
| 146 | * | |
| 147 | * @param order | |
| 148 | */ | |
| 149 | public void setOrder(int order) { | |
| 150 | 0 | this.order = order; |
| 151 | 0 | } |
| 152 | ||
| 153 | /** | |
| 154 | * Specifies an id suffix to use for the generated comparison fields | |
| 155 | * | |
| 156 | * <p> | |
| 157 | * For the given string, all components created for the comparison group | |
| 158 | * will contain the string on their id. This can be helpful for scripting. | |
| 159 | * If not given, the items will receive a default id suffix | |
| 160 | * </p> | |
| 161 | * | |
| 162 | * @return String id suffix for comparison group | |
| 163 | */ | |
| 164 | public String getIdSuffix() { | |
| 165 | 0 | return this.idSuffix; |
| 166 | } | |
| 167 | ||
| 168 | /** | |
| 169 | * Setter for the id prefix to use for the generated comparison components | |
| 170 | * | |
| 171 | * @param idSuffix | |
| 172 | */ | |
| 173 | public void setIdSuffix(String idSuffix) { | |
| 174 | 0 | this.idSuffix = idSuffix; |
| 175 | 0 | } |
| 176 | ||
| 177 | } |