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