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.component.behavior.ClientBehaviorHolder;
23  import javax.faces.context.FacesContext;
24  import org.apache.myfaces.tobago.context.Markup;
25  import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
26  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
27  import org.apache.myfaces.tobago.sanitizer.SanitizeMode;
28  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
29  import org.apache.myfaces.tobago.internal.util.StringUtils;
30  import org.apache.myfaces.tobago.internal.util.Deprecation;
31  import org.apache.myfaces.tobago.component.Tags;
32  import javax.annotation.Generated;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.Arrays;
36  import java.util.ArrayList;
37  import java.util.Collection;
38  import java.util.List;
39  import javax.el.MethodExpression;
40  import javax.el.ValueExpression;
41  
42  /**
43   Renders a text
44    * UIComponent class, generated from template {@code component.stg} with class
45    * {@link org.apache.myfaces.tobago.internal.taglib.component.OutTagDeclaration}.
46   */
47  @Generated("component.stg")
48  public class UIOut
49      extends AbstractUIOut implements ClientBehaviorHolder {
50  
51    public static final String COMPONENT_TYPE = Tags.out.componentType();
52  
53    public static final String COMPONENT_FAMILY = "javax.faces.Output";
54  
55  
56    enum PropertyKeys {
57      markup,
58      compact,
59      labelLayout,
60      label,
61      plain,
62      customClass,
63      keepLineBreaks,
64      tip,
65      createSpan,
66      escape,
67      sanitize,
68    }
69  
70    public String getFamily() {
71      return COMPONENT_FAMILY;
72    }
73  
74  
75    public org.apache.myfaces.tobago.context.Markup getMarkup() {
76      Object object = getStateHelper().eval(PropertyKeys.markup);
77      if (object != null) {
78        return Markup.valueOf(object);
79      }
80      return null;
81    }
82  
83    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
84      getStateHelper().put(PropertyKeys.markup, markup);
85    }
86  
87    /**
88    This attribute is useful if labelLayout=skip is set.
89     Use true, if you want to only render the text (no surrounding tag).
90     Use false, if you enable the possibility to apply styles to the output.
91    <br>Default: <code>false</code>
92    @deprecated*/
93    @Deprecated
94    public boolean isCompact() {
95      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.compact);
96      if (bool != null) {
97        return bool;
98      }
99      return false;
100   }
101 
102   @Deprecated
103   public void setCompact(boolean compact) {
104       Deprecation.LOG.error("The attribute 'compact' of 'UIOut' is deprecated. "
105           + "Please refer the documentation for further information.");
106     getStateHelper().put(PropertyKeys.compact, compact);
107   }
108 
109   /**
110   Defines the position of the label relative to the field.
111    The default is flexLeft, if the label is set, or none, if the label isn't set.
112    Set to 'skip' to avoid surrounding label container.
113    Hint for tc:out: set also compact=true to render only text (without html tags).
114 
115   */
116   public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
117     org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
118     if (labelLayout != null) {
119       return labelLayout;
120     }
121     return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
122   }
123 
124   public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
125     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
126   }
127 
128   /**
129   A localized user presentable label for this component.
130 
131   */
132   public java.lang.String getLabel() {
133     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
134   }
135 
136   public void setLabel(java.lang.String label) {
137     getStateHelper().put(PropertyKeys.label, label);
138   }
139 
140   /**
141   <p><b>Use with caution: Only for special cases!</b></p>
142 
143    <p>This attribute is useful for tc:out if labelLayout=skip is set.
144    Use true, if you want to only render the text (no surrounding tag).
145    Use false, if you enable the possibility to apply styles to the output.</p>
146 
147    <p>For tc:form there will no div tag be rendered. So, the content
148    can be used freely from layout managers.</p>
149 
150    <p>But, no AJAX is possible for components with "plain" set,
151    because there is no client element with an "id" in the DOM.</p>
152   <br>Default: <code>false</code>
153   */
154   public boolean isPlain() {
155     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.plain);
156     if (bool != null) {
157       return bool;
158     }
159     return false;
160   }
161 
162   public void setPlain(boolean plain) {
163     getStateHelper().put(PropertyKeys.plain, plain);
164   }
165 
166   /**
167   Sets a CSS class in its parent, if the parent supports it.
168 
169    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
170 
171    <pre>
172    &lt;tc:in&gt;
173      &lt;tc:style customClass="my-emphasized"/&gt;
174    &lt;/tc:in&gt;
175    </pre>
176 
177    One capability is, to used external CSS libs.
178    <br>
179    This feature should not be used imprudent.
180    Because it might be unstable against changes in the renderered HTML code.
181 
182   */
183   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
184     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
185   }
186 
187   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
188     getStateHelper().put(PropertyKeys.customClass, customClass);
189   }
190 
191   /**
192   Flag indicating that new-line characters will be converted to HTML &lt;br&gt;.
193    This is useful for pre-formatted plain text.
194    This has only an effect, with escape="true".
195   <br>Default: <code>true</code>
196   */
197   public boolean isKeepLineBreaks() {
198     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.keepLineBreaks);
199     if (bool != null) {
200       return bool;
201     }
202     return true;
203   }
204 
205   public void setKeepLineBreaks(boolean keepLineBreaks) {
206     getStateHelper().put(PropertyKeys.keepLineBreaks, keepLineBreaks);
207   }
208 
209   /**
210   Text value to display as tooltip.
211 
212   */
213   public java.lang.String getTip() {
214     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
215   }
216 
217   public void setTip(java.lang.String tip) {
218     getStateHelper().put(PropertyKeys.tip, tip);
219   }
220 
221   /**
222   Indicates that the renderer should create an element in the output language
223    (e. g. an span or div tag around the output text).
224    Use true, if you enable the possibility to apply styles to the output.
225    Use false, if you want to keep the code small (especially inside of sheets).
226   <br>Default: <code>true</code>
227   @deprecated*/
228   @Deprecated
229   public boolean isCreateSpan() {
230     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.createSpan);
231     if (bool != null) {
232       return bool;
233     }
234     return true;
235   }
236 
237   @Deprecated
238   public void setCreateSpan(boolean createSpan) {
239       Deprecation.LOG.error("The attribute 'createSpan' of 'UIOut' is deprecated. "
240           + "Please refer the documentation for further information.");
241     getStateHelper().put(PropertyKeys.createSpan, createSpan);
242   }
243 
244   /**
245   Flag indicating that characters that are
246    sensitive in HTML and XML markup must be escaped.
247   <br>Default: <code>true</code>
248   */
249   public boolean isEscape() {
250     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.escape);
251     if (bool != null) {
252       return bool;
253     }
254     return true;
255   }
256 
257   public void setEscape(boolean escape) {
258     getStateHelper().put(PropertyKeys.escape, escape);
259   }
260 
261   /**
262   Should HTML content sanitized?
263    The effect of sanitizing depends on the configuration.
264    The value "auto" means, that sanitizing take place for
265    <ul>
266      <li>tc:out when escape="false" or</li>
267      <li>tc:textarea when attribute data-html-editor is set,</li>
268    </ul>
269    because that are the critical parts.
270   <br>Default: <code>auto</code><br>Allowed Values: <code>auto,never</code>
271   */
272   public org.apache.myfaces.tobago.sanitizer.SanitizeMode getSanitize() {
273     org.apache.myfaces.tobago.sanitizer.SanitizeMode sanitize = (org.apache.myfaces.tobago.sanitizer.SanitizeMode) getStateHelper().eval(PropertyKeys.sanitize);
274     if (sanitize != null) {
275       return sanitize;
276     }
277     return org.apache.myfaces.tobago.sanitizer.SanitizeMode.auto;
278   }
279 
280   public void setSanitize(org.apache.myfaces.tobago.sanitizer.SanitizeMode sanitize) {
281     getStateHelper().put(PropertyKeys.sanitize, sanitize);
282   }
283 
284 
285   @Override
286   public void restoreState(FacesContext context, Object state) {
287     // FIXME HACK for mojarra SystemEventListener state restoring bug
288     pushComponentToEL(context, this);
289     super.restoreState(context, state);
290     popComponentFromEL(context);
291   }
292 
293 }