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 SupportsAccessKey, 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      minimumHeight,
60      tip,
61      height,
62      minimumWidth,
63      rowSpan,
64      left,
65      columnSpan,
66      maximumHeight,
67      top,
68      currentWidth,
69      marginTop,
70      width,
71      marginRight,
72      currentHeight,
73      preferredHeight,
74      display,
75      maximumWidth,
76      preferredWidth,
77      marginBottom,
78      verticalIndex,
79      horizontalIndex,
80    }
81  
82    public String getFamily() {
83      return COMPONENT_FAMILY;
84    }
85  
86  
87    public org.apache.myfaces.tobago.context.Markup getMarkup() {
88      Object object = getStateHelper().eval(PropertyKeys.markup);
89      if (object != null) {
90        return Markup.valueOf(object);
91      }
92      return null;
93    }
94  
95    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
96      getStateHelper().put(PropertyKeys.markup, markup);
97    }
98  
99    /**
100   The access key of this control.
101 
102   */
103   public java.lang.Character getAccessKey() {
104     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
105   }
106 
107   public void setAccessKey(java.lang.Character accessKey) {
108     getStateHelper().put(PropertyKeys.accessKey, accessKey);
109   }
110 
111   /**
112   Id of the component, this is related to.
113 
114   */
115   public java.lang.String getFor() {
116     return (java.lang.String) getStateHelper().eval(PropertyKeys.forComponent);
117   }
118 
119   public void setFor(java.lang.String forComponent) {
120     getStateHelper().put(PropertyKeys.forComponent, forComponent);
121   }
122 
123   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
124     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
125     if (object != null) {
126        return Measure.valueOf(object);
127     }
128     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
129   }
130 
131   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
132     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
133   }
134 
135   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
136     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
137     if (object != null) {
138        return Measure.valueOf(object);
139     }
140     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
141   }
142 
143   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
144     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
145   }
146 
147   /**
148   Text value to display as tooltip.
149 
150   */
151   public java.lang.String getTip() {
152     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
153   }
154 
155   public void setTip(java.lang.String tip) {
156     getStateHelper().put(PropertyKeys.tip, tip);
157   }
158 
159   /**
160   This value will usually be set by the layout manager.
161 
162   */
163   public org.apache.myfaces.tobago.layout.Measure getHeight() {
164     Object object = getStateHelper().eval(PropertyKeys.height);
165     if (object != null) {
166        return Measure.valueOf(object);
167     }
168     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
169   }
170 
171   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
172     getStateHelper().put(PropertyKeys.height, height);
173   }
174 
175   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
176     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
177     if (object != null) {
178        return Measure.valueOf(object);
179     }
180     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
181   }
182 
183   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
184     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
185   }
186 
187   public java.lang.Integer getRowSpan() {
188     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
189     if (value != null) {
190       return value.intValue();
191     }
192     return 1;
193   }
194 
195   public void setRowSpan(java.lang.Integer rowSpan) {
196     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
197   }
198 
199   /**
200   This value will usually be set by the layout manager.
201 
202   */
203   public org.apache.myfaces.tobago.layout.Measure getLeft() {
204     Object object = getStateHelper().eval(PropertyKeys.left);
205     if (object != null) {
206        return Measure.valueOf(object);
207     }
208     return null;
209   }
210 
211   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
212     getStateHelper().put(PropertyKeys.left, left);
213   }
214 
215   public java.lang.Integer getColumnSpan() {
216     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
217     if (value != null) {
218       return value.intValue();
219     }
220     return 1;
221   }
222 
223   public void setColumnSpan(java.lang.Integer columnSpan) {
224     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
225   }
226 
227   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
228     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
229     if (object != null) {
230        return Measure.valueOf(object);
231     }
232     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
233   }
234 
235   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
236     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
237   }
238 
239   /**
240   This value will usually be set by the layout manager.
241 
242   */
243   public org.apache.myfaces.tobago.layout.Measure getTop() {
244     Object object = getStateHelper().eval(PropertyKeys.top);
245     if (object != null) {
246        return Measure.valueOf(object);
247     }
248     return null;
249   }
250 
251   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
252     getStateHelper().put(PropertyKeys.top, top);
253   }
254 
255   /**
256   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
257 
258   */
259   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
260     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
261     if (object != null) {
262        return Measure.valueOf(object);
263     }
264     return getWidth();
265   }
266 
267   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
268     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
269   }
270 
271   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
272     Object object = getStateHelper().eval(PropertyKeys.marginTop);
273     if (object != null) {
274        return Measure.valueOf(object);
275     }
276     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
277   }
278 
279   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
280     getStateHelper().put(PropertyKeys.marginTop, marginTop);
281   }
282 
283   /**
284   This value will usually be set by the layout manager.
285 
286   */
287   public org.apache.myfaces.tobago.layout.Measure getWidth() {
288     Object object = getStateHelper().eval(PropertyKeys.width);
289     if (object != null) {
290        return Measure.valueOf(object);
291     }
292     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
293   }
294 
295   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
296     getStateHelper().put(PropertyKeys.width, width);
297   }
298 
299   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
300     Object object = getStateHelper().eval(PropertyKeys.marginRight);
301     if (object != null) {
302        return Measure.valueOf(object);
303     }
304     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
305   }
306 
307   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
308     getStateHelper().put(PropertyKeys.marginRight, marginRight);
309   }
310 
311   /**
312   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
313 
314   */
315   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
316     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
317     if (object != null) {
318        return Measure.valueOf(object);
319     }
320     return getHeight();
321   }
322 
323   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
324     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
325   }
326 
327   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
328     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
329     if (object != null) {
330        return Measure.valueOf(object);
331     }
332     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
333   }
334 
335   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
336     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
337   }
338 
339   /**
340   This attribute is for internal use only.
341 
342   */
343   public org.apache.myfaces.tobago.layout.Display getDisplay() {
344     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
345   }
346 
347   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
348     getStateHelper().put(PropertyKeys.display, display);
349   }
350 
351   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
352     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
353     if (object != null) {
354        return Measure.valueOf(object);
355     }
356     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
357   }
358 
359   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
360     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
361   }
362 
363   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
364     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
365     if (object != null) {
366        return Measure.valueOf(object);
367     }
368     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
369   }
370 
371   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
372     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
373   }
374 
375   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
376     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
377     if (object != null) {
378        return Measure.valueOf(object);
379     }
380     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
381   }
382 
383   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
384     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
385   }
386 
387   /**
388   This attribute is for internal use only.
389 
390   */
391   public java.lang.Integer getVerticalIndex() {
392     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
393     if (value != null) {
394       return value.intValue();
395     }
396     return null;
397   }
398 
399   public void setVerticalIndex(java.lang.Integer verticalIndex) {
400     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
401   }
402 
403   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
404     if (currentMarkup != null) {
405       return currentMarkup;
406     }
407     return null;
408   }
409 
410   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
411     this.currentMarkup = currentMarkup;
412   }
413 
414   /**
415   This attribute is for internal use only.
416 
417   */
418   public java.lang.Integer getHorizontalIndex() {
419     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
420     if (value != null) {
421       return value.intValue();
422     }
423     return null;
424   }
425 
426   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
427     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
428   }
429 
430   public Object saveState(FacesContext context) {
431     currentMarkup = null;
432     return super.saveState(context);
433   }
434 
435 }