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.AbstractUILabel;
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 label component.
42    * UIComponent class, generated from template {@code component2.0.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.LabelTagDeclaration}.
44   */
45  public class UILabel
46      extends AbstractUILabel implements SupportsMarkup {
47  
48    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Label";
49  
50    public static final String COMPONENT_FAMILY = "javax.faces.Output";
51  
52    private org.apache.myfaces.tobago.context.Markup currentMarkup;
53  
54    enum PropertyKeys {
55      markup,
56      accessKey,
57      forComponent,
58      marginLeft,
59      labelWithAccessKey,
60      minimumHeight,
61      tip,
62      height,
63      minimumWidth,
64      inline,
65      rowSpan,
66      left,
67      columnSpan,
68      maximumHeight,
69      top,
70      currentWidth,
71      marginTop,
72      width,
73      marginRight,
74      currentHeight,
75      preferredHeight,
76      display,
77      maximumWidth,
78      preferredWidth,
79      marginBottom,
80      verticalIndex,
81      horizontalIndex,
82    }
83  
84    public String getFamily() {
85      return COMPONENT_FAMILY;
86    }
87  
88  
89    public org.apache.myfaces.tobago.context.Markup getMarkup() {
90      Object object = getStateHelper().eval(PropertyKeys.markup);
91      if (object != null) {
92        return Markup.valueOf(object);
93      }
94      return null;
95    }
96  
97    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
98      getStateHelper().put(PropertyKeys.markup, markup);
99    }
100 
101   /**
102   Deprecated! Has not longer any function.
103 
104   @deprecated*/
105   @Deprecated
106   public java.lang.Character getAccessKey() {
107     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
108   }
109 
110   @Deprecated
111   public void setAccessKey(java.lang.Character accessKey) {
112       Deprecation.LOG.error("The attribute 'accessKey' of 'UILabel' is deprecated. "
113           + "Please refer the documentation for further information.");
114     getStateHelper().put(PropertyKeys.accessKey, accessKey);
115   }
116 
117   /**
118   Id of the component, this is related to.
119 
120   */
121   public java.lang.String getFor() {
122     return (java.lang.String) getStateHelper().eval(PropertyKeys.forComponent);
123   }
124 
125   public void setFor(java.lang.String forComponent) {
126     getStateHelper().put(PropertyKeys.forComponent, forComponent);
127   }
128 
129   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
130     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
131     if (object != null) {
132        return Measure.valueOf(object);
133     }
134     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
135   }
136 
137   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
138     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
139   }
140 
141   /**
142   Deprecated! Use 'label' instead.
143    Text value to display as label.
144    If text contains an underscore the next character overwrites 'accesskey'.
145 
146   @deprecated*/
147   @Deprecated
148   public java.lang.String getLabelWithAccessKey() {
149     return (java.lang.String) getStateHelper().eval(PropertyKeys.labelWithAccessKey);
150   }
151 
152   @Deprecated
153   public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) {
154       Deprecation.LOG.error("The attribute 'labelWithAccessKey' of 'UILabel' is deprecated. "
155           + "Please refer the documentation for further information.");
156     getStateHelper().put(PropertyKeys.labelWithAccessKey, labelWithAccessKey);
157   }
158 
159   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
160     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
161     if (object != null) {
162        return Measure.valueOf(object);
163     }
164     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
165   }
166 
167   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
168     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
169   }
170 
171   /**
172   Text value to display as tooltip.
173 
174   */
175   public java.lang.String getTip() {
176     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
177   }
178 
179   public void setTip(java.lang.String tip) {
180     getStateHelper().put(PropertyKeys.tip, tip);
181   }
182 
183   /**
184   This value will usually be set by the layout manager.
185 
186   */
187   public org.apache.myfaces.tobago.layout.Measure getHeight() {
188     Object object = getStateHelper().eval(PropertyKeys.height);
189     if (object != null) {
190        return Measure.valueOf(object);
191     }
192     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
193   }
194 
195   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
196     getStateHelper().put(PropertyKeys.height, height);
197   }
198 
199   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
200     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
201     if (object != null) {
202        return Measure.valueOf(object);
203     }
204     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
205   }
206 
207   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
208     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
209   }
210 
211   /**
212   Flag indicating this component should rendered as an inline element.
213   <br />Default: <code>false</code>
214   @deprecated*/
215   @Deprecated
216   public boolean isInline() {
217     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.inline);
218     if (bool != null) {
219       return bool;
220     }
221     return false;
222   }
223 
224   @Deprecated
225   public void setInline(boolean inline) {
226       Deprecation.LOG.error("The attribute 'inline' of 'UILabel' is deprecated. "
227           + "Please refer the documentation for further information.");
228     getStateHelper().put(PropertyKeys.inline, inline);
229   }
230 
231   public java.lang.Integer getRowSpan() {
232     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
233     if (value != null) {
234       return value.intValue();
235     }
236     return 1;
237   }
238 
239   public void setRowSpan(java.lang.Integer rowSpan) {
240     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
241   }
242 
243   /**
244   This value will usually be set by the layout manager.
245 
246   */
247   public org.apache.myfaces.tobago.layout.Measure getLeft() {
248     Object object = getStateHelper().eval(PropertyKeys.left);
249     if (object != null) {
250        return Measure.valueOf(object);
251     }
252     return null;
253   }
254 
255   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
256     getStateHelper().put(PropertyKeys.left, left);
257   }
258 
259   public java.lang.Integer getColumnSpan() {
260     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
261     if (value != null) {
262       return value.intValue();
263     }
264     return 1;
265   }
266 
267   public void setColumnSpan(java.lang.Integer columnSpan) {
268     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
269   }
270 
271   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
272     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
273     if (object != null) {
274        return Measure.valueOf(object);
275     }
276     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
277   }
278 
279   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
280     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
281   }
282 
283   /**
284   This value will usually be set by the layout manager.
285 
286   */
287   public org.apache.myfaces.tobago.layout.Measure getTop() {
288     Object object = getStateHelper().eval(PropertyKeys.top);
289     if (object != null) {
290        return Measure.valueOf(object);
291     }
292     return null;
293   }
294 
295   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
296     getStateHelper().put(PropertyKeys.top, top);
297   }
298 
299   /**
300   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
301 
302   */
303   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
304     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
305     if (object != null) {
306        return Measure.valueOf(object);
307     }
308     return getWidth();
309   }
310 
311   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
312     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
313   }
314 
315   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
316     Object object = getStateHelper().eval(PropertyKeys.marginTop);
317     if (object != null) {
318        return Measure.valueOf(object);
319     }
320     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
321   }
322 
323   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
324     getStateHelper().put(PropertyKeys.marginTop, marginTop);
325   }
326 
327   /**
328   This value will usually be set by the layout manager.
329 
330   */
331   public org.apache.myfaces.tobago.layout.Measure getWidth() {
332     Object object = getStateHelper().eval(PropertyKeys.width);
333     if (object != null) {
334        return Measure.valueOf(object);
335     }
336     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
337   }
338 
339   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
340     getStateHelper().put(PropertyKeys.width, width);
341   }
342 
343   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
344     Object object = getStateHelper().eval(PropertyKeys.marginRight);
345     if (object != null) {
346        return Measure.valueOf(object);
347     }
348     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
349   }
350 
351   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
352     getStateHelper().put(PropertyKeys.marginRight, marginRight);
353   }
354 
355   /**
356   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
357 
358   */
359   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
360     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
361     if (object != null) {
362        return Measure.valueOf(object);
363     }
364     return getHeight();
365   }
366 
367   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
368     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
369   }
370 
371   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
372     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
373     if (object != null) {
374        return Measure.valueOf(object);
375     }
376     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
377   }
378 
379   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
380     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
381   }
382 
383   /**
384   This attribute is for internal use only.
385 
386   */
387   public org.apache.myfaces.tobago.layout.Display getDisplay() {
388     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
389   }
390 
391   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
392     getStateHelper().put(PropertyKeys.display, display);
393   }
394 
395   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
396     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
397     if (object != null) {
398        return Measure.valueOf(object);
399     }
400     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
401   }
402 
403   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
404     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
405   }
406 
407   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
408     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
409     if (object != null) {
410        return Measure.valueOf(object);
411     }
412     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
413   }
414 
415   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
416     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
417   }
418 
419   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
420     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
421     if (object != null) {
422        return Measure.valueOf(object);
423     }
424     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
425   }
426 
427   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
428     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
429   }
430 
431   /**
432   This attribute is for internal use only.
433 
434   */
435   public java.lang.Integer getVerticalIndex() {
436     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
437     if (value != null) {
438       return value.intValue();
439     }
440     return null;
441   }
442 
443   public void setVerticalIndex(java.lang.Integer verticalIndex) {
444     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
445   }
446 
447   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
448     if (currentMarkup != null) {
449       return currentMarkup;
450     }
451     return null;
452   }
453 
454   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
455     this.currentMarkup = currentMarkup;
456   }
457 
458   /**
459   This attribute is for internal use only.
460 
461   */
462   public java.lang.Integer getHorizontalIndex() {
463     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
464     if (value != null) {
465       return value.intValue();
466     }
467     return null;
468   }
469 
470   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
471     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
472   }
473 
474   public Object saveState(FacesContext context) {
475     currentMarkup = null;
476     return super.saveState(context);
477   }
478 
479 
480 }