| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| LayoutManager |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2007 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.layout; | |
| 17 | ||
| 18 | import org.kuali.rice.krad.uif.container.Container; | |
| 19 | import org.kuali.rice.krad.uif.container.View; | |
| 20 | import org.kuali.rice.krad.uif.core.Component; | |
| 21 | import org.kuali.rice.krad.uif.core.PropertyReplacer; | |
| 22 | import org.kuali.rice.krad.uif.service.ViewHelperService; | |
| 23 | ||
| 24 | import java.io.Serializable; | |
| 25 | import java.util.List; | |
| 26 | import java.util.Map; | |
| 27 | import java.util.Set; | |
| 28 | ||
| 29 | /** | |
| 30 | * Manages the rendering of <code>Component</code> instances within a | |
| 31 | * <code>Container</code> | |
| 32 | * | |
| 33 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 34 | */ | |
| 35 | public interface LayoutManager extends Serializable { | |
| 36 | ||
| 37 | /** | |
| 38 | * The unique id (within a given tree) for the layout manager instance | |
| 39 | * | |
| 40 | * <p> | |
| 41 | * The id is used to identify a <code>LayoutManager</code> instance within | |
| 42 | * the tree and can be used by renderers | |
| 43 | * </p> | |
| 44 | * | |
| 45 | * @return String id | |
| 46 | */ | |
| 47 | public String getId(); | |
| 48 | ||
| 49 | /** | |
| 50 | * Sets the unique id (within a given tree) for the layout manager | |
| 51 | * | |
| 52 | * @param id | |
| 53 | * - string to set as the layout manager id | |
| 54 | */ | |
| 55 | public void setId(String id); | |
| 56 | ||
| 57 | /** | |
| 58 | * The path to the JSP file that should be called to invoke the layout | |
| 59 | * manager | |
| 60 | * | |
| 61 | * <p> | |
| 62 | * The path should be relative to the web root. All layout manager templates | |
| 63 | * receive the list of items of be placed, the configured layout manager, | |
| 64 | * and the container to which the layout manager applies | |
| 65 | * </p> | |
| 66 | * | |
| 67 | * <p> | |
| 68 | * e.g. '/krad/WEB-INF/jsp/tiles/boxLayout.jsp' | |
| 69 | * </p> | |
| 70 | * | |
| 71 | * @return String representing the template path | |
| 72 | */ | |
| 73 | public String getTemplate(); | |
| 74 | ||
| 75 | /** | |
| 76 | * Setter for the layout managers template | |
| 77 | * | |
| 78 | * @param template | |
| 79 | */ | |
| 80 | public void setTemplate(String template); | |
| 81 | ||
| 82 | /** | |
| 83 | * Should be called to initialize the layout manager | |
| 84 | * <p> | |
| 85 | * This is where layout managers can set defaults and setup other necessary | |
| 86 | * state. The initialize method should only be called once per layout | |
| 87 | * manager lifecycle and is invoked within the initialize phase of the view | |
| 88 | * lifecylce. | |
| 89 | * </p> | |
| 90 | * | |
| 91 | * @param view | |
| 92 | * - View instance the layout manager is a part of | |
| 93 | * @param container | |
| 94 | * - Container the layout manager applies to | |
| 95 | * @see ViewHelperService#performInitialization | |
| 96 | */ | |
| 97 | public void performInitialization(View view, Container container); | |
| 98 | ||
| 99 | /** | |
| 100 | * Called after the initialize phase to perform conditional logic based on | |
| 101 | * the model data | |
| 102 | * | |
| 103 | * @param view | |
| 104 | * - view instance to which the layout manager belongs | |
| 105 | * @param model | |
| 106 | * - Top level object containing the data (could be the form or a | |
| 107 | * top level business object, dto) | |
| 108 | * @param container | |
| 109 | * - Container the layout manager applies to | |
| 110 | */ | |
| 111 | public void performApplyModel(View view, Object model, Container container); | |
| 112 | ||
| 113 | /** | |
| 114 | * The last phase before the view is rendered. Here final preparations can | |
| 115 | * be made based on the updated view state | |
| 116 | * | |
| 117 | * | |
| 118 | * @param view | |
| 119 | * - view instance that should be finalized for rendering | |
| 120 | * @param model | |
| 121 | * - top level object containing the data | |
| 122 | * @param container | |
| 123 | * - Container the layout manager applies to | |
| 124 | */ | |
| 125 | public void performFinalize(View view, Object model, Container container); | |
| 126 | ||
| 127 | /** | |
| 128 | * Determines what <code>Container</code> classes are supported by the | |
| 129 | * <code>LayoutManager</code> | |
| 130 | * | |
| 131 | * @return Class<? extends Container> container class supported | |
| 132 | */ | |
| 133 | public Class<? extends Container> getSupportedContainer(); | |
| 134 | ||
| 135 | /** | |
| 136 | * List of components that are contained within the layout manager | |
| 137 | * <p> | |
| 138 | * Used by <code>ViewHelperService</code> for the various lifecycle | |
| 139 | * callbacks | |
| 140 | * | |
| 141 | * @return List<Component> child components | |
| 142 | */ | |
| 143 | public List<Component> getNestedComponents(); | |
| 144 | ||
| 145 | /** | |
| 146 | * Used by the copy process to determine for which properties only the value | |
| 147 | * reference should be copied (not a new copy instance). Subclasses can | |
| 148 | * define the properties for which only the reference should be copied | |
| 149 | * | |
| 150 | * @return Set<String> property names for which only the value reference | |
| 151 | * should be copied | |
| 152 | * @see org.kuali.rice.krad.uif.util.ComponentUtils.copy(T) | |
| 153 | */ | |
| 154 | public Set<String> getPropertiesForReferenceCopy(); | |
| 155 | ||
| 156 | /** | |
| 157 | * CSS style string to be applied to the area (div) the layout manager | |
| 158 | * generates for the items | |
| 159 | * | |
| 160 | * <p> | |
| 161 | * Note the styleClass/style configured on the <code>Container</code> | |
| 162 | * applies to all the container content (header, body, footer), while the | |
| 163 | * styleClass/style configured on the <code>LayoutManager</code> only | |
| 164 | * applies to the div surrounding the items placed by the manager (the | |
| 165 | * container's body) | |
| 166 | * </p> | |
| 167 | * | |
| 168 | * <p> | |
| 169 | * Any style override or additions can be specified with this attribute. | |
| 170 | * This is used by the renderer to set the style attribute on the | |
| 171 | * corresponding element. | |
| 172 | * </p> | |
| 173 | * | |
| 174 | * <p> | |
| 175 | * e.g. 'color: #000000;text-decoration: underline;' | |
| 176 | * </p> | |
| 177 | * | |
| 178 | * @return String css style string | |
| 179 | */ | |
| 180 | public String getStyle(); | |
| 181 | ||
| 182 | /** | |
| 183 | * Setter for the layout manager div style | |
| 184 | * | |
| 185 | * @param style | |
| 186 | */ | |
| 187 | public void setStyle(String style); | |
| 188 | ||
| 189 | /** | |
| 190 | * CSS style class(s) to be applied to the area (div) the layout manager | |
| 191 | * generates for the items | |
| 192 | * | |
| 193 | * <p> | |
| 194 | * Note the styleClass/style configured on the <code>Container</code> | |
| 195 | * applies to all the container content (header, body, footer), while the | |
| 196 | * styleClass/style configured on the <code>LayoutManager</code> only | |
| 197 | * applies to the div surrounding the items placed by the manager (the | |
| 198 | * container's body) | |
| 199 | * </p> | |
| 200 | * | |
| 201 | * <p> | |
| 202 | * Declares additional style classes for the div. Multiple classes are | |
| 203 | * specified with a space delimiter. This is used by the renderer to set the | |
| 204 | * class attribute on the corresponding element. The class(s) declared must | |
| 205 | * be available in the common style sheets or the style sheets specified for | |
| 206 | * the view | |
| 207 | * </p> | |
| 208 | * | |
| 209 | * <p> | |
| 210 | * e.g. 'header left' | |
| 211 | * </p> | |
| 212 | * | |
| 213 | * @return List<String> css style classes to apply | |
| 214 | */ | |
| 215 | public List<String> getStyleClasses(); | |
| 216 | ||
| 217 | /** | |
| 218 | * Setter for the layout manager div style class | |
| 219 | * | |
| 220 | * @param styleClass | |
| 221 | */ | |
| 222 | public void setStyleClasses(List<String> styleClasses); | |
| 223 | ||
| 224 | /** | |
| 225 | * This method adds a single style class to the list of css style classes on this component | |
| 226 | * | |
| 227 | * @param style | |
| 228 | */ | |
| 229 | public void addStyleClass(String styleClass); | |
| 230 | ||
| 231 | /** | |
| 232 | * Context map for the layout manager | |
| 233 | * | |
| 234 | * @return Map<String, Object> context | |
| 235 | * @see org.kuali.rice.krad.uif.Component.getContext() | |
| 236 | */ | |
| 237 | public Map<String, Object> getContext(); | |
| 238 | ||
| 239 | /** | |
| 240 | * Setter for the context Map | |
| 241 | * | |
| 242 | * @param context | |
| 243 | * @see org.kuali.rice.krad.uif.Component.setElContext(Map<String, Object>) | |
| 244 | */ | |
| 245 | public void setContext(Map<String, Object> context); | |
| 246 | ||
| 247 | /** | |
| 248 | * Places the given object into the context Map for the layout manager | |
| 249 | * with the given name | |
| 250 | * | |
| 251 | * @see org.kuali.rice.krad.uif.Component.pushObjectToContext(String, | |
| 252 | * Object) | |
| 253 | */ | |
| 254 | public void pushObjectToContext(String objectName, Object object); | |
| 255 | ||
| 256 | /** | |
| 257 | * List of <code>PropertyReplacer</code> instances that will be | |
| 258 | * evaluated during the view lifecycle to conditional set properties on the | |
| 259 | * <code>LayoutManager</code> based on expression evaluations | |
| 260 | * | |
| 261 | * @return List<PropertyReplacer> replacers to evaluate | |
| 262 | */ | |
| 263 | public List<PropertyReplacer> getPropertyReplacers(); | |
| 264 | ||
| 265 | /** | |
| 266 | * Setter for the layout managers property substitutions | |
| 267 | * | |
| 268 | * @param propertyReplacers | |
| 269 | */ | |
| 270 | public void setPropertyReplacers(List<PropertyReplacer> propertyReplacers); | |
| 271 | ||
| 272 | } |