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