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