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