Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ActionField |
|
| 1.9230769230769231;1.923 |
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.field; | |
17 | ||
18 | import org.apache.commons.lang.StringUtils; | |
19 | import org.kuali.rice.krad.uif.UifConstants; | |
20 | import org.kuali.rice.krad.uif.UifParameters; | |
21 | import org.kuali.rice.krad.uif.UifPropertyPaths; | |
22 | import org.kuali.rice.krad.uif.view.FormView; | |
23 | import org.kuali.rice.krad.uif.view.View; | |
24 | import org.kuali.rice.krad.uif.component.Component; | |
25 | import org.kuali.rice.krad.uif.widget.LightBox; | |
26 | ||
27 | import java.util.HashMap; | |
28 | import java.util.List; | |
29 | import java.util.Map; | |
30 | ||
31 | /** | |
32 | * Field that presents an action that can be taken on the UI such as submitting | |
33 | * the form or invoking a script | |
34 | * | |
35 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
36 | */ | |
37 | public class ActionField extends FieldBase { | |
38 | private static final long serialVersionUID = 1025672792657238829L; | |
39 | ||
40 | private String methodToCall; | |
41 | private String navigateToPageId; | |
42 | ||
43 | private String clientSideJs; | |
44 | ||
45 | private String jumpToIdAfterSubmit; | |
46 | private String jumpToNameAfterSubmit; | |
47 | private String focusOnAfterSubmit; | |
48 | ||
49 | private String actionLabel; | |
50 | private ImageField actionImage; | |
51 | 0 | private String actionImageLocation = "LEFT"; |
52 | ||
53 | private String actionEvent; | |
54 | private Map<String, String> actionParameters; | |
55 | ||
56 | private LightBox lightBoxLookup; | |
57 | private LightBox lightBoxDirectInquiry; | |
58 | ||
59 | private boolean blockValidateDirty; | |
60 | private boolean disabled; | |
61 | private String disabledReason; | |
62 | ||
63 | public ActionField() { | |
64 | 0 | super(); |
65 | ||
66 | 0 | disabled = false; |
67 | 0 | actionParameters = new HashMap<String, String>(); |
68 | 0 | } |
69 | ||
70 | /** | |
71 | * The following initialization is performed: | |
72 | * | |
73 | * <ul> | |
74 | * <li>Set the actionLabel if blank to the Field label</li> | |
75 | * </ul> | |
76 | * | |
77 | * @see org.kuali.rice.krad.uif.component.ComponentBase#performInitialization(org.kuali.rice.krad.uif.view.View, java.lang.Object) | |
78 | */ | |
79 | @Override | |
80 | public void performInitialization(View view, Object model) { | |
81 | 0 | super.performInitialization(view, model); |
82 | ||
83 | 0 | if (StringUtils.isBlank(actionLabel)) { |
84 | 0 | actionLabel = this.getLabel(); |
85 | } | |
86 | 0 | } |
87 | ||
88 | /** | |
89 | * The following finalization is performed: | |
90 | * | |
91 | * <ul> | |
92 | * <li>Add methodToCall action parameter if set and setup event code for | |
93 | * setting action parameters</li> | |
94 | * </ul> | |
95 | * | |
96 | * @see org.kuali.rice.krad.uif.component.ComponentBase#performFinalize(org.kuali.rice.krad.uif.view.View, | |
97 | * java.lang.Object, org.kuali.rice.krad.uif.component.Component) | |
98 | */ | |
99 | @Override | |
100 | public void performFinalize(View view, Object model, Component parent) { | |
101 | 0 | super.performFinalize(view, model, parent); |
102 | //clear alt text to avoid screen reader confusion when using image in button with text | |
103 | 0 | if(actionImage != null && StringUtils.isNotBlank(actionImageLocation) && StringUtils.isNotBlank(actionLabel)){ |
104 | 0 | actionImage.setAltText(""); |
105 | } | |
106 | ||
107 | 0 | if (!actionParameters.containsKey(UifConstants.UrlParams.ACTION_EVENT) && StringUtils.isNotBlank(actionEvent)) { |
108 | 0 | actionParameters.put(UifConstants.UrlParams.ACTION_EVENT, actionEvent); |
109 | } | |
110 | ||
111 | 0 | actionParameters.put(UifConstants.UrlParams.SHOW_HOME, "false"); |
112 | 0 | actionParameters.put(UifConstants.UrlParams.SHOW_HISTORY, "false"); |
113 | ||
114 | 0 | if (StringUtils.isNotBlank(navigateToPageId)) { |
115 | 0 | actionParameters.put(UifParameters.NAVIGATE_TO_PAGE_ID, navigateToPageId); |
116 | 0 | if (StringUtils.isBlank(methodToCall)) { |
117 | 0 | actionParameters.put(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME, |
118 | UifConstants.MethodToCallNames.NAVIGATE); | |
119 | } | |
120 | } | |
121 | ||
122 | 0 | if (!actionParameters.containsKey(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME) |
123 | && StringUtils.isNotBlank(methodToCall)) { | |
124 | 0 | actionParameters.put(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME, methodToCall); |
125 | } | |
126 | ||
127 | // If there is no lightBox then create the on click script | |
128 | 0 | if (lightBoxLookup == null) { |
129 | 0 | String prefixScript = this.getOnClickScript(); |
130 | 0 | if (prefixScript == null) { |
131 | 0 | prefixScript = ""; |
132 | } | |
133 | ||
134 | 0 | boolean validateFormDirty = false; |
135 | 0 | if (view instanceof FormView && !isBlockValidateDirty()) { |
136 | 0 | validateFormDirty = ((FormView) view).isValidateDirty(); |
137 | } | |
138 | ||
139 | 0 | boolean includeDirtyCheckScript = false; |
140 | 0 | String writeParamsScript = ""; |
141 | 0 | if (!actionParameters.isEmpty()) { |
142 | 0 | for (String key : actionParameters.keySet()) { |
143 | 0 | String parameterPath = key; |
144 | 0 | if (!key.equals(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME)) { |
145 | 0 | parameterPath = UifPropertyPaths.ACTION_PARAMETERS + "[" + key + "]"; |
146 | } | |
147 | ||
148 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('" + parameterPath + "' , '" |
149 | + actionParameters.get(key) + "'); "; | |
150 | ||
151 | // Include dirtycheck js function call if the method to call | |
152 | // is refresh, navigate, cancel or close | |
153 | 0 | if (validateFormDirty && !includeDirtyCheckScript |
154 | && key.equals(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME)) { | |
155 | 0 | String keyValue = (String) actionParameters.get(key); |
156 | 0 | if (StringUtils.equals(keyValue, UifConstants.MethodToCallNames.REFRESH) |
157 | || StringUtils.equals(keyValue, UifConstants.MethodToCallNames.NAVIGATE) | |
158 | || StringUtils.equals(keyValue, UifConstants.MethodToCallNames.CANCEL) | |
159 | || StringUtils.equals(keyValue, UifConstants.MethodToCallNames.CLOSE)) { | |
160 | 0 | includeDirtyCheckScript = true; |
161 | } | |
162 | } | |
163 | 0 | } |
164 | } | |
165 | ||
166 | // TODO possibly fix some other way - this is a workaround, prevents | |
167 | // showing history and showing home again on actions which submit | |
168 | // the form | |
169 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('" + UifConstants.UrlParams.SHOW_HISTORY |
170 | + "', '" + "false" + "'); "; | |
171 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('" + UifConstants.UrlParams.SHOW_HOME + "' , '" |
172 | + "false" + "'); "; | |
173 | ||
174 | 0 | if (StringUtils.isBlank(focusOnAfterSubmit)) { |
175 | // if this is blank focus this actionField by default | |
176 | 0 | focusOnAfterSubmit = this.getId(); |
177 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('focusId' , '" + this.getId() + "'); "; |
178 | 0 | } else if (!focusOnAfterSubmit.equalsIgnoreCase(UifConstants.Order.FIRST.toString())) { |
179 | // Use the id passed in | |
180 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('focusId' , '" + focusOnAfterSubmit + "'); "; |
181 | } else { | |
182 | // First input will be focused, must be first field set to empty | |
183 | // string | |
184 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('focusId' , ''); "; |
185 | } | |
186 | ||
187 | 0 | if (StringUtils.isBlank(jumpToIdAfterSubmit) && StringUtils.isBlank(jumpToNameAfterSubmit)) { |
188 | 0 | jumpToIdAfterSubmit = this.getId(); |
189 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('jumpToId' , '" + this.getId() + "'); "; |
190 | 0 | } else if (StringUtils.isNotBlank(jumpToIdAfterSubmit)) { |
191 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('jumpToId' , '" + jumpToIdAfterSubmit |
192 | + "'); "; | |
193 | } else { | |
194 | 0 | writeParamsScript = writeParamsScript + "writeHiddenToForm('jumpToName' , '" + jumpToNameAfterSubmit |
195 | + "'); "; | |
196 | } | |
197 | ||
198 | 0 | String postScript = ""; |
199 | 0 | if (StringUtils.isNotBlank(clientSideJs)) { |
200 | 0 | postScript = clientSideJs; |
201 | } else { | |
202 | 0 | postScript = "writeHiddenToForm('renderFullView' , 'true'); jq('#kualiForm').submit();"; |
203 | } | |
204 | ||
205 | 0 | if (includeDirtyCheckScript) { |
206 | 0 | this.setOnClickScript("e.preventDefault(); if (checkDirty(e) == false) { " + prefixScript |
207 | + writeParamsScript + postScript + " ; } "); | |
208 | } else { | |
209 | 0 | this.setOnClickScript("e.preventDefault();" + prefixScript + writeParamsScript + postScript); |
210 | } | |
211 | ||
212 | 0 | } else { |
213 | // When there is a light box - don't add the on click script as it | |
214 | // will be prevented from executing | |
215 | // Create a script map object which will be written to the form on | |
216 | // click event | |
217 | 0 | StringBuffer sb = new StringBuffer(); |
218 | 0 | sb.append("{"); |
219 | 0 | for (String key : actionParameters.keySet()) { |
220 | 0 | String optionValue = actionParameters.get(key); |
221 | 0 | if (sb.length() > 1) { |
222 | 0 | sb.append(","); |
223 | } | |
224 | 0 | if (!key.equals(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME)) { |
225 | 0 | sb.append("\"" + UifPropertyPaths.ACTION_PARAMETERS + "[" + key + "]" + "\""); |
226 | } else { | |
227 | 0 | sb.append("\"" + key + "\""); |
228 | } | |
229 | 0 | sb.append(":"); |
230 | 0 | sb.append("\"" + optionValue + "\""); |
231 | 0 | } |
232 | 0 | sb.append("}"); |
233 | 0 | lightBoxLookup.setActionParameterMapString(sb.toString()); |
234 | } | |
235 | 0 | } |
236 | ||
237 | /** | |
238 | * @see org.kuali.rice.krad.uif.component.ComponentBase#getComponentsForLifecycle() | |
239 | */ | |
240 | @Override | |
241 | public List<Component> getComponentsForLifecycle() { | |
242 | 0 | List<Component> components = super.getComponentsForLifecycle(); |
243 | ||
244 | 0 | components.add(actionImage); |
245 | 0 | components.add(lightBoxLookup); |
246 | 0 | components.add(lightBoxDirectInquiry); |
247 | ||
248 | 0 | return components; |
249 | } | |
250 | ||
251 | /** | |
252 | * Name of the method that should be called when the action is selected | |
253 | * <p> | |
254 | * For a server side call (clientSideCall is false), gives the name of the | |
255 | * method in the mapped controller that should be invoked when the action is | |
256 | * selected. For client side calls gives the name of the script function | |
257 | * that should be invoked when the action is selected | |
258 | * </p> | |
259 | * | |
260 | * @return String name of method to call | |
261 | */ | |
262 | public String getMethodToCall() { | |
263 | 0 | return this.methodToCall; |
264 | } | |
265 | ||
266 | /** | |
267 | * Setter for the actions method to call | |
268 | * | |
269 | * @param methodToCall | |
270 | */ | |
271 | public void setMethodToCall(String methodToCall) { | |
272 | 0 | this.methodToCall = methodToCall; |
273 | 0 | } |
274 | ||
275 | /** | |
276 | * Label text for the action | |
277 | * <p> | |
278 | * The label text is used by the template renderers to give a human readable | |
279 | * label for the action. For buttons this generally is the button text, | |
280 | * while for an action link it would be the links displayed text | |
281 | * </p> | |
282 | * | |
283 | * @return String label for action | |
284 | */ | |
285 | public String getActionLabel() { | |
286 | 0 | return this.actionLabel; |
287 | } | |
288 | ||
289 | /** | |
290 | * Setter for the actions label | |
291 | * | |
292 | * @param actionLabel | |
293 | */ | |
294 | public void setActionLabel(String actionLabel) { | |
295 | 0 | this.actionLabel = actionLabel; |
296 | 0 | } |
297 | ||
298 | /** | |
299 | * Image to use for the action | |
300 | * <p> | |
301 | * When the action image field is set (and render is true) the image will be | |
302 | * used to present the action as opposed to the default (input submit). For | |
303 | * action link templates the image is used for the link instead of the | |
304 | * action link text | |
305 | * </p> | |
306 | * | |
307 | * @return ImageField action image | |
308 | */ | |
309 | public ImageField getActionImage() { | |
310 | 0 | return this.actionImage; |
311 | } | |
312 | ||
313 | /** | |
314 | * Setter for the action image field | |
315 | * | |
316 | * @param actionImage | |
317 | */ | |
318 | public void setActionImage(ImageField actionImage) { | |
319 | 0 | this.actionImage = actionImage; |
320 | 0 | } |
321 | ||
322 | /** | |
323 | * For an <code>ActionField</code> that is part of a | |
324 | * <code>NavigationGroup</code, the navigate to page id can be set to | |
325 | * configure the page that should be navigated to when the action is | |
326 | * selected | |
327 | * <p> | |
328 | * Support exists in the <code>UifControllerBase</code> for handling | |
329 | * navigation between pages | |
330 | * </p> | |
331 | * | |
332 | * @return String id of page that should be rendered when the action item is | |
333 | * selected | |
334 | */ | |
335 | public String getNavigateToPageId() { | |
336 | 0 | return this.navigateToPageId; |
337 | } | |
338 | ||
339 | /** | |
340 | * Setter for the navigate to page id | |
341 | * | |
342 | * @param navigateToPageId | |
343 | */ | |
344 | public void setNavigateToPageId(String navigateToPageId) { | |
345 | 0 | this.navigateToPageId = navigateToPageId; |
346 | 0 | actionParameters.put(UifParameters.NAVIGATE_TO_PAGE_ID, navigateToPageId); |
347 | 0 | this.methodToCall = UifConstants.MethodToCallNames.NAVIGATE; |
348 | 0 | } |
349 | ||
350 | /** | |
351 | * Name of the event that will be set when the action is invoked | |
352 | * | |
353 | * <p> | |
354 | * Action events can be looked at by the view or components in order to render differently depending on | |
355 | * the action requested. | |
356 | * </p> | |
357 | * | |
358 | * @return String action event name | |
359 | * @see org.kuali.rice.krad.uif.UifConstants.ActionEvents | |
360 | */ | |
361 | public String getActionEvent() { | |
362 | 0 | return actionEvent; |
363 | } | |
364 | ||
365 | /** | |
366 | * Setter for the action event | |
367 | * | |
368 | * @param actionEvent | |
369 | */ | |
370 | public void setActionEvent(String actionEvent) { | |
371 | 0 | this.actionEvent = actionEvent; |
372 | 0 | } |
373 | ||
374 | /** | |
375 | * Parameters that should be sent when the action is invoked | |
376 | * <p> | |
377 | * Action renderer will decide how the parameters are sent for the action | |
378 | * (via script generated hiddens, or script parameters, ...) | |
379 | * </p> | |
380 | * <p> | |
381 | * Can be set by other components such as the <code>CollectionGroup</code> | |
382 | * to provide the context the action is in (such as the collection name and | |
383 | * line the action applies to) | |
384 | * </p> | |
385 | * | |
386 | * @return Map<String, String> action parameters | |
387 | */ | |
388 | public Map<String, String> getActionParameters() { | |
389 | 0 | return this.actionParameters; |
390 | } | |
391 | ||
392 | /** | |
393 | * Setter for the action parameters | |
394 | * | |
395 | * @param actionParameters | |
396 | */ | |
397 | public void setActionParameters(Map<String, String> actionParameters) { | |
398 | 0 | this.actionParameters = actionParameters; |
399 | 0 | } |
400 | ||
401 | /** | |
402 | * Convenience method to add a parameter to the action parameters Map | |
403 | * | |
404 | * @param parameterName | |
405 | * - name of parameter to add | |
406 | * @param parameterValue | |
407 | * - value of parameter to add | |
408 | */ | |
409 | public void addActionParameter(String parameterName, String parameterValue) { | |
410 | 0 | if (actionParameters == null) { |
411 | 0 | this.actionParameters = new HashMap<String, String>(); |
412 | } | |
413 | ||
414 | 0 | this.actionParameters.put(parameterName, parameterValue); |
415 | 0 | } |
416 | ||
417 | /** | |
418 | * Get an actionParameter by name | |
419 | */ | |
420 | public String getActionParameter(String parameterName) { | |
421 | ||
422 | 0 | return this.actionParameters.get(parameterName); |
423 | } | |
424 | ||
425 | /** | |
426 | * @see org.kuali.rice.krad.uif.component.ComponentBase#getSupportsOnClick() | |
427 | */ | |
428 | @Override | |
429 | public boolean getSupportsOnClick() { | |
430 | 0 | return true; |
431 | } | |
432 | ||
433 | /** | |
434 | * Setter for the light box lookup widget | |
435 | * | |
436 | * @param lightBoxLookup | |
437 | * <code>LightBoxLookup</code> widget to set | |
438 | */ | |
439 | public void setLightBoxLookup(LightBox lightBoxLookup) { | |
440 | 0 | this.lightBoxLookup = lightBoxLookup; |
441 | 0 | } |
442 | ||
443 | /** | |
444 | * LightBoxLookup widget for the field | |
445 | * <p> | |
446 | * The light box lookup widget will change the lookup behaviour to open the | |
447 | * lookup in a light box. | |
448 | * </p> | |
449 | * | |
450 | * @return the <code>DirectInquiry</code> field DirectInquiry | |
451 | */ | |
452 | public LightBox getLightBoxLookup() { | |
453 | 0 | return lightBoxLookup; |
454 | } | |
455 | ||
456 | /** | |
457 | * @return the jumpToIdAfterSubmit | |
458 | */ | |
459 | public String getJumpToIdAfterSubmit() { | |
460 | 0 | return this.jumpToIdAfterSubmit; |
461 | } | |
462 | ||
463 | /** | |
464 | * The id to jump to in the next page, the element with this id will be | |
465 | * jumped to automatically when the new page is retrieved after a submit. | |
466 | * Using "TOP" or "BOTTOM" will jump to the top or the bottom of the | |
467 | * resulting page. Passing in nothing for both jumpToIdAfterSubmit and | |
468 | * jumpToNameAfterSubmit will result in this ActionField being jumped to by | |
469 | * default if it is present on the new page. WARNING: jumpToIdAfterSubmit | |
470 | * always takes precedence over jumpToNameAfterSubmit, if set. | |
471 | * | |
472 | * @param jumpToIdAfterSubmit | |
473 | * the jumpToIdAfterSubmit to set | |
474 | */ | |
475 | public void setJumpToIdAfterSubmit(String jumpToIdAfterSubmit) { | |
476 | 0 | this.jumpToIdAfterSubmit = jumpToIdAfterSubmit; |
477 | 0 | } |
478 | ||
479 | /** | |
480 | * The name to jump to in the next page, the element with this name will be | |
481 | * jumped to automatically when the new page is retrieved after a submit. | |
482 | * Passing in nothing for both jumpToIdAfterSubmit and jumpToNameAfterSubmit | |
483 | * will result in this ActionField being jumped to by default if it is | |
484 | * present on the new page. WARNING: jumpToIdAfterSubmit always takes | |
485 | * precedence over jumpToNameAfterSubmit, if set. | |
486 | * | |
487 | * @return the jumpToNameAfterSubmit | |
488 | */ | |
489 | public String getJumpToNameAfterSubmit() { | |
490 | 0 | return this.jumpToNameAfterSubmit; |
491 | } | |
492 | ||
493 | /** | |
494 | * @param jumpToNameAfterSubmit | |
495 | * the jumpToNameAfterSubmit to set | |
496 | */ | |
497 | public void setJumpToNameAfterSubmit(String jumpToNameAfterSubmit) { | |
498 | 0 | this.jumpToNameAfterSubmit = jumpToNameAfterSubmit; |
499 | 0 | } |
500 | ||
501 | /** | |
502 | * The id of the field to place focus on in the new page after the new page | |
503 | * is retrieved. Passing in "FIRST" will focus on the first visible input | |
504 | * element on the form. Passing in the empty string will result in this | |
505 | * ActionField being focused. | |
506 | * | |
507 | * @return the focusOnAfterSubmit | |
508 | */ | |
509 | public String getFocusOnAfterSubmit() { | |
510 | 0 | return this.focusOnAfterSubmit; |
511 | } | |
512 | ||
513 | /** | |
514 | * @param focusOnAfterSubmit | |
515 | * the focusOnAfterSubmit to set | |
516 | */ | |
517 | public void setFocusOnAfterSubmit(String focusOnAfterSubmit) { | |
518 | 0 | this.focusOnAfterSubmit = focusOnAfterSubmit; |
519 | 0 | } |
520 | ||
521 | /** | |
522 | * Client side javascript to be executed when this actionField is clicked. | |
523 | * This overrides the default action for this ActionField so the method | |
524 | * called must explicitly submit, navigate, etc. through js, if necessary. | |
525 | * In addition, this js occurs AFTER onClickScripts set on this field, it | |
526 | * will be the last script executed by the click event. Sidenote: This js is | |
527 | * always called after hidden actionParameters and methodToCall methods are | |
528 | * written by the js to the html form. | |
529 | * | |
530 | * @return the clientSideJs | |
531 | */ | |
532 | public String getClientSideJs() { | |
533 | 0 | return this.clientSideJs; |
534 | } | |
535 | ||
536 | /** | |
537 | * @param clientSideJs | |
538 | * the clientSideJs to set | |
539 | */ | |
540 | public void setClientSideJs(String clientSideJs) { | |
541 | 0 | if (!StringUtils.endsWith(clientSideJs, ";")) { |
542 | 0 | clientSideJs = clientSideJs + ";"; |
543 | } | |
544 | 0 | this.clientSideJs = clientSideJs; |
545 | 0 | } |
546 | ||
547 | /** | |
548 | * Setter for the light box direct inquiry widget | |
549 | * | |
550 | * @param lightBoxDirectInquiry | |
551 | * <code>LightBox</code> widget to set | |
552 | */ | |
553 | public void setLightBoxDirectInquiry(LightBox lightBoxDirectInquiry) { | |
554 | 0 | this.lightBoxDirectInquiry = lightBoxDirectInquiry; |
555 | 0 | } |
556 | ||
557 | /** | |
558 | * LightBox widget for the field | |
559 | * <p> | |
560 | * The light box widget will change the direct inquiry behaviour to open up | |
561 | * in a light box. | |
562 | * </p> | |
563 | * | |
564 | * @return the <code>LightBox</code> field LightBox | |
565 | */ | |
566 | public LightBox getLightBoxDirectInquiry() { | |
567 | 0 | return lightBoxDirectInquiry; |
568 | } | |
569 | ||
570 | /** | |
571 | * @param blockValidateDirty | |
572 | * the blockValidateDirty to set | |
573 | */ | |
574 | public void setBlockValidateDirty(boolean blockValidateDirty) { | |
575 | 0 | this.blockValidateDirty = blockValidateDirty; |
576 | 0 | } |
577 | ||
578 | /** | |
579 | * @return the blockValidateDirty | |
580 | */ | |
581 | public boolean isBlockValidateDirty() { | |
582 | 0 | return blockValidateDirty; |
583 | } | |
584 | ||
585 | /** | |
586 | * Indicates whether the action (input or button) is disabled (doesn't allow interaction) | |
587 | * | |
588 | * @return boolean true if the action field is disabled, false if not | |
589 | */ | |
590 | public boolean isDisabled() { | |
591 | 0 | return disabled; |
592 | } | |
593 | ||
594 | /** | |
595 | * If the action field is disabled, gives a reason for why which will be displayed as a tooltip | |
596 | * on the action field (button) | |
597 | * | |
598 | * @return String disabled reason text | |
599 | * @see {@link #isDisabled()} | |
600 | */ | |
601 | public String getDisabledReason() { | |
602 | 0 | return disabledReason; |
603 | } | |
604 | ||
605 | /** | |
606 | * Setter for the disabled reason text | |
607 | * | |
608 | * @param disabledReason | |
609 | */ | |
610 | public void setDisabledReason(String disabledReason) { | |
611 | 0 | this.disabledReason = disabledReason; |
612 | 0 | } |
613 | ||
614 | /** | |
615 | * Setter for the disabled indicator | |
616 | * | |
617 | * @param disabled | |
618 | */ | |
619 | public void setDisabled(boolean disabled) { | |
620 | 0 | this.disabled = disabled; |
621 | 0 | } |
622 | ||
623 | public String getActionImageLocation() { | |
624 | 0 | return actionImageLocation; |
625 | } | |
626 | ||
627 | /** | |
628 | * Set to TOP, BOTTOM, LEFT, RIGHT to position image at that location within the button. | |
629 | * For the subclass ActionLinkField only LEFT and RIGHT are allowed. When set to blank/null, the image | |
630 | * itself will be the ActionField, if no value is set the default is ALWAYS LEFT, you must explicitly set | |
631 | * blank/null to use ONLY the image as the ActionField. | |
632 | * @return | |
633 | */ | |
634 | public void setActionImageLocation(String actionImageLocation) { | |
635 | 0 | this.actionImageLocation = actionImageLocation; |
636 | 0 | } |
637 | } |