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