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.renderkit.css.Style;
28  import org.apache.myfaces.tobago.sanitizer.SanitizeMode;
29  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
30  import org.apache.myfaces.tobago.internal.util.StringUtils;
31  import org.apache.myfaces.tobago.internal.util.Deprecation;
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  public class UIOut
47      extends AbstractUIOut implements ClientBehaviorHolder, Visual {
48  
49    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Out";
50  
51    public static final String COMPONENT_FAMILY = "javax.faces.Output";
52  
53  
54    enum PropertyKeys {
55      markup,
56      compact,
57      labelLayout,
58      customClass,
59      tip,
60      style,
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    Use true, if you enable the possibility to apply styles to the output.
86     Use false, if you want to keep the code small (especially inside of sheets).
87    <br>Default: <code>false</code>
88    */
89    public boolean isCompact() {
90      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.compact);
91      if (bool != null) {
92        return bool;
93      }
94      return false;
95    }
96  
97    public void setCompact(boolean compact) {
98      getStateHelper().put(PropertyKeys.compact, compact);
99    }
100 
101   /**
102   Defines the position of the label relative to the field.
103    The default is flexLeft, if the label is set, or none, if the label isn't set.
104    Set to 'skip' to avoid surrounding label container.
105    Hint for tc:out: set also compact=true to render only text (without html tags).
106 
107   */
108   public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
109     org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
110     if (labelLayout != null) {
111       return labelLayout;
112     }
113     return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
114   }
115 
116   public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
117     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
118   }
119 
120   /**
121   Sets a CSS class in its parent, if the parent supports it.
122 
123    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
124 
125    <pre>
126    &lt;tc:in&gt;
127      &lt;tc:style customClass="my-emphasized"/&gt;
128    &lt;/tc:in&gt;
129    </pre>
130 
131    One capability is, to used external CSS libs.
132    <br>
133    This feature should not be used imprudent.
134    Because it might be unstable against changes in the renderered HTML code.
135 
136   */
137   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
138     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
139   }
140 
141   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
142     getStateHelper().put(PropertyKeys.customClass, customClass);
143   }
144 
145   /**
146   Text value to display as tooltip.
147 
148   */
149   public java.lang.String getTip() {
150     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
151   }
152 
153   public void setTip(java.lang.String tip) {
154     getStateHelper().put(PropertyKeys.tip, tip);
155   }
156 
157   /**
158   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
159 
160   */
161   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
162     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
163   }
164 
165   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
166     getStateHelper().put(PropertyKeys.style, style);
167   }
168 
169   /**
170   Indicates that the renderer should create an element in the output language
171    (e. g. an span or div tag around the output text).
172    Use true, if you enable the possibility to apply styles to the output.
173    Use false, if you want to keep the code small (especially inside of sheets).
174   <br>Default: <code>true</code>
175   */
176   public boolean isCreateSpan() {
177     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.createSpan);
178     if (bool != null) {
179       return bool;
180     }
181     return true;
182   }
183 
184   public void setCreateSpan(boolean createSpan) {
185     getStateHelper().put(PropertyKeys.createSpan, createSpan);
186   }
187 
188   /**
189   A localized user presentable label for this component.
190 
191   */
192   public java.lang.String getLabel() {
193     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
194   }
195 
196   public void setLabel(java.lang.String label) {
197     getStateHelper().put(PropertyKeys.label, label);
198   }
199 
200   /**
201   Flag indicating that characters that are
202    sensitive in HTML and XML markup must be escaped.
203   <br>Default: <code>true</code>
204   */
205   public boolean isEscape() {
206     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.escape);
207     if (bool != null) {
208       return bool;
209     }
210     return true;
211   }
212 
213   public void setEscape(boolean escape) {
214     getStateHelper().put(PropertyKeys.escape, escape);
215   }
216 
217   /**
218   Should HTML content sanitized?
219    The effect of sanitizing depends on the configuration.
220    The value "auto" means, that sanitizing take place for
221    <ul>
222      <li>tc:out when escape="false" or</li>
223      <li>tc:textarea when attribute data-html-editor is set,</li>
224    </ul>
225    because that are the critical parts.
226   <br>Default: <code>auto</code><br>Allowed Values: <code>auto,never</code>
227   */
228   public org.apache.myfaces.tobago.sanitizer.SanitizeMode getSanitize() {
229     org.apache.myfaces.tobago.sanitizer.SanitizeMode sanitize = (org.apache.myfaces.tobago.sanitizer.SanitizeMode) getStateHelper().eval(PropertyKeys.sanitize);
230     if (sanitize != null) {
231       return sanitize;
232     }
233     return org.apache.myfaces.tobago.sanitizer.SanitizeMode.auto;
234   }
235 
236   public void setSanitize(org.apache.myfaces.tobago.sanitizer.SanitizeMode sanitize) {
237     getStateHelper().put(PropertyKeys.sanitize, sanitize);
238   }
239 
240 
241 }