View Javadoc

1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.myfaces.tobago.component;
21  
22  import javax.faces.context.FacesContext;
23  import org.apache.myfaces.tobago.context.Markup;
24  import org.apache.myfaces.tobago.internal.component.AbstractUICommand;
25  import org.apache.myfaces.tobago.layout.Display;
26  import org.apache.myfaces.tobago.layout.Measure;
27  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
28  import org.apache.myfaces.tobago.internal.util.StringUtils;
29  import org.apache.myfaces.tobago.internal.util.Deprecation;
30  import org.apache.myfaces.tobago.renderkit.MarginValues;
31  import org.apache.myfaces.tobago.renderkit.SpacingValues;
32  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.ArrayList;
36  import java.util.List;
37  import javax.el.MethodExpression;
38  import javax.el.ValueExpression;
39  
40  /** 
41    * UIComponent class, generated from template {@code component2.0.stg} with class
42    * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectBooleanCommandTagDeclaration}.
43   */
44  public class UISelectBooleanCommand
45      extends AbstractUICommand implements SupportsMarkup {
46  
47    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SelectBooleanCommand";
48  
49    public static final String COMPONENT_FAMILY = "";
50  
51    private org.apache.myfaces.tobago.context.Markup currentMarkup;
52  
53    enum PropertyKeys {
54      markup,
55      marginLeft,
56      link,
57      minimumHeight,
58      height,
59      minimumWidth,
60      rowSpan,
61      left,
62      columnSpan,
63      top,
64      maximumHeight,
65      currentWidth,
66      marginTop,
67      width,
68      marginRight,
69      jsfResource,
70      resource,
71      currentHeight,
72      preferredHeight,
73      transition,
74      display,
75      label,
76      maximumWidth,
77      preferredWidth,
78      marginBottom,
79      verticalIndex,
80      omit,
81      renderedPartially,
82      target,
83      onclick,
84      horizontalIndex,
85      disabled,
86    }
87  
88    public String getFamily() {
89      return COMPONENT_FAMILY;
90    }
91  
92  
93    public org.apache.myfaces.tobago.context.Markup getMarkup() {
94      Object object = getStateHelper().eval(PropertyKeys.markup);
95      if (object != null) {
96        return Markup.valueOf(object);
97      }
98      return null;
99    }
100 
101   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
102     getStateHelper().put(PropertyKeys.markup, markup);
103   }
104 
105   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
106     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
107     if (object != null) {
108        return Measure.valueOf(object);
109     }
110     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
111   }
112 
113   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
114     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
115   }
116 
117   /**
118   Link to an arbitrary URL, either an internal link or an external link.
119 
120    <dl>
121      <dt>internal absolute link</dt>
122      <dd>Starts with a slash '/' character. The context path will be added.
123          A session id will be added, if needed.</dd>
124      <dt>external link</dt>
125      <dd>Starts with protocol followed by a colon ':' character.
126          The link will not be modified.</dd>
127      <dt>internal relative link</dt>
128      <dd>Any other strings. A session id will be added, if needed.</dd>
129    </dl>
130 
131   */
132   public java.lang.String getLink() {
133     return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
134   }
135 
136   public void setLink(java.lang.String link) {
137     getStateHelper().put(PropertyKeys.link, link);
138   }
139 
140   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
141     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
142     if (object != null) {
143        return Measure.valueOf(object);
144     }
145     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
146   }
147 
148   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
149     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
150   }
151 
152   /**
153   This value will usually be set by the layout manager.
154 
155   */
156   public org.apache.myfaces.tobago.layout.Measure getHeight() {
157     Object object = getStateHelper().eval(PropertyKeys.height);
158     if (object != null) {
159        return Measure.valueOf(object);
160     }
161     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
162   }
163 
164   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
165     getStateHelper().put(PropertyKeys.height, height);
166   }
167 
168   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
169     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
170     if (object != null) {
171        return Measure.valueOf(object);
172     }
173     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
174   }
175 
176   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
177     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
178   }
179 
180   public java.lang.Integer getRowSpan() {
181     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
182     if (value != null) {
183       return value.intValue();
184     }
185     return 1;
186   }
187 
188   public void setRowSpan(java.lang.Integer rowSpan) {
189     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
190   }
191 
192   /**
193   This value will usually be set by the layout manager.
194 
195   */
196   public org.apache.myfaces.tobago.layout.Measure getLeft() {
197     Object object = getStateHelper().eval(PropertyKeys.left);
198     if (object != null) {
199        return Measure.valueOf(object);
200     }
201     return null;
202   }
203 
204   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
205     getStateHelper().put(PropertyKeys.left, left);
206   }
207 
208   public java.lang.Integer getColumnSpan() {
209     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
210     if (value != null) {
211       return value.intValue();
212     }
213     return 1;
214   }
215 
216   public void setColumnSpan(java.lang.Integer columnSpan) {
217     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
218   }
219 
220   /**
221   This value will usually be set by the layout manager.
222 
223   */
224   public org.apache.myfaces.tobago.layout.Measure getTop() {
225     Object object = getStateHelper().eval(PropertyKeys.top);
226     if (object != null) {
227        return Measure.valueOf(object);
228     }
229     return null;
230   }
231 
232   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
233     getStateHelper().put(PropertyKeys.top, top);
234   }
235 
236   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
237     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
238     if (object != null) {
239        return Measure.valueOf(object);
240     }
241     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
242   }
243 
244   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
245     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
246   }
247 
248   /**
249   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
250 
251   */
252   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
253     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
254     if (object != null) {
255        return Measure.valueOf(object);
256     }
257     return getWidth();
258   }
259 
260   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
261     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
262   }
263 
264   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
265     Object object = getStateHelper().eval(PropertyKeys.marginTop);
266     if (object != null) {
267        return Measure.valueOf(object);
268     }
269     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
270   }
271 
272   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
273     getStateHelper().put(PropertyKeys.marginTop, marginTop);
274   }
275 
276   /**
277   This value will usually be set by the layout manager.
278 
279   */
280   public org.apache.myfaces.tobago.layout.Measure getWidth() {
281     Object object = getStateHelper().eval(PropertyKeys.width);
282     if (object != null) {
283        return Measure.valueOf(object);
284     }
285     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
286   }
287 
288   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
289     getStateHelper().put(PropertyKeys.width, width);
290   }
291 
292   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
293     Object object = getStateHelper().eval(PropertyKeys.marginRight);
294     if (object != null) {
295        return Measure.valueOf(object);
296     }
297     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
298   }
299 
300   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
301     getStateHelper().put(PropertyKeys.marginRight, marginRight);
302   }
303 
304   /**
305   Flag indicating that the resource referenced by the resource attribute is a jsf resource.
306    That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
307    /faces/*). Default is false.
308   <br />Default: <code>false</code>
309   */
310   public boolean isJsfResource() {
311     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.jsfResource);
312     if (bool != null) {
313       return bool;
314     }
315     return false;
316   }
317 
318   public void setJsfResource(boolean jsfResource) {
319     getStateHelper().put(PropertyKeys.jsfResource, jsfResource);
320   }
321 
322   /**
323   Link to an internal resource.
324    Resources will be processed by the resource management.
325    E. g. define help.html and it will be served help_es.html or help_de.html if available.
326    For JSF-Pages you have to set the jsfResource attribute.
327 
328   */
329   public java.lang.String getResource() {
330     return (java.lang.String) getStateHelper().eval(PropertyKeys.resource);
331   }
332 
333   public void setResource(java.lang.String resource) {
334     getStateHelper().put(PropertyKeys.resource, resource);
335   }
336 
337   /**
338   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
339 
340   */
341   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
342     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
343     if (object != null) {
344        return Measure.valueOf(object);
345     }
346     return getHeight();
347   }
348 
349   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
350     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
351   }
352 
353   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
354     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
355     if (object != null) {
356        return Measure.valueOf(object);
357     }
358     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
359   }
360 
361   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
362     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
363   }
364 
365   /**
366   Specify, if the command calls an JSF-Action.
367    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
368   <br />Default: <code>true</code>
369   */
370   public boolean isTransition() {
371     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
372     if (bool != null) {
373       return bool;
374     }
375     return true;
376   }
377 
378   public void setTransition(boolean transition) {
379     getStateHelper().put(PropertyKeys.transition, transition);
380   }
381 
382   /**
383   This attribute is for internal use only.
384 
385   */
386   public org.apache.myfaces.tobago.layout.Display getDisplay() {
387     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
388   }
389 
390   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
391     getStateHelper().put(PropertyKeys.display, display);
392   }
393 
394   /**
395   Text value to display as label.
396    If text contains an underscore the next character is used as accesskey (if configured so and possible).
397 
398   */
399   public java.lang.String getLabel() {
400     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
401   }
402 
403   public void setLabel(java.lang.String label) {
404     getStateHelper().put(PropertyKeys.label, label);
405   }
406 
407   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
408     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
409     if (object != null) {
410        return Measure.valueOf(object);
411     }
412     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
413   }
414 
415   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
416     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
417   }
418 
419   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
420     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
421     if (object != null) {
422        return Measure.valueOf(object);
423     }
424     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
425   }
426 
427   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
428     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
429   }
430 
431   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
432     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
433     if (object != null) {
434        return Measure.valueOf(object);
435     }
436     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
437   }
438 
439   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
440     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
441   }
442 
443   /**
444   This attribute is for internal use only.
445 
446   */
447   public java.lang.Integer getVerticalIndex() {
448     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
449     if (value != null) {
450       return value.intValue();
451     }
452     return null;
453   }
454 
455   public void setVerticalIndex(java.lang.Integer verticalIndex) {
456     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
457   }
458 
459   /**
460   Flag indicating that the action of this element, will not be executed from client side
461    (e. g. when the user clicks a button.
462    When setting this value to true, the action will not be executed by the Tobago, but it can executed
463    by JavaScript.
464    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
465    In this case you usually don't want a submit with a full reload of the page.
466   <br />Default: <code>false</code>
467   */
468   public boolean isOmit() {
469     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
470     if (bool != null) {
471       return bool;
472     }
473     return false;
474   }
475 
476   public void setOmit(boolean omit) {
477     getStateHelper().put(PropertyKeys.omit, omit);
478   }
479 
480   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
481     if (currentMarkup != null) {
482       return currentMarkup;
483     }
484     return null;
485   }
486 
487   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
488     this.currentMarkup = currentMarkup;
489   }
490 
491   /**
492   <p>
493    Indicate the partially rendered components in a case of a submit.
494    </p>
495    <p>
496    The search depends on the number of prefixed colons in the relativeId:
497    <dl>
498      <dd>number of prefixed colons == 0</dd>
499      <dt>fully relative</dt>
500      <dd>number of prefixed colons == 1</dd>
501      <dt>absolute (still normal findComponent syntax)</dt>
502      <dd>number of prefixed colons == 2</dd>
503      <dt>search in the current naming container (same as 0 colons)</dt>
504      <dd>number of prefixed colons == 3</dd>
505      <dt>search in the parent naming container of the current naming container</dt>
506      <dd>number of prefixed colons > 3</dd>
507      <dt>go to the next parent naming container for each additional colon</dt>
508    </dl>
509    </p>
510    <p>
511    If a literal is specified: to use more than one identifier the identifiers must be space delimited.
512    </p>
513    <p>
514    Using this in a UISheet or UITabGroup component this list indicates components to update when calling
515    internal AJAX requests like sort or paging commands.
516    Don't forget to add the sheet-id or tagGroup-id in that case, if needed.
517    </p>
518    <p>
519    You can also use
520 
521   */
522   public String[] getRenderedPartially() {
523     Object strArray = getStateHelper().eval(PropertyKeys.renderedPartially);
524     if (strArray != null) {
525       if (strArray instanceof String[]) {
526         return (String[]) strArray;
527       } else if (strArray instanceof String) {
528         String[] strings = StringUtils.split((String) strArray, ", ");
529         List<String> result = new ArrayList<String>(strings.length);
530         for (String string : strings) {
531           if (string.trim().length() != 0) {
532             result.add(string.trim());
533           }
534         }
535         return result.toArray(new String[result.size()]);
536       } else if (strArray == null) {
537         return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
538       } else {
539         return new String[]{strArray.toString()};
540       }
541     }
542     return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
543   }
544 
545   public void setRenderedPartially(String[] renderedPartially) {
546     getStateHelper().put(PropertyKeys.renderedPartially, renderedPartially);
547   }
548 
549   /**
550   Name of a frame where the resource retrieved via this hyperlink is to be
551    displayed.
552 
553   */
554   public java.lang.String getTarget() {
555     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
556   }
557 
558   public void setTarget(java.lang.String target) {
559     getStateHelper().put(PropertyKeys.target, target);
560   }
561 
562   /**
563   Script to be invoked when clicked
564 
565   */
566   public java.lang.String getOnclick() {
567     return (java.lang.String) getStateHelper().eval(PropertyKeys.onclick);
568   }
569 
570   public void setOnclick(java.lang.String onclick) {
571     getStateHelper().put(PropertyKeys.onclick, onclick);
572   }
573 
574   /**
575   This attribute is for internal use only.
576 
577   */
578   public java.lang.Integer getHorizontalIndex() {
579     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
580     if (value != null) {
581       return value.intValue();
582     }
583     return null;
584   }
585 
586   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
587     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
588   }
589 
590   /**
591   Flag indicating that this element is disabled.
592   <br />Default: <code>false</code>
593   */
594   public boolean isDisabled() {
595     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
596     if (bool != null) {
597       return bool;
598     }
599     return false;
600   }
601 
602   public void setDisabled(boolean disabled) {
603     getStateHelper().put(PropertyKeys.disabled, disabled);
604   }
605 
606   public Object saveState(FacesContext context) {
607     currentMarkup = null;
608     return super.saveState(context);
609   }
610 
611 }