| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ComponentBase |
|
| 1.2708333333333333;1.271 |
| 1 | /* | |
| 2 | * Copyright 2007 The Kuali Foundation Licensed under the Educational Community | |
| 3 | * License, Version 1.0 (the "License"); you may not use this file except in | |
| 4 | * compliance with the License. You may obtain a copy of the License at | |
| 5 | * http://www.opensource.org/licenses/ecl1.php Unless required by applicable law | |
| 6 | * or agreed to in writing, software distributed under the License is | |
| 7 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| 8 | * KIND, either express or implied. See the License for the specific language | |
| 9 | * governing permissions and limitations under the License. | |
| 10 | */ | |
| 11 | package org.kuali.rice.kns.uif.core; | |
| 12 | ||
| 13 | import java.util.ArrayList; | |
| 14 | import java.util.HashMap; | |
| 15 | import java.util.HashSet; | |
| 16 | import java.util.List; | |
| 17 | import java.util.ListIterator; | |
| 18 | import java.util.Map; | |
| 19 | import java.util.Set; | |
| 20 | ||
| 21 | import org.apache.commons.lang.StringUtils; | |
| 22 | import org.kuali.rice.kns.uif.CssConstants; | |
| 23 | import org.kuali.rice.kns.uif.UifConstants.ViewStatus; | |
| 24 | import org.kuali.rice.kns.uif.UifPropertyPaths; | |
| 25 | import org.kuali.rice.kns.uif.container.View; | |
| 26 | import org.kuali.rice.kns.uif.control.ControlBase; | |
| 27 | import org.kuali.rice.kns.uif.field.AttributeField; | |
| 28 | import org.kuali.rice.kns.uif.modifier.ComponentModifier; | |
| 29 | import org.kuali.rice.kns.uif.util.ComponentUtils; | |
| 30 | import org.kuali.rice.kns.uif.util.ViewModelUtils; | |
| 31 | ||
| 32 | /** | |
| 33 | * Base implementation of <code>Component</code> which other component | |
| 34 | * implementations should extend | |
| 35 | * | |
| 36 | * <p> | |
| 37 | * Provides base component properties such as id and template. Also provides | |
| 38 | * default implementation for the <code>ScriptEventSupport</code> and | |
| 39 | * <code>Ordered</code> interfaces. By default no script events except the | |
| 40 | * onDocumentReady are supported. | |
| 41 | * </p> | |
| 42 | * | |
| 43 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 44 | */ | |
| 45 | public abstract class ComponentBase implements Component { | |
| 46 | private static final long serialVersionUID = -4449335748129894350L; | |
| 47 | ||
| 48 | private String id; | |
| 49 | private String template; | |
| 50 | private String title; | |
| 51 | ||
| 52 | private boolean render; | |
| 53 | private boolean refresh; | |
| 54 | private String conditionalRender; | |
| 55 | ||
| 56 | private String progressiveRender; | |
| 57 | private boolean progressiveRenderViaAJAX; | |
| 58 | private boolean progressiveRenderAndRefresh; | |
| 59 | private List<String> progressiveDisclosureControlNames; | |
| 60 | private String progressiveDisclosureConditionJs; | |
| 61 | ||
| 62 | private String conditionalRefresh; | |
| 63 | private String conditionalRefreshConditionJs; | |
| 64 | private List<String> conditionalRefreshControlNames; | |
| 65 | ||
| 66 | private String refreshWhenChanged; | |
| 67 | private List<String> refreshWhenChangedControlNames; | |
| 68 | ||
| 69 | private boolean hidden; | |
| 70 | ||
| 71 | private boolean readOnly; | |
| 72 | private String conditionalReadOnly; | |
| 73 | ||
| 74 | private Boolean required; | |
| 75 | private String conditionalRequired; | |
| 76 | ||
| 77 | private String align; | |
| 78 | private String valign; | |
| 79 | private String width; | |
| 80 | ||
| 81 | private int colSpan; | |
| 82 | private String conditionalColSpan; | |
| 83 | ||
| 84 | private int rowSpan; | |
| 85 | private String conditionalRowSpan; | |
| 86 | ||
| 87 | private String style; | |
| 88 | private List<String> styleClasses; | |
| 89 | ||
| 90 | private int order; | |
| 91 | ||
| 92 | private boolean skipInTabOrder; | |
| 93 | ||
| 94 | private String finalizeMethodToCall; | |
| 95 | private MethodInvokerConfig finalizeMethodInvoker; | |
| 96 | private boolean selfRendered; | |
| 97 | private String renderOutput; | |
| 98 | ||
| 99 | private String onLoadScript; | |
| 100 | private String onUnloadScript; | |
| 101 | private String onCloseScript; | |
| 102 | private String onBlurScript; | |
| 103 | private String onChangeScript; | |
| 104 | private String onClickScript; | |
| 105 | private String onDblClickScript; | |
| 106 | private String onFocusScript; | |
| 107 | private String onSubmitScript; | |
| 108 | private String onKeyPressScript; | |
| 109 | private String onKeyUpScript; | |
| 110 | private String onKeyDownScript; | |
| 111 | private String onMouseOverScript; | |
| 112 | private String onMouseOutScript; | |
| 113 | private String onMouseUpScript; | |
| 114 | private String onMouseDownScript; | |
| 115 | private String onMouseMoveScript; | |
| 116 | private String onDocumentReadyScript; | |
| 117 | ||
| 118 | private List<ComponentModifier> componentModifiers; | |
| 119 | ||
| 120 | private Map<String, String> componentOptions; | |
| 121 | ||
| 122 | @ReferenceCopy(newCollectionInstance = true) | |
| 123 | private transient Map<String, Object> context; | |
| 124 | ||
| 125 | private Map<String, String> propertyExpressions; | |
| 126 | private List<PropertyReplacer> propertyReplacers; | |
| 127 | ||
| 128 | 0 | public ComponentBase() { |
| 129 | 0 | order = 0; |
| 130 | 0 | colSpan = 1; |
| 131 | 0 | rowSpan = 1; |
| 132 | ||
| 133 | 0 | render = true; |
| 134 | 0 | selfRendered = false; |
| 135 | 0 | progressiveRenderViaAJAX = false; |
| 136 | 0 | progressiveRenderAndRefresh = false; |
| 137 | ||
| 138 | 0 | styleClasses = new ArrayList<String>(); |
| 139 | 0 | componentModifiers = new ArrayList<ComponentModifier>(); |
| 140 | 0 | componentOptions = new HashMap<String, String>(); |
| 141 | 0 | context = new HashMap<String, Object>(); |
| 142 | 0 | propertyExpressions = new HashMap<String, String>(); |
| 143 | 0 | propertyReplacers = new ArrayList<PropertyReplacer>(); |
| 144 | 0 | } |
| 145 | ||
| 146 | /** | |
| 147 | * The following initialization is performed: progressiveRender and | |
| 148 | * conditionalRefresh variables are processed if set. | |
| 149 | * <ul> | |
| 150 | * </ul> | |
| 151 | * | |
| 152 | * @see org.kuali.rice.kns.uif.core.ComponentBase#performInitialization(org.kuali.rice.kns.uif.container.View) | |
| 153 | */ | |
| 154 | public void performInitialization(View view) { | |
| 155 | 0 | if (StringUtils.isNotEmpty(progressiveRender)) { |
| 156 | // progressive anded with conditional render, will not render at | |
| 157 | // least one of the two are false. | |
| 158 | 0 | if (StringUtils.isNotEmpty(conditionalRender)) { |
| 159 | 0 | conditionalRender = "(" + conditionalRender + ") and (" + progressiveRender + ")"; |
| 160 | } else { | |
| 161 | 0 | conditionalRender = progressiveRender; |
| 162 | } | |
| 163 | 0 | progressiveDisclosureControlNames = new ArrayList<String>(); |
| 164 | 0 | progressiveDisclosureConditionJs = ComponentUtils.parseExpression(progressiveRender, |
| 165 | progressiveDisclosureControlNames); | |
| 166 | } | |
| 167 | ||
| 168 | 0 | if (StringUtils.isNotEmpty(conditionalRefresh)) { |
| 169 | 0 | conditionalRefreshControlNames = new ArrayList<String>(); |
| 170 | 0 | conditionalRefreshConditionJs = ComponentUtils.parseExpression(conditionalRefresh, |
| 171 | conditionalRefreshControlNames); | |
| 172 | } | |
| 173 | ||
| 174 | 0 | if (StringUtils.isNotEmpty(refreshWhenChanged)) { |
| 175 | 0 | refreshWhenChangedControlNames = new ArrayList<String>(); |
| 176 | 0 | String[] names = StringUtils.split(refreshWhenChanged, ","); |
| 177 | 0 | for (String name : names) { |
| 178 | 0 | refreshWhenChangedControlNames.add(name.trim()); |
| 179 | } | |
| 180 | } | |
| 181 | 0 | } |
| 182 | ||
| 183 | /** | |
| 184 | * The following updates are done here: | |
| 185 | * <ul> | |
| 186 | * <li></li> | |
| 187 | * </ul> | |
| 188 | * | |
| 189 | * @see org.kuali.rice.kns.uif.core.Component#performApplyModel(org.kuali.rice.kns.uif.container.View, | |
| 190 | * java.lang.Object) | |
| 191 | */ | |
| 192 | public void performApplyModel(View view, Object model) { | |
| 193 | ||
| 194 | 0 | } |
| 195 | ||
| 196 | /** | |
| 197 | * The following finalization is done here: | |
| 198 | * <ul> | |
| 199 | * <li>If any of the style properties were given, sets the style string on | |
| 200 | * the style property</li> | |
| 201 | * <li>Setup the decorator chain (if component has decorators) for rendering | |
| 202 | * </li> | |
| 203 | * <li>Set the skipInTabOrder flag for nested components</li> | |
| 204 | * </ul> | |
| 205 | * | |
| 206 | * @see org.kuali.rice.kns.uif.core.Component#performFinalize(org.kuali.rice.kns.uif.container.View, | |
| 207 | * java.lang.Object, org.kuali.rice.kns.uif.core.Component) | |
| 208 | */ | |
| 209 | public void performFinalize(View view, Object model, Component parent) { | |
| 210 | 0 | if (!ViewStatus.FINAL.equals(view.getViewStatus())) { |
| 211 | // add the align, valign, and width settings to style | |
| 212 | 0 | if (StringUtils.isNotBlank(getAlign()) && !StringUtils.contains(getStyle(), CssConstants.TEXT_ALIGN)) { |
| 213 | 0 | appendToStyle(CssConstants.TEXT_ALIGN + getAlign() + ";"); |
| 214 | } | |
| 215 | ||
| 216 | 0 | if (StringUtils.isNotBlank(getValign()) && !StringUtils.contains(getStyle(), CssConstants.VERTICAL_ALIGN)) { |
| 217 | 0 | appendToStyle(CssConstants.VERTICAL_ALIGN + getValign() + ";"); |
| 218 | } | |
| 219 | ||
| 220 | 0 | if (StringUtils.isNotBlank(getWidth()) && !StringUtils.contains(getStyle(), CssConstants.WIDTH)) { |
| 221 | 0 | appendToStyle(CssConstants.WIDTH + getWidth() + ";"); |
| 222 | } | |
| 223 | } | |
| 224 | // Set the skipInTabOrder flag on all nested components | |
| 225 | // Set the tabIndex on controls to -1 in order to be skipped on tabbing | |
| 226 | 0 | for (Component component : getNestedComponents()) { |
| 227 | 0 | if (component != null && component instanceof ComponentBase && skipInTabOrder) { |
| 228 | 0 | ((ComponentBase) component).setSkipInTabOrder(skipInTabOrder); |
| 229 | 0 | if (component instanceof ControlBase) { |
| 230 | 0 | ((ControlBase) component).setTabIndex(-1); |
| 231 | } | |
| 232 | } | |
| 233 | } | |
| 234 | // replace the #line? collections place holder with the correct binding | |
| 235 | // path | |
| 236 | // TODO : handle all components not only AttributeField | |
| 237 | 0 | if (StringUtils.isNotEmpty(progressiveRender)) { |
| 238 | 0 | if (progressiveRender.indexOf("#line?") != -1 && this instanceof AttributeField) { |
| 239 | 0 | String path = ViewModelUtils.getParentObjectPath((AttributeField) this); |
| 240 | 0 | progressiveDisclosureConditionJs = progressiveDisclosureConditionJs.replace("#line?", path); |
| 241 | 0 | ListIterator<String> listIterator = progressiveDisclosureControlNames.listIterator(); |
| 242 | 0 | while (listIterator.hasNext()) { |
| 243 | 0 | listIterator.set(listIterator.next().replace("#line?", path)); |
| 244 | } | |
| 245 | } | |
| 246 | } | |
| 247 | 0 | } |
| 248 | ||
| 249 | /** | |
| 250 | * @see org.kuali.rice.kns.uif.core.Component#getNestedComponents() | |
| 251 | */ | |
| 252 | @Override | |
| 253 | public List<Component> getNestedComponents() { | |
| 254 | 0 | List<Component> components = new ArrayList<Component>(); |
| 255 | ||
| 256 | 0 | return components; |
| 257 | } | |
| 258 | ||
| 259 | /** | |
| 260 | * Set of property names for the component base for which on the property | |
| 261 | * value reference should be copied. Subclasses can override this but should | |
| 262 | * include a call to super | |
| 263 | * | |
| 264 | * @see org.kuali.rice.kns.uif.core.Component#getPropertiesForReferenceCopy() | |
| 265 | */ | |
| 266 | public Set<String> getPropertiesForReferenceCopy() { | |
| 267 | 0 | Set<String> refCopyProperties = new HashSet<String>(); |
| 268 | ||
| 269 | 0 | refCopyProperties.add(UifPropertyPaths.COMPONENT_MODIFIERS); |
| 270 | 0 | refCopyProperties.add(UifPropertyPaths.CONTEXT); |
| 271 | ||
| 272 | 0 | return refCopyProperties; |
| 273 | } | |
| 274 | ||
| 275 | /** | |
| 276 | * @see org.kuali.rice.kns.uif.core.Component#getId() | |
| 277 | */ | |
| 278 | public String getId() { | |
| 279 | 0 | return this.id; |
| 280 | } | |
| 281 | ||
| 282 | /** | |
| 283 | * @see org.kuali.rice.kns.uif.core.Component#setId(java.lang.String) | |
| 284 | */ | |
| 285 | public void setId(String id) { | |
| 286 | 0 | this.id = id; |
| 287 | 0 | } |
| 288 | ||
| 289 | /** | |
| 290 | * @see org.kuali.rice.kns.uif.core.Component#getTemplate() | |
| 291 | */ | |
| 292 | public String getTemplate() { | |
| 293 | 0 | return this.template; |
| 294 | } | |
| 295 | ||
| 296 | /** | |
| 297 | * @see org.kuali.rice.kns.uif.core.Component#setTemplate(java.lang.String) | |
| 298 | */ | |
| 299 | public void setTemplate(String template) { | |
| 300 | 0 | this.template = template; |
| 301 | 0 | } |
| 302 | ||
| 303 | /** | |
| 304 | * @see org.kuali.rice.kns.uif.core.Component#getTitle() | |
| 305 | */ | |
| 306 | public String getTitle() { | |
| 307 | 0 | return this.title; |
| 308 | } | |
| 309 | ||
| 310 | /** | |
| 311 | * @see org.kuali.rice.kns.uif.core.Component#setTitle(java.lang.String) | |
| 312 | */ | |
| 313 | public void setTitle(String title) { | |
| 314 | 0 | this.title = title; |
| 315 | 0 | } |
| 316 | ||
| 317 | /** | |
| 318 | * @see org.kuali.rice.kns.uif.core.Component#isHidden() | |
| 319 | */ | |
| 320 | public boolean isHidden() { | |
| 321 | 0 | return this.hidden; |
| 322 | } | |
| 323 | ||
| 324 | /** | |
| 325 | * @see org.kuali.rice.kns.uif.core.Component#setHidden(boolean) | |
| 326 | */ | |
| 327 | public void setHidden(boolean hidden) { | |
| 328 | 0 | this.hidden = hidden; |
| 329 | 0 | } |
| 330 | ||
| 331 | /** | |
| 332 | * @see org.kuali.rice.kns.uif.core.Component#isReadOnly() | |
| 333 | */ | |
| 334 | public boolean isReadOnly() { | |
| 335 | 0 | return this.readOnly; |
| 336 | } | |
| 337 | ||
| 338 | /** | |
| 339 | * @see org.kuali.rice.kns.uif.core.Component#setReadOnly(boolean) | |
| 340 | */ | |
| 341 | public void setReadOnly(boolean readOnly) { | |
| 342 | 0 | this.readOnly = readOnly; |
| 343 | 0 | } |
| 344 | ||
| 345 | /** | |
| 346 | * @see org.kuali.rice.kns.uif.core.Component#getConditionalReadOnly() | |
| 347 | */ | |
| 348 | public String getConditionalReadOnly() { | |
| 349 | 0 | return this.conditionalReadOnly; |
| 350 | } | |
| 351 | ||
| 352 | /** | |
| 353 | * @see org.kuali.rice.kns.uif.core.Component#setConditionalReadOnly(java.lang.String) | |
| 354 | */ | |
| 355 | public void setConditionalReadOnly(String conditionalReadOnly) { | |
| 356 | 0 | this.conditionalReadOnly = conditionalReadOnly; |
| 357 | 0 | } |
| 358 | ||
| 359 | /** | |
| 360 | * @see org.kuali.rice.kns.uif.core.Component#getRequired() | |
| 361 | */ | |
| 362 | public Boolean getRequired() { | |
| 363 | 0 | return this.required; |
| 364 | } | |
| 365 | ||
| 366 | /** | |
| 367 | * @see org.kuali.rice.kns.uif.core.Component#setRequired(java.lang.Boolean) | |
| 368 | */ | |
| 369 | public void setRequired(Boolean required) { | |
| 370 | 0 | this.required = required; |
| 371 | 0 | } |
| 372 | ||
| 373 | /** | |
| 374 | * Expression language string for conditionally setting the required | |
| 375 | * property | |
| 376 | * | |
| 377 | * @return String el that should evaluate to boolean | |
| 378 | */ | |
| 379 | public String getConditionalRequired() { | |
| 380 | 0 | return this.conditionalRequired; |
| 381 | } | |
| 382 | ||
| 383 | /** | |
| 384 | * Setter for the conditional required string | |
| 385 | * | |
| 386 | * @param conditionalRequired | |
| 387 | */ | |
| 388 | public void setConditionalRequired(String conditionalRequired) { | |
| 389 | 0 | this.conditionalRequired = conditionalRequired; |
| 390 | 0 | } |
| 391 | ||
| 392 | /** | |
| 393 | * @see org.kuali.rice.kns.uif.core.Component#isRender() | |
| 394 | */ | |
| 395 | public boolean isRender() { | |
| 396 | 0 | return this.render; |
| 397 | } | |
| 398 | ||
| 399 | /** | |
| 400 | * @see org.kuali.rice.kns.uif.core.Component#setRender(boolean) | |
| 401 | */ | |
| 402 | public void setRender(boolean render) { | |
| 403 | 0 | this.render = render; |
| 404 | 0 | } |
| 405 | ||
| 406 | public void setRender(String render) { | |
| 407 | 0 | this.propertyExpressions.put("render", render); |
| 408 | 0 | } |
| 409 | ||
| 410 | /** | |
| 411 | * @see org.kuali.rice.kns.uif.core.Component#getConditionalRender() | |
| 412 | */ | |
| 413 | public String getConditionalRender() { | |
| 414 | 0 | return this.conditionalRender; |
| 415 | } | |
| 416 | ||
| 417 | /** | |
| 418 | * @see org.kuali.rice.kns.uif.core.Component#setConditionalRender(java.lang.String) | |
| 419 | */ | |
| 420 | public void setConditionalRender(String conditionalRender) { | |
| 421 | 0 | this.conditionalRender = conditionalRender; |
| 422 | 0 | } |
| 423 | ||
| 424 | /** | |
| 425 | * @see org.kuali.rice.kns.uif.core.Component#getColSpan() | |
| 426 | */ | |
| 427 | public int getColSpan() { | |
| 428 | 0 | return this.colSpan; |
| 429 | } | |
| 430 | ||
| 431 | /** | |
| 432 | * @see org.kuali.rice.kns.uif.core.Component#setColSpan(int) | |
| 433 | */ | |
| 434 | public void setColSpan(int colSpan) { | |
| 435 | 0 | this.colSpan = colSpan; |
| 436 | 0 | } |
| 437 | ||
| 438 | /** | |
| 439 | * Expression language string for conditionally setting the colSpan property | |
| 440 | * | |
| 441 | * @return String el that should evaluate to int | |
| 442 | */ | |
| 443 | public String getConditionalColSpan() { | |
| 444 | 0 | return this.conditionalColSpan; |
| 445 | } | |
| 446 | ||
| 447 | /** | |
| 448 | * Setter for the conditional colSpan string | |
| 449 | * | |
| 450 | * @param conditionalColSpan | |
| 451 | */ | |
| 452 | public void setConditionalColSpan(String conditionalColSpan) { | |
| 453 | 0 | this.conditionalColSpan = conditionalColSpan; |
| 454 | 0 | } |
| 455 | ||
| 456 | /** | |
| 457 | * @see org.kuali.rice.kns.uif.core.Component#getRowSpan() | |
| 458 | */ | |
| 459 | public int getRowSpan() { | |
| 460 | 0 | return this.rowSpan; |
| 461 | } | |
| 462 | ||
| 463 | /** | |
| 464 | * @see org.kuali.rice.kns.uif.core.Component#setRowSpan(int) | |
| 465 | */ | |
| 466 | public void setRowSpan(int rowSpan) { | |
| 467 | 0 | this.rowSpan = rowSpan; |
| 468 | 0 | } |
| 469 | ||
| 470 | /** | |
| 471 | * Expression language string for conditionally setting the rowSpan property | |
| 472 | * | |
| 473 | * @return String el that should evaluate to int | |
| 474 | */ | |
| 475 | public String getConditionalRowSpan() { | |
| 476 | 0 | return this.conditionalRowSpan; |
| 477 | } | |
| 478 | ||
| 479 | /** | |
| 480 | * Setter for the conditional rowSpan string | |
| 481 | * | |
| 482 | * @param conditionalRowSpan | |
| 483 | */ | |
| 484 | public void setConditionalRowSpan(String conditionalRowSpan) { | |
| 485 | 0 | this.conditionalRowSpan = conditionalRowSpan; |
| 486 | 0 | } |
| 487 | ||
| 488 | /** | |
| 489 | * Horizontal alignment of the component within its container | |
| 490 | * <p> | |
| 491 | * All components belong to a <code>Container</code> and are placed using a | |
| 492 | * <code>LayoutManager</code>. This property specifies how the component | |
| 493 | * should be aligned horizontally within the container. During the finalize | |
| 494 | * phase the CSS text-align style will be created for the align setting. | |
| 495 | * </p> | |
| 496 | * | |
| 497 | * @return String horizontal align | |
| 498 | * @see org.kuali.rice.kns.uif.CssConstants.TextAligns | |
| 499 | */ | |
| 500 | public String getAlign() { | |
| 501 | 0 | return this.align; |
| 502 | } | |
| 503 | ||
| 504 | /** | |
| 505 | * Sets the components horizontal alignment | |
| 506 | * | |
| 507 | * @param align | |
| 508 | */ | |
| 509 | public void setAlign(String align) { | |
| 510 | 0 | this.align = align; |
| 511 | 0 | } |
| 512 | ||
| 513 | /** | |
| 514 | * Vertical alignment of the component within its container | |
| 515 | * <p> | |
| 516 | * All components belong to a <code>Container</code> and are placed using a | |
| 517 | * <code>LayoutManager</code>. This property specifies how the component | |
| 518 | * should be aligned vertically within the container. During the finalize | |
| 519 | * phase the CSS vertical-align style will be created for the valign | |
| 520 | * setting. | |
| 521 | * </p> | |
| 522 | * | |
| 523 | * @return String vertical align | |
| 524 | * @see org.kuali.rice.kns.uif.CssConstants.VerticalAligns | |
| 525 | */ | |
| 526 | public String getValign() { | |
| 527 | 0 | return this.valign; |
| 528 | } | |
| 529 | ||
| 530 | /** | |
| 531 | * Setter for the component's vertical align | |
| 532 | * | |
| 533 | * @param valign | |
| 534 | */ | |
| 535 | public void setValign(String valign) { | |
| 536 | 0 | this.valign = valign; |
| 537 | 0 | } |
| 538 | ||
| 539 | /** | |
| 540 | * Width the component should take up in the container | |
| 541 | * <p> | |
| 542 | * All components belong to a <code>Container</code> and are placed using a | |
| 543 | * <code>LayoutManager</code>. This property specifies a width the component | |
| 544 | * should take up in the Container. This is not applicable for all layout | |
| 545 | * managers. During the finalize phase the CSS width style will be created | |
| 546 | * for the width setting. | |
| 547 | * </p> | |
| 548 | * <p> | |
| 549 | * e.g. '30%', '55px' | |
| 550 | * </p> | |
| 551 | * | |
| 552 | * @return String width string | |
| 553 | */ | |
| 554 | public String getWidth() { | |
| 555 | 0 | return this.width; |
| 556 | } | |
| 557 | ||
| 558 | /** | |
| 559 | * Setter for the components width | |
| 560 | * | |
| 561 | * @param width | |
| 562 | */ | |
| 563 | public void setWidth(String width) { | |
| 564 | 0 | this.width = width; |
| 565 | 0 | } |
| 566 | ||
| 567 | /** | |
| 568 | * @see org.kuali.rice.kns.uif.core.Component#getStyle() | |
| 569 | */ | |
| 570 | public String getStyle() { | |
| 571 | 0 | return this.style; |
| 572 | } | |
| 573 | ||
| 574 | /** | |
| 575 | * @see org.kuali.rice.kns.uif.core.Component#setStyle(java.lang.String) | |
| 576 | */ | |
| 577 | public void setStyle(String style) { | |
| 578 | 0 | this.style = style; |
| 579 | 0 | } |
| 580 | ||
| 581 | /** | |
| 582 | * @see org.kuali.rice.kns.uif.core.Component#getStyleClasses() | |
| 583 | */ | |
| 584 | public List<String> getStyleClasses() { | |
| 585 | 0 | return this.styleClasses; |
| 586 | } | |
| 587 | ||
| 588 | /** | |
| 589 | * @see org.kuali.rice.kns.uif.core.Component#setStyleClasses(java.util.List) | |
| 590 | */ | |
| 591 | public void setStyleClasses(List<String> styleClasses) { | |
| 592 | 0 | this.styleClasses = styleClasses; |
| 593 | 0 | } |
| 594 | ||
| 595 | /** | |
| 596 | * Builds the HTML class attribute string by combining the styleClasses list | |
| 597 | * with a space delimiter | |
| 598 | * | |
| 599 | * @return String class attribute string | |
| 600 | */ | |
| 601 | public String getStyleClassesAsString() { | |
| 602 | 0 | if (styleClasses != null) { |
| 603 | 0 | return StringUtils.join(styleClasses, " "); |
| 604 | } | |
| 605 | ||
| 606 | 0 | return ""; |
| 607 | } | |
| 608 | ||
| 609 | /** | |
| 610 | * @see org.kuali.rice.kns.uif.core.Component#addStyleClass(java.lang.String) | |
| 611 | */ | |
| 612 | public void addStyleClass(String styleClass) { | |
| 613 | 0 | if (!styleClasses.contains(styleClass)) { |
| 614 | 0 | styleClasses.add(styleClass); |
| 615 | } | |
| 616 | 0 | } |
| 617 | ||
| 618 | /** | |
| 619 | * @see org.kuali.rice.kns.uif.Component#appendToStyle(java.lang.String) | |
| 620 | */ | |
| 621 | public void appendToStyle(String styleRules) { | |
| 622 | 0 | if (style == null) { |
| 623 | 0 | style = ""; |
| 624 | } | |
| 625 | 0 | style = style + styleRules; |
| 626 | 0 | } |
| 627 | ||
| 628 | /** | |
| 629 | * @see org.kuali.rice.kns.uif.core.Component#getFinalizeMethodToCall() | |
| 630 | */ | |
| 631 | public String getFinalizeMethodToCall() { | |
| 632 | 0 | return this.finalizeMethodToCall; |
| 633 | } | |
| 634 | ||
| 635 | /** | |
| 636 | * Setter for the finalize method | |
| 637 | * | |
| 638 | * @param finalizeMethodToCall | |
| 639 | */ | |
| 640 | public void setFinalizeMethodToCall(String finalizeMethodToCall) { | |
| 641 | 0 | this.finalizeMethodToCall = finalizeMethodToCall; |
| 642 | 0 | } |
| 643 | ||
| 644 | /** | |
| 645 | * @see org.kuali.rice.kns.uif.core.Component#getFinalizeMethodInvoker() | |
| 646 | */ | |
| 647 | public MethodInvokerConfig getFinalizeMethodInvoker() { | |
| 648 | 0 | return this.finalizeMethodInvoker; |
| 649 | } | |
| 650 | ||
| 651 | /** | |
| 652 | * Setter for the method invoker instance | |
| 653 | * | |
| 654 | * @param renderingMethodInvoker | |
| 655 | */ | |
| 656 | public void setFinalizeMethodInvoker(MethodInvokerConfig finalizeMethodInvoker) { | |
| 657 | 0 | this.finalizeMethodInvoker = finalizeMethodInvoker; |
| 658 | 0 | } |
| 659 | ||
| 660 | /** | |
| 661 | * @see org.kuali.rice.kns.uif.core.Component#isSelfRendered() | |
| 662 | */ | |
| 663 | public boolean isSelfRendered() { | |
| 664 | 0 | return this.selfRendered; |
| 665 | } | |
| 666 | ||
| 667 | /** | |
| 668 | * @see org.kuali.rice.kns.uif.core.Component#setSelfRendered(boolean) | |
| 669 | */ | |
| 670 | public void setSelfRendered(boolean selfRendered) { | |
| 671 | 0 | this.selfRendered = selfRendered; |
| 672 | 0 | } |
| 673 | ||
| 674 | /** | |
| 675 | * @see org.kuali.rice.kns.uif.core.Component#getRenderOutput() | |
| 676 | */ | |
| 677 | public String getRenderOutput() { | |
| 678 | 0 | return this.renderOutput; |
| 679 | } | |
| 680 | ||
| 681 | /** | |
| 682 | * @see org.kuali.rice.kns.uif.core.Component#setRenderOutput(java.lang.String) | |
| 683 | */ | |
| 684 | public void setRenderOutput(String renderOutput) { | |
| 685 | 0 | this.renderOutput = renderOutput; |
| 686 | 0 | } |
| 687 | ||
| 688 | /** | |
| 689 | * @see org.kuali.rice.kns.uif.core.Component#getComponentModifiers() | |
| 690 | */ | |
| 691 | public List<ComponentModifier> getComponentModifiers() { | |
| 692 | 0 | return this.componentModifiers; |
| 693 | } | |
| 694 | ||
| 695 | /** | |
| 696 | * @see org.kuali.rice.kns.uif.core.Component#setComponentModifiers(java.util.List) | |
| 697 | */ | |
| 698 | public void setComponentModifiers(List<ComponentModifier> componentModifiers) { | |
| 699 | 0 | this.componentModifiers = componentModifiers; |
| 700 | 0 | } |
| 701 | ||
| 702 | /** | |
| 703 | * @see org.kuali.rice.kns.uif.core.Component#getContext() | |
| 704 | */ | |
| 705 | public Map<String, Object> getContext() { | |
| 706 | 0 | return this.context; |
| 707 | } | |
| 708 | ||
| 709 | /** | |
| 710 | * @see org.kuali.rice.kns.uif.core.Component#setContext(java.util.Map) | |
| 711 | */ | |
| 712 | public void setContext(Map<String, Object> context) { | |
| 713 | 0 | this.context = context; |
| 714 | 0 | } |
| 715 | ||
| 716 | /** | |
| 717 | * @see org.kuali.rice.kns.uif.core.Component#pushObjectToContext(java.lang.String, | |
| 718 | * java.lang.Object) | |
| 719 | */ | |
| 720 | public void pushObjectToContext(String objectName, Object object) { | |
| 721 | 0 | if (this.context == null) { |
| 722 | 0 | this.context = new HashMap<String, Object>(); |
| 723 | } | |
| 724 | ||
| 725 | 0 | this.context.put(objectName, object); |
| 726 | 0 | } |
| 727 | ||
| 728 | public Map<String, String> getPropertyExpressions() { | |
| 729 | 0 | return propertyExpressions; |
| 730 | } | |
| 731 | ||
| 732 | public void setPropertyExpressions(Map<String, String> propertyExpressions) { | |
| 733 | 0 | this.propertyExpressions = propertyExpressions; |
| 734 | 0 | } |
| 735 | ||
| 736 | /** | |
| 737 | * @see org.kuali.rice.kns.uif.core.Component#getPropertyReplacers() | |
| 738 | */ | |
| 739 | public List<PropertyReplacer> getPropertyReplacers() { | |
| 740 | 0 | return this.propertyReplacers; |
| 741 | } | |
| 742 | ||
| 743 | /** | |
| 744 | * @see org.kuali.rice.kns.uif.core.Component#setPropertyReplacers(java.util.List) | |
| 745 | */ | |
| 746 | public void setPropertyReplacers(List<PropertyReplacer> propertyReplacers) { | |
| 747 | 0 | this.propertyReplacers = propertyReplacers; |
| 748 | 0 | } |
| 749 | ||
| 750 | /** | |
| 751 | * @see org.springframework.core.Ordered#getOrder() | |
| 752 | */ | |
| 753 | public int getOrder() { | |
| 754 | 0 | return this.order; |
| 755 | } | |
| 756 | ||
| 757 | /** | |
| 758 | * Setter for the component's order | |
| 759 | * | |
| 760 | * @param order | |
| 761 | */ | |
| 762 | public void setOrder(int order) { | |
| 763 | 0 | this.order = order; |
| 764 | 0 | } |
| 765 | ||
| 766 | /** | |
| 767 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnLoad() | |
| 768 | */ | |
| 769 | public boolean getSupportsOnLoad() { | |
| 770 | 0 | return false; |
| 771 | } | |
| 772 | ||
| 773 | /** | |
| 774 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnLoadScript() | |
| 775 | */ | |
| 776 | public String getOnLoadScript() { | |
| 777 | 0 | return onLoadScript; |
| 778 | } | |
| 779 | ||
| 780 | /** | |
| 781 | * Setter for the components onLoad script | |
| 782 | * | |
| 783 | * @param onLoadScript | |
| 784 | */ | |
| 785 | public void setOnLoadScript(String onLoadScript) { | |
| 786 | 0 | this.onLoadScript = onLoadScript; |
| 787 | 0 | } |
| 788 | ||
| 789 | /** | |
| 790 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnDocumentReady() | |
| 791 | */ | |
| 792 | public boolean getSupportsOnDocumentReady() { | |
| 793 | 0 | return true; |
| 794 | } | |
| 795 | ||
| 796 | /** | |
| 797 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnDocumentReadyScript() | |
| 798 | */ | |
| 799 | public String getOnDocumentReadyScript() { | |
| 800 | 0 | return onDocumentReadyScript; |
| 801 | } | |
| 802 | ||
| 803 | /** | |
| 804 | * Setter for the components onDocumentReady script | |
| 805 | * | |
| 806 | * @param onDocumentReadyScript | |
| 807 | */ | |
| 808 | public void setOnDocumentReadyScript(String onDocumentReadyScript) { | |
| 809 | 0 | this.onDocumentReadyScript = onDocumentReadyScript; |
| 810 | 0 | } |
| 811 | ||
| 812 | /** | |
| 813 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnUnload() | |
| 814 | */ | |
| 815 | public boolean getSupportsOnUnload() { | |
| 816 | 0 | return false; |
| 817 | } | |
| 818 | ||
| 819 | /** | |
| 820 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnUnloadScript() | |
| 821 | */ | |
| 822 | public String getOnUnloadScript() { | |
| 823 | 0 | return onUnloadScript; |
| 824 | } | |
| 825 | ||
| 826 | /** | |
| 827 | * Setter for the components onUnload script | |
| 828 | * | |
| 829 | * @param onUnloadScript | |
| 830 | */ | |
| 831 | public void setOnUnloadScript(String onUnloadScript) { | |
| 832 | 0 | this.onUnloadScript = onUnloadScript; |
| 833 | 0 | } |
| 834 | ||
| 835 | /** | |
| 836 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnClose() | |
| 837 | */ | |
| 838 | public boolean getSupportsOnClose() { | |
| 839 | 0 | return false; |
| 840 | } | |
| 841 | ||
| 842 | /** | |
| 843 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnCloseScript() | |
| 844 | */ | |
| 845 | public String getOnCloseScript() { | |
| 846 | 0 | return onCloseScript; |
| 847 | } | |
| 848 | ||
| 849 | /** | |
| 850 | * Setter for the components onClose script | |
| 851 | * | |
| 852 | * @param onCloseScript | |
| 853 | */ | |
| 854 | public void setOnCloseScript(String onCloseScript) { | |
| 855 | 0 | this.onCloseScript = onCloseScript; |
| 856 | 0 | } |
| 857 | ||
| 858 | /** | |
| 859 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnBlur() | |
| 860 | */ | |
| 861 | public boolean getSupportsOnBlur() { | |
| 862 | 0 | return false; |
| 863 | } | |
| 864 | ||
| 865 | /** | |
| 866 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnBlurScript() | |
| 867 | */ | |
| 868 | public String getOnBlurScript() { | |
| 869 | 0 | return onBlurScript; |
| 870 | } | |
| 871 | ||
| 872 | /** | |
| 873 | * Setter for the components onBlur script | |
| 874 | * | |
| 875 | * @param onBlurScript | |
| 876 | */ | |
| 877 | public void setOnBlurScript(String onBlurScript) { | |
| 878 | 0 | this.onBlurScript = onBlurScript; |
| 879 | 0 | } |
| 880 | ||
| 881 | /** | |
| 882 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnChange() | |
| 883 | */ | |
| 884 | public boolean getSupportsOnChange() { | |
| 885 | 0 | return false; |
| 886 | } | |
| 887 | ||
| 888 | /** | |
| 889 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnChangeScript() | |
| 890 | */ | |
| 891 | public String getOnChangeScript() { | |
| 892 | 0 | return onChangeScript; |
| 893 | } | |
| 894 | ||
| 895 | /** | |
| 896 | * Setter for the components onChange script | |
| 897 | * | |
| 898 | * @param onChangeScript | |
| 899 | */ | |
| 900 | public void setOnChangeScript(String onChangeScript) { | |
| 901 | 0 | this.onChangeScript = onChangeScript; |
| 902 | 0 | } |
| 903 | ||
| 904 | /** | |
| 905 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnClick() | |
| 906 | */ | |
| 907 | public boolean getSupportsOnClick() { | |
| 908 | 0 | return false; |
| 909 | } | |
| 910 | ||
| 911 | /** | |
| 912 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnClickScript() | |
| 913 | */ | |
| 914 | public String getOnClickScript() { | |
| 915 | 0 | return onClickScript; |
| 916 | } | |
| 917 | ||
| 918 | /** | |
| 919 | * Setter for the components onClick script | |
| 920 | * | |
| 921 | * @param onClickScript | |
| 922 | */ | |
| 923 | public void setOnClickScript(String onClickScript) { | |
| 924 | 0 | this.onClickScript = onClickScript; |
| 925 | 0 | } |
| 926 | ||
| 927 | /** | |
| 928 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnDblClick() | |
| 929 | */ | |
| 930 | public boolean getSupportsOnDblClick() { | |
| 931 | 0 | return false; |
| 932 | } | |
| 933 | ||
| 934 | /** | |
| 935 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnDblClickScript() | |
| 936 | */ | |
| 937 | public String getOnDblClickScript() { | |
| 938 | 0 | return onDblClickScript; |
| 939 | } | |
| 940 | ||
| 941 | /** | |
| 942 | * Setter for the components onDblClick script | |
| 943 | * | |
| 944 | * @param onDblClickScript | |
| 945 | */ | |
| 946 | public void setOnDblClickScript(String onDblClickScript) { | |
| 947 | 0 | this.onDblClickScript = onDblClickScript; |
| 948 | 0 | } |
| 949 | ||
| 950 | /** | |
| 951 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnFocus() | |
| 952 | */ | |
| 953 | public boolean getSupportsOnFocus() { | |
| 954 | 0 | return false; |
| 955 | } | |
| 956 | ||
| 957 | /** | |
| 958 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnFocusScript() | |
| 959 | */ | |
| 960 | public String getOnFocusScript() { | |
| 961 | 0 | return onFocusScript; |
| 962 | } | |
| 963 | ||
| 964 | /** | |
| 965 | * Setter for the components onFocus script | |
| 966 | * | |
| 967 | * @param onFocusScript | |
| 968 | */ | |
| 969 | public void setOnFocusScript(String onFocusScript) { | |
| 970 | 0 | this.onFocusScript = onFocusScript; |
| 971 | 0 | } |
| 972 | ||
| 973 | /** | |
| 974 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnSubmit() | |
| 975 | */ | |
| 976 | public boolean getSupportsOnSubmit() { | |
| 977 | 0 | return false; |
| 978 | } | |
| 979 | ||
| 980 | /** | |
| 981 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnSubmitScript() | |
| 982 | */ | |
| 983 | public String getOnSubmitScript() { | |
| 984 | 0 | return onSubmitScript; |
| 985 | } | |
| 986 | ||
| 987 | /** | |
| 988 | * Setter for the components onSubmit script | |
| 989 | * | |
| 990 | * @param onSubmitScript | |
| 991 | */ | |
| 992 | public void setOnSubmitScript(String onSubmitScript) { | |
| 993 | 0 | this.onSubmitScript = onSubmitScript; |
| 994 | 0 | } |
| 995 | ||
| 996 | /** | |
| 997 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnKeyPress() | |
| 998 | */ | |
| 999 | public boolean getSupportsOnKeyPress() { | |
| 1000 | 0 | return false; |
| 1001 | } | |
| 1002 | ||
| 1003 | /** | |
| 1004 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnKeyPressScript() | |
| 1005 | */ | |
| 1006 | public String getOnKeyPressScript() { | |
| 1007 | 0 | return onKeyPressScript; |
| 1008 | } | |
| 1009 | ||
| 1010 | /** | |
| 1011 | * Setter for the components onKeyPress script | |
| 1012 | * | |
| 1013 | * @param onKeyPressScript | |
| 1014 | */ | |
| 1015 | public void setOnKeyPressScript(String onKeyPressScript) { | |
| 1016 | 0 | this.onKeyPressScript = onKeyPressScript; |
| 1017 | 0 | } |
| 1018 | ||
| 1019 | /** | |
| 1020 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnKeyUp() | |
| 1021 | */ | |
| 1022 | public boolean getSupportsOnKeyUp() { | |
| 1023 | 0 | return false; |
| 1024 | } | |
| 1025 | ||
| 1026 | /** | |
| 1027 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnKeyUpScript() | |
| 1028 | */ | |
| 1029 | public String getOnKeyUpScript() { | |
| 1030 | 0 | return onKeyUpScript; |
| 1031 | } | |
| 1032 | ||
| 1033 | /** | |
| 1034 | * Setter for the components onKeyUp script | |
| 1035 | * | |
| 1036 | * @param onKeyUpScript | |
| 1037 | */ | |
| 1038 | public void setOnKeyUpScript(String onKeyUpScript) { | |
| 1039 | 0 | this.onKeyUpScript = onKeyUpScript; |
| 1040 | 0 | } |
| 1041 | ||
| 1042 | /** | |
| 1043 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnKeyDown() | |
| 1044 | */ | |
| 1045 | public boolean getSupportsOnKeyDown() { | |
| 1046 | 0 | return false; |
| 1047 | } | |
| 1048 | ||
| 1049 | /** | |
| 1050 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnKeyDownScript() | |
| 1051 | */ | |
| 1052 | public String getOnKeyDownScript() { | |
| 1053 | 0 | return onKeyDownScript; |
| 1054 | } | |
| 1055 | ||
| 1056 | /** | |
| 1057 | * Setter for the components onKeyDown script | |
| 1058 | * | |
| 1059 | * @param onKeyDownScript | |
| 1060 | */ | |
| 1061 | public void setOnKeyDownScript(String onKeyDownScript) { | |
| 1062 | 0 | this.onKeyDownScript = onKeyDownScript; |
| 1063 | 0 | } |
| 1064 | ||
| 1065 | /** | |
| 1066 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnMouseOver() | |
| 1067 | */ | |
| 1068 | public boolean getSupportsOnMouseOver() { | |
| 1069 | 0 | return false; |
| 1070 | } | |
| 1071 | ||
| 1072 | /** | |
| 1073 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnMouseOverScript() | |
| 1074 | */ | |
| 1075 | public String getOnMouseOverScript() { | |
| 1076 | 0 | return onMouseOverScript; |
| 1077 | } | |
| 1078 | ||
| 1079 | /** | |
| 1080 | * Setter for the components onMouseOver script | |
| 1081 | * | |
| 1082 | * @param onMouseOverScript | |
| 1083 | */ | |
| 1084 | public void setOnMouseOverScript(String onMouseOverScript) { | |
| 1085 | 0 | this.onMouseOverScript = onMouseOverScript; |
| 1086 | 0 | } |
| 1087 | ||
| 1088 | /** | |
| 1089 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnMouseOut() | |
| 1090 | */ | |
| 1091 | public boolean getSupportsOnMouseOut() { | |
| 1092 | 0 | return false; |
| 1093 | } | |
| 1094 | ||
| 1095 | /** | |
| 1096 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnMouseOutScript() | |
| 1097 | */ | |
| 1098 | public String getOnMouseOutScript() { | |
| 1099 | 0 | return onMouseOutScript; |
| 1100 | } | |
| 1101 | ||
| 1102 | /** | |
| 1103 | * Setter for the components onMouseOut script | |
| 1104 | * | |
| 1105 | * @param onMouseOutScript | |
| 1106 | */ | |
| 1107 | public void setOnMouseOutScript(String onMouseOutScript) { | |
| 1108 | 0 | this.onMouseOutScript = onMouseOutScript; |
| 1109 | 0 | } |
| 1110 | ||
| 1111 | /** | |
| 1112 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnMouseUp() | |
| 1113 | */ | |
| 1114 | public boolean getSupportsOnMouseUp() { | |
| 1115 | 0 | return false; |
| 1116 | } | |
| 1117 | ||
| 1118 | /** | |
| 1119 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnMouseUpScript() | |
| 1120 | */ | |
| 1121 | public String getOnMouseUpScript() { | |
| 1122 | 0 | return onMouseUpScript; |
| 1123 | } | |
| 1124 | ||
| 1125 | /** | |
| 1126 | * Setter for the components onMouseUp script | |
| 1127 | * | |
| 1128 | * @param onMouseUpScript | |
| 1129 | */ | |
| 1130 | public void setOnMouseUpScript(String onMouseUpScript) { | |
| 1131 | 0 | this.onMouseUpScript = onMouseUpScript; |
| 1132 | 0 | } |
| 1133 | ||
| 1134 | /** | |
| 1135 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnMouseDown() | |
| 1136 | */ | |
| 1137 | public boolean getSupportsOnMouseDown() { | |
| 1138 | 0 | return false; |
| 1139 | } | |
| 1140 | ||
| 1141 | /** | |
| 1142 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnMouseDownScript() | |
| 1143 | */ | |
| 1144 | public String getOnMouseDownScript() { | |
| 1145 | 0 | return onMouseDownScript; |
| 1146 | } | |
| 1147 | ||
| 1148 | /** | |
| 1149 | * Setter for the components onMouseDown script | |
| 1150 | * | |
| 1151 | * @param onMouseDownScript | |
| 1152 | */ | |
| 1153 | public void setOnMouseDownScript(String onMouseDownScript) { | |
| 1154 | 0 | this.onMouseDownScript = onMouseDownScript; |
| 1155 | 0 | } |
| 1156 | ||
| 1157 | /** | |
| 1158 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getSupportsOnMouseMove() | |
| 1159 | */ | |
| 1160 | public boolean getSupportsOnMouseMove() { | |
| 1161 | 0 | return false; |
| 1162 | } | |
| 1163 | ||
| 1164 | /** | |
| 1165 | * @see org.kuali.rice.kns.uif.core.ScriptEventSupport#getOnMouseMoveScript() | |
| 1166 | */ | |
| 1167 | public String getOnMouseMoveScript() { | |
| 1168 | 0 | return onMouseMoveScript; |
| 1169 | } | |
| 1170 | ||
| 1171 | /** | |
| 1172 | * Setter for the components onMouseMove script | |
| 1173 | * | |
| 1174 | * @param onMouseMoveScript | |
| 1175 | */ | |
| 1176 | public void setOnMouseMoveScript(String onMouseMoveScript) { | |
| 1177 | 0 | this.onMouseMoveScript = onMouseMoveScript; |
| 1178 | 0 | } |
| 1179 | ||
| 1180 | /** | |
| 1181 | * @see org.kuali.rice.kns.uif.widget.Widget#getWidgetOptions() | |
| 1182 | */ | |
| 1183 | public Map<String, String> getComponentOptions() { | |
| 1184 | 0 | if (componentOptions == null) { |
| 1185 | 0 | componentOptions = new HashMap<String, String>(); |
| 1186 | } | |
| 1187 | 0 | return this.componentOptions; |
| 1188 | } | |
| 1189 | ||
| 1190 | /** | |
| 1191 | * @see org.kuali.rice.kns.uif.widget.Widget#setWidgetOptions(java.util.Map) | |
| 1192 | */ | |
| 1193 | public void setComponentOptions(Map<String, String> componentOptions) { | |
| 1194 | 0 | this.componentOptions = componentOptions; |
| 1195 | 0 | } |
| 1196 | ||
| 1197 | /** | |
| 1198 | * Builds a string from the underlying <code>Map</code> of component options | |
| 1199 | * that will export that options as a JavaScript Map for use in js and | |
| 1200 | * jQuery plugins | |
| 1201 | * | |
| 1202 | * @return String of widget options formatted as JS Map | |
| 1203 | */ | |
| 1204 | public String getComponentOptionsJSString() { | |
| 1205 | 0 | if (componentOptions == null) { |
| 1206 | 0 | componentOptions = new HashMap<String, String>(); |
| 1207 | } | |
| 1208 | 0 | StringBuffer sb = new StringBuffer(); |
| 1209 | ||
| 1210 | 0 | sb.append("{"); |
| 1211 | ||
| 1212 | 0 | for (String optionKey : componentOptions.keySet()) { |
| 1213 | 0 | String optionValue = componentOptions.get(optionKey); |
| 1214 | ||
| 1215 | 0 | if (sb.length() > 1) { |
| 1216 | 0 | sb.append(","); |
| 1217 | } | |
| 1218 | ||
| 1219 | 0 | sb.append(optionKey); |
| 1220 | 0 | sb.append(":"); |
| 1221 | ||
| 1222 | 0 | boolean isNumber = false; |
| 1223 | 0 | if (StringUtils.isNotBlank(optionValue) |
| 1224 | && (StringUtils.isNumeric(optionValue.trim().substring(0, 1)) || optionValue.trim().substring(0, 1) | |
| 1225 | .equals("-"))) { | |
| 1226 | try { | |
| 1227 | 0 | Double.parseDouble(optionValue.trim()); |
| 1228 | 0 | isNumber = true; |
| 1229 | 0 | } catch (NumberFormatException e) { |
| 1230 | 0 | isNumber = false; |
| 1231 | 0 | } |
| 1232 | } | |
| 1233 | // If an option value starts with { or [, it would be a nested value | |
| 1234 | // and it should not use quotes around it | |
| 1235 | 0 | if (StringUtils.startsWith(optionValue, "{") || StringUtils.startsWith(optionValue, "[")) { |
| 1236 | 0 | sb.append(optionValue); |
| 1237 | } | |
| 1238 | // need to be the base boolean value "false" is true in js - a non | |
| 1239 | // empty string | |
| 1240 | 0 | else if (optionValue.equalsIgnoreCase("false") || optionValue.equalsIgnoreCase("true")) { |
| 1241 | 0 | sb.append(optionValue); |
| 1242 | } | |
| 1243 | // for numerics | |
| 1244 | 0 | else if (isNumber) { |
| 1245 | 0 | sb.append(optionValue); |
| 1246 | } else { | |
| 1247 | 0 | sb.append("\"" + optionValue + "\""); |
| 1248 | } | |
| 1249 | 0 | } |
| 1250 | ||
| 1251 | 0 | sb.append("}"); |
| 1252 | ||
| 1253 | 0 | return sb.toString(); |
| 1254 | } | |
| 1255 | ||
| 1256 | public String getEventCode() { | |
| 1257 | 0 | String eventCode = ""; |
| 1258 | ||
| 1259 | 0 | return eventCode; |
| 1260 | } | |
| 1261 | ||
| 1262 | /** | |
| 1263 | * When set if the condition is satisfied, the component will be displayed. | |
| 1264 | * The component MUST BE a container or field type. progressiveRender is | |
| 1265 | * defined in a limited Spring EL syntax. Only valid form property names, | |
| 1266 | * and, or, logical comparison operators (non-arithmetic), and the matches | |
| 1267 | * clause are allowed. String and regex values must use single quotes ('), | |
| 1268 | * booleans must be either true or false, numbers must be a valid double, | |
| 1269 | * either negative or positive. <br> | |
| 1270 | * DO NOT use progressiveRender and conditionalRefresh on the same component | |
| 1271 | * unless it is known that the component will always be visible in all cases | |
| 1272 | * when a conditionalRefresh happens (ie conditionalRefresh has | |
| 1273 | * progressiveRender's condition anded with its own condition). <b>If a | |
| 1274 | * component should be refreshed every time it is shown, use the | |
| 1275 | * progressiveRenderAndRefresh option with this property instead.</b> | |
| 1276 | * | |
| 1277 | * @return the progressiveRender | |
| 1278 | */ | |
| 1279 | public String getProgressiveRender() { | |
| 1280 | 0 | return this.progressiveRender; |
| 1281 | } | |
| 1282 | ||
| 1283 | /** | |
| 1284 | * @param progressiveRender | |
| 1285 | * the progressiveRender to set | |
| 1286 | */ | |
| 1287 | public void setProgressiveRender(String progressiveRender) { | |
| 1288 | 0 | this.progressiveRender = progressiveRender; |
| 1289 | 0 | } |
| 1290 | ||
| 1291 | /** | |
| 1292 | * When set if the condition is satisfied, the component will be refreshed. | |
| 1293 | * The component MUST BE a container or field type. conditionalRefresh is | |
| 1294 | * defined in a limited Spring EL syntax. Only valid form property names, | |
| 1295 | * and, or, logical comparison operators (non-arithmetic), and the matches | |
| 1296 | * clause are allowed. String and regex values must use single quotes ('), | |
| 1297 | * booleans must be either true or false, numbers must be a valid double | |
| 1298 | * either negative or positive. <br> | |
| 1299 | * DO NOT use progressiveRender and conditionalRefresh on the same component | |
| 1300 | * unless it is known that the component will always be visible in all cases | |
| 1301 | * when a conditionalRefresh happens (ie conditionalRefresh has | |
| 1302 | * progressiveRender's condition anded with its own condition). <b>If a | |
| 1303 | * component should be refreshed every time it is shown, use the | |
| 1304 | * progressiveRenderAndRefresh option with this property instead.</b> | |
| 1305 | * | |
| 1306 | * @return the conditionalRefresh | |
| 1307 | */ | |
| 1308 | public String getConditionalRefresh() { | |
| 1309 | 0 | return this.conditionalRefresh; |
| 1310 | } | |
| 1311 | ||
| 1312 | /** | |
| 1313 | * @param conditionalRefresh | |
| 1314 | * the conditionalRefresh to set | |
| 1315 | */ | |
| 1316 | public void setConditionalRefresh(String conditionalRefresh) { | |
| 1317 | 0 | this.conditionalRefresh = conditionalRefresh; |
| 1318 | 0 | } |
| 1319 | ||
| 1320 | /** | |
| 1321 | * Control names used to control progressive disclosure, set internally | |
| 1322 | * cannot be set. | |
| 1323 | * | |
| 1324 | * @return the progressiveDisclosureControlNames | |
| 1325 | */ | |
| 1326 | public List<String> getProgressiveDisclosureControlNames() { | |
| 1327 | 0 | return this.progressiveDisclosureControlNames; |
| 1328 | } | |
| 1329 | ||
| 1330 | /** | |
| 1331 | * The condition to show this component progressively converted to a js | |
| 1332 | * expression, set internally cannot be set. | |
| 1333 | * | |
| 1334 | * @return the progressiveDisclosureConditionJs | |
| 1335 | */ | |
| 1336 | public String getProgressiveDisclosureConditionJs() { | |
| 1337 | 0 | return this.progressiveDisclosureConditionJs; |
| 1338 | } | |
| 1339 | ||
| 1340 | /** | |
| 1341 | * The condition to refresh this component converted to a js expression, set | |
| 1342 | * internally cannot be set. | |
| 1343 | * | |
| 1344 | * @return the conditionalRefreshConditionJs | |
| 1345 | */ | |
| 1346 | public String getConditionalRefreshConditionJs() { | |
| 1347 | 0 | return this.conditionalRefreshConditionJs; |
| 1348 | } | |
| 1349 | ||
| 1350 | /** | |
| 1351 | * Control names used to control conditional refresh, set internally cannot | |
| 1352 | * be set. | |
| 1353 | * | |
| 1354 | * @return the conditionalRefreshControlNames | |
| 1355 | */ | |
| 1356 | public List<String> getConditionalRefreshControlNames() { | |
| 1357 | 0 | return this.conditionalRefreshControlNames; |
| 1358 | } | |
| 1359 | ||
| 1360 | /** | |
| 1361 | * When progressiveRenderViaAJAX is true, this component will be retrieved | |
| 1362 | * from the server when it first satisfies its progressive render condition. | |
| 1363 | * After the first retrieval, it is hidden/shown in the html by the js when | |
| 1364 | * its progressive condition result changes. <b>By default, this is false, | |
| 1365 | * so components with progressive render capabilities will always be already | |
| 1366 | * within the client html and toggled to be hidden or visible.</b> | |
| 1367 | * | |
| 1368 | * @return the progressiveRenderViaAJAX | |
| 1369 | */ | |
| 1370 | public boolean isProgressiveRenderViaAJAX() { | |
| 1371 | 0 | return this.progressiveRenderViaAJAX; |
| 1372 | } | |
| 1373 | ||
| 1374 | /** | |
| 1375 | * @param progressiveRenderViaAJAX | |
| 1376 | * the progressiveRenderViaAJAX to set | |
| 1377 | */ | |
| 1378 | public void setProgressiveRenderViaAJAX(boolean progressiveRenderViaAJAX) { | |
| 1379 | 0 | this.progressiveRenderViaAJAX = progressiveRenderViaAJAX; |
| 1380 | 0 | } |
| 1381 | ||
| 1382 | /** | |
| 1383 | * If true, when the progressiveRender condition is satisfied, the component | |
| 1384 | * will always be retrieved from the server and shown(as opposed to being | |
| 1385 | * stored on the client, but hidden, after the first retrieval as is the | |
| 1386 | * case with the progressiveRenderViaAJAX option). <b>By default, this is | |
| 1387 | * false, so components with progressive render capabilities will always be | |
| 1388 | * already within the client html and toggled to be hidden or visible.</b> | |
| 1389 | * | |
| 1390 | * @return the progressiveRenderAndRefresh | |
| 1391 | */ | |
| 1392 | public boolean isProgressiveRenderAndRefresh() { | |
| 1393 | 0 | return this.progressiveRenderAndRefresh; |
| 1394 | } | |
| 1395 | ||
| 1396 | /** | |
| 1397 | * @param progressiveRenderAndRefresh | |
| 1398 | * the progressiveRenderAndRefresh to set | |
| 1399 | */ | |
| 1400 | public void setProgressiveRenderAndRefresh(boolean progressiveRenderAndRefresh) { | |
| 1401 | 0 | this.progressiveRenderAndRefresh = progressiveRenderAndRefresh; |
| 1402 | 0 | } |
| 1403 | ||
| 1404 | /** | |
| 1405 | * Specifies a property by name that when it value changes will | |
| 1406 | * automatically perform a refresh on this component. This can be a comma | |
| 1407 | * separated list of multiple properties that require this component to be | |
| 1408 | * refreshed when any of them change. <Br>DO NOT use with progressiveRender | |
| 1409 | * unless it is know that progressiveRender condition will always be | |
| 1410 | * satisfied before one of these fields can be changed. | |
| 1411 | * | |
| 1412 | * @return the refreshWhenChanged | |
| 1413 | */ | |
| 1414 | public String getRefreshWhenChanged() { | |
| 1415 | 0 | return this.refreshWhenChanged; |
| 1416 | } | |
| 1417 | ||
| 1418 | /** | |
| 1419 | * @param refreshWhenChanged | |
| 1420 | * the refreshWhenChanged to set | |
| 1421 | */ | |
| 1422 | public void setRefreshWhenChanged(String refreshWhenChanged) { | |
| 1423 | 0 | this.refreshWhenChanged = refreshWhenChanged; |
| 1424 | 0 | } |
| 1425 | ||
| 1426 | /** | |
| 1427 | * Control names which will refresh this component when they are changed, added | |
| 1428 | * internally | |
| 1429 | * @return the refreshWhenChangedControlNames | |
| 1430 | */ | |
| 1431 | public List<String> getRefreshWhenChangedControlNames() { | |
| 1432 | 0 | return this.refreshWhenChangedControlNames; |
| 1433 | } | |
| 1434 | ||
| 1435 | /** | |
| 1436 | * @return the refresh | |
| 1437 | */ | |
| 1438 | public boolean isRefresh() { | |
| 1439 | 0 | return this.refresh; |
| 1440 | } | |
| 1441 | ||
| 1442 | /** | |
| 1443 | * @param refresh the refresh to set | |
| 1444 | */ | |
| 1445 | public void setRefresh(boolean refresh) { | |
| 1446 | 0 | this.refresh = refresh; |
| 1447 | 0 | } |
| 1448 | ||
| 1449 | /** | |
| 1450 | * @param setter | |
| 1451 | * for the skipInTabOrder flag | |
| 1452 | */ | |
| 1453 | public void setSkipInTabOrder(boolean skipInTabOrder) { | |
| 1454 | 0 | this.skipInTabOrder = skipInTabOrder; |
| 1455 | 0 | } |
| 1456 | ||
| 1457 | /** | |
| 1458 | * Flag indicating that this component and its nested components must be | |
| 1459 | * skipped when keyboard tabbing. | |
| 1460 | * | |
| 1461 | * @return the skipInTabOrder flag | |
| 1462 | */ | |
| 1463 | public boolean isSkipInTabOrder() { | |
| 1464 | 0 | return skipInTabOrder; |
| 1465 | } | |
| 1466 | } |