View Javadoc

1   // WARNING: This file was automatically generated. Do not edit it directly,
2   //          or you will lose your changes.
3   
4   /*
5    * Licensed to the Apache Software Foundation (ASF) under one
6    * or more contributor license agreements.  See the NOTICE file
7    * distributed with this work for additional information
8    * regarding copyright ownership.  The ASF licenses this file
9    * to you under the Apache License, Version 2.0 (the
10   * "License"); you may not use this file except in compliance
11   * with the License.  You may obtain a copy of the License at
12   *
13   *   http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing,
16   * software distributed under the License is distributed on an
17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18   * KIND, either express or implied.  See the License for the
19   * specific language governing permissions and limitations
20   * under the License.
21  */
22  package org.apache.myfaces.trinidad.component.core.output;
23  
24  import java.util.Arrays;
25  import java.util.Collection;
26  import java.util.Collections;
27  import java.util.List;
28  import java.util.Map;
29  import javax.faces.component.behavior.ClientBehavior;
30  import javax.faces.component.behavior.ClientBehaviorHolder;
31  import org.apache.myfaces.trinidad.bean.FacesBean;
32  import org.apache.myfaces.trinidad.bean.PropertyKey;
33  import org.apache.myfaces.trinidad.component.UIXOutput;
34  import org.apache.myfaces.trinidad.util.ComponentUtils;
35  
36  /**
37   *
38   * The outputText component supports styled text.  The text
39   * can optionally be left unescaped, and supports
40   * conversion to and from Java objects.
41   *
42   * <h4>Events:</h4>
43   * <table border="1" width="100%" cellpadding="3" summary="">
44   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
45   * <th align="left">Type</th>
46   * <th align="left">Phases</th>
47   * <th align="left">Description</th>
48   * </tr>
49   * <tr class="TableRowColor">
50   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
51   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
52   * <td valign="top">Event delivered to describe an attribute change.  Attribute change events are not delivered for any programmatic change to a property.  They are only delivered when a renderer changes a property without the application's specific request.  An example of an attribute change event might include the width of a column that supported client-side resizing.</td>
53   * </tr>
54   * </table>
55   */
56  public class CoreOutputText extends UIXOutput
57                              implements ClientBehaviorHolder
58  {
59    static public final FacesBean.Type TYPE = new FacesBean.Type(
60      UIXOutput.TYPE);
61    static public final PropertyKey TRUNCATE_AT_KEY =
62      TYPE.registerKey("truncateAt", Integer.class, Integer.valueOf(0));
63    static public final PropertyKey DESCRIPTION_KEY =
64      TYPE.registerKey("description", String.class);
65    static public final PropertyKey ESCAPE_KEY =
66      TYPE.registerKey("escape", Boolean.class, Boolean.TRUE);
67    static public final PropertyKey INLINE_STYLE_KEY =
68      TYPE.registerKey("inlineStyle", String.class);
69    static public final PropertyKey STYLE_CLASS_KEY =
70      TYPE.registerKey("styleClass", String.class);
71    static public final PropertyKey SHORT_DESC_KEY =
72      TYPE.registerKey("shortDesc", String.class);
73    static public final PropertyKey PARTIAL_TRIGGERS_KEY =
74      TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
75    static public final PropertyKey ONCLICK_KEY =
76      TYPE.registerKey("onclick", String.class);
77    static public final PropertyKey ONDBLCLICK_KEY =
78      TYPE.registerKey("ondblclick", String.class);
79    static public final PropertyKey ONMOUSEDOWN_KEY =
80      TYPE.registerKey("onmousedown", String.class);
81    static public final PropertyKey ONMOUSEUP_KEY =
82      TYPE.registerKey("onmouseup", String.class);
83    static public final PropertyKey ONMOUSEOVER_KEY =
84      TYPE.registerKey("onmouseover", String.class);
85    static public final PropertyKey ONMOUSEMOVE_KEY =
86      TYPE.registerKey("onmousemove", String.class);
87    static public final PropertyKey ONMOUSEOUT_KEY =
88      TYPE.registerKey("onmouseout", String.class);
89    static public final PropertyKey ONKEYPRESS_KEY =
90      TYPE.registerKey("onkeypress", String.class);
91    static public final PropertyKey ONKEYDOWN_KEY =
92      TYPE.registerKey("onkeydown", String.class);
93    static public final PropertyKey ONKEYUP_KEY =
94      TYPE.registerKey("onkeyup", String.class);
95  
96    static public final String COMPONENT_FAMILY =
97      "org.apache.myfaces.trinidad.Output";
98    static public final String COMPONENT_TYPE =
99      "org.apache.myfaces.trinidad.CoreOutputText";
100   // Supported client events for client behaviors:
101   private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
102     Arrays.asList(
103       "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
104       "mouseout", "keypress", "keydown", "keyup"
105     ));
106 
107   /**
108    * Construct an instance of the CoreOutputText.
109    */
110   public CoreOutputText()
111   {
112     super("org.apache.myfaces.trinidad.Text");
113   }
114 
115   /**
116    * Gets the length at which the text should automatically begin
117    *               truncating.  When set to zero (the default), the string
118    *               will never truncate.  Values from one to thirteen will
119    *               be treated as thirteen - the outputText component will not
120    *               truncate strings shorter than thirteen characters.
121    *
122    * @return  the new truncateAt value
123    */
124   final public int getTruncateAt()
125   {
126     return ComponentUtils.resolveInteger(getProperty(TRUNCATE_AT_KEY), 0);
127   }
128 
129   /**
130    * Sets the length at which the text should automatically begin
131    *               truncating.  When set to zero (the default), the string
132    *               will never truncate.  Values from one to thirteen will
133    *               be treated as thirteen - the outputText component will not
134    *               truncate strings shorter than thirteen characters.
135    * 
136    * @param truncateAt  the new truncateAt value
137    */
138   final public void setTruncateAt(int truncateAt)
139   {
140     setProperty(TRUNCATE_AT_KEY, Integer.valueOf(truncateAt));
141   }
142 
143   /**
144    * Gets an additional description to be attached
145    * to the text, for use in improving accessibility.  The description will
146    * be available to screen readers and other accessibility agents, but will
147    * not be otherwise visible.
148    *
149    * @return  the new description value
150    */
151   final public String getDescription()
152   {
153     return ComponentUtils.resolveString(getProperty(DESCRIPTION_KEY));
154   }
155 
156   /**
157    * Sets an additional description to be attached
158    * to the text, for use in improving accessibility.  The description will
159    * be available to screen readers and other accessibility agents, but will
160    * not be otherwise visible.
161    * 
162    * @param description  the new description value
163    */
164   final public void setDescription(String description)
165   {
166     setProperty(DESCRIPTION_KEY, (description));
167   }
168 
169   /**
170    * Gets <html> an attribute controlling whether output will
171    * be escaped for the current markup language or not.  This attribute
172    * defaults to true, and should only be set to false if absolutely necessary.
173    * When set to false, you may exposed to cross-site scripting attacks if
174    * the value of this component is any way derived from values supplied
175    * by a user;  see <code>outputFormatted</code> for a safe
176    * alternative.  In addition, nearly all attributes are ignored when "escape"
177    * is set to false (e.g., "styleClass" is not output).</html>
178    *
179    * @return  the new escape value
180    */
181   final public boolean isEscape()
182   {
183     return ComponentUtils.resolveBoolean(getProperty(ESCAPE_KEY), true);
184   }
185 
186   /**
187    * Sets <html> an attribute controlling whether output will
188    * be escaped for the current markup language or not.  This attribute
189    * defaults to true, and should only be set to false if absolutely necessary.
190    * When set to false, you may exposed to cross-site scripting attacks if
191    * the value of this component is any way derived from values supplied
192    * by a user;  see <code>outputFormatted</code> for a safe
193    * alternative.  In addition, nearly all attributes are ignored when "escape"
194    * is set to false (e.g., "styleClass" is not output).</html>
195    * 
196    * @param escape  the new escape value
197    */
198   final public void setEscape(boolean escape)
199   {
200     setProperty(ESCAPE_KEY, escape ? Boolean.TRUE : Boolean.FALSE);
201   }
202 
203   /**
204    * Gets the CSS styles to use for this component.
205    *
206    * @return  the new inlineStyle value
207    */
208   final public String getInlineStyle()
209   {
210     return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
211   }
212 
213   /**
214    * Sets the CSS styles to use for this component.
215    * 
216    * @param inlineStyle  the new inlineStyle value
217    */
218   final public void setInlineStyle(String inlineStyle)
219   {
220     setProperty(INLINE_STYLE_KEY, (inlineStyle));
221   }
222 
223   /**
224    * Gets a CSS style class to use for this component.
225    *
226    * @return  the new styleClass value
227    */
228   final public String getStyleClass()
229   {
230     return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
231   }
232 
233   /**
234    * Sets a CSS style class to use for this component.
235    * 
236    * @param styleClass  the new styleClass value
237    */
238   final public void setStyleClass(String styleClass)
239   {
240     setProperty(STYLE_CLASS_KEY, (styleClass));
241   }
242 
243   /**
244    * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
245    *
246    * @return  the new shortDesc value
247    */
248   final public String getShortDesc()
249   {
250     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
251   }
252 
253   /**
254    * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
255    * 
256    * @param shortDesc  the new shortDesc value
257    */
258   final public void setShortDesc(String shortDesc)
259   {
260     setProperty(SHORT_DESC_KEY, (shortDesc));
261   }
262 
263   /**
264    * Gets the IDs of the components that should trigger a partial update.
265    *         <p>
266    *         This component will listen on the trigger components. If one of the
267    *         trigger components receives an event that will cause it to update
268    *         in some way, this component will request to be updated too.</p>
269    *         <p>
270    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
271    *         </p>
272    *         <p>
273    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
274    *         or use multiple colons to move up through the NamingContainer. For example,
275    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
276    *         ":::" will pop out of two naming containers, etc. The search for
277    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
278    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
279    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
280    *
281    * @return  the new partialTriggers value
282    */
283   final public String[] getPartialTriggers()
284   {
285     return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
286   }
287 
288   /**
289    * Sets the IDs of the components that should trigger a partial update.
290    *         <p>
291    *         This component will listen on the trigger components. If one of the
292    *         trigger components receives an event that will cause it to update
293    *         in some way, this component will request to be updated too.</p>
294    *         <p>
295    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
296    *         </p>
297    *         <p>
298    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
299    *         or use multiple colons to move up through the NamingContainer. For example,
300    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
301    *         ":::" will pop out of two naming containers, etc. The search for
302    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
303    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
304    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
305    * 
306    * @param partialTriggers  the new partialTriggers value
307    */
308   final public void setPartialTriggers(String[] partialTriggers)
309   {
310     setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
311   }
312 
313   /**
314    * Gets an onclick Javascript handler.
315    *
316    * @return  the new onclick value
317    */
318   final public String getOnclick()
319   {
320     return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
321   }
322 
323   /**
324    * Sets an onclick Javascript handler.
325    * 
326    * @param onclick  the new onclick value
327    */
328   final public void setOnclick(String onclick)
329   {
330     setProperty(ONCLICK_KEY, (onclick));
331   }
332 
333   /**
334    * Gets an ondblclick Javascript handler.
335    *
336    * @return  the new ondblclick value
337    */
338   final public String getOndblclick()
339   {
340     return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
341   }
342 
343   /**
344    * Sets an ondblclick Javascript handler.
345    * 
346    * @param ondblclick  the new ondblclick value
347    */
348   final public void setOndblclick(String ondblclick)
349   {
350     setProperty(ONDBLCLICK_KEY, (ondblclick));
351   }
352 
353   /**
354    * Gets an onmousedown Javascript handler.
355    *
356    * @return  the new onmousedown value
357    */
358   final public String getOnmousedown()
359   {
360     return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
361   }
362 
363   /**
364    * Sets an onmousedown Javascript handler.
365    * 
366    * @param onmousedown  the new onmousedown value
367    */
368   final public void setOnmousedown(String onmousedown)
369   {
370     setProperty(ONMOUSEDOWN_KEY, (onmousedown));
371   }
372 
373   /**
374    * Gets an onmouseup Javascript handler.
375    *
376    * @return  the new onmouseup value
377    */
378   final public String getOnmouseup()
379   {
380     return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
381   }
382 
383   /**
384    * Sets an onmouseup Javascript handler.
385    * 
386    * @param onmouseup  the new onmouseup value
387    */
388   final public void setOnmouseup(String onmouseup)
389   {
390     setProperty(ONMOUSEUP_KEY, (onmouseup));
391   }
392 
393   /**
394    * Gets an onmouseover Javascript handler.
395    *
396    * @return  the new onmouseover value
397    */
398   final public String getOnmouseover()
399   {
400     return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
401   }
402 
403   /**
404    * Sets an onmouseover Javascript handler.
405    * 
406    * @param onmouseover  the new onmouseover value
407    */
408   final public void setOnmouseover(String onmouseover)
409   {
410     setProperty(ONMOUSEOVER_KEY, (onmouseover));
411   }
412 
413   /**
414    * Gets an onmousemove Javascript handler.
415    *
416    * @return  the new onmousemove value
417    */
418   final public String getOnmousemove()
419   {
420     return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
421   }
422 
423   /**
424    * Sets an onmousemove Javascript handler.
425    * 
426    * @param onmousemove  the new onmousemove value
427    */
428   final public void setOnmousemove(String onmousemove)
429   {
430     setProperty(ONMOUSEMOVE_KEY, (onmousemove));
431   }
432 
433   /**
434    * Gets an onmouseout Javascript handler.
435    *
436    * @return  the new onmouseout value
437    */
438   final public String getOnmouseout()
439   {
440     return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
441   }
442 
443   /**
444    * Sets an onmouseout Javascript handler.
445    * 
446    * @param onmouseout  the new onmouseout value
447    */
448   final public void setOnmouseout(String onmouseout)
449   {
450     setProperty(ONMOUSEOUT_KEY, (onmouseout));
451   }
452 
453   /**
454    * Gets an onkeypress Javascript handler.
455    *
456    * @return  the new onkeypress value
457    */
458   final public String getOnkeypress()
459   {
460     return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
461   }
462 
463   /**
464    * Sets an onkeypress Javascript handler.
465    * 
466    * @param onkeypress  the new onkeypress value
467    */
468   final public void setOnkeypress(String onkeypress)
469   {
470     setProperty(ONKEYPRESS_KEY, (onkeypress));
471   }
472 
473   /**
474    * Gets an onkeydown Javascript handler.
475    *
476    * @return  the new onkeydown value
477    */
478   final public String getOnkeydown()
479   {
480     return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
481   }
482 
483   /**
484    * Sets an onkeydown Javascript handler.
485    * 
486    * @param onkeydown  the new onkeydown value
487    */
488   final public void setOnkeydown(String onkeydown)
489   {
490     setProperty(ONKEYDOWN_KEY, (onkeydown));
491   }
492 
493   /**
494    * Gets an onkeyup Javascript handler.
495    *
496    * @return  the new onkeyup value
497    */
498   final public String getOnkeyup()
499   {
500     return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
501   }
502 
503   /**
504    * Sets an onkeyup Javascript handler.
505    * 
506    * @param onkeyup  the new onkeyup value
507    */
508   final public void setOnkeyup(String onkeyup)
509   {
510     setProperty(ONKEYUP_KEY, (onkeyup));
511   }
512 
513   @Override
514   public String getDefaultEventName()
515   {
516     return "click";
517   }
518 
519   @Override
520   public Collection<String> getEventNames()
521   {
522     return _EVENT_NAMES;
523   }
524 
525   @Override
526   public Map<String, List<ClientBehavior>> getClientBehaviors()
527   {
528     return super.getClientBehaviors();
529   }
530 
531   @Override
532   public void addClientBehavior(
533     String         eventName,
534     ClientBehavior behavior)
535   {
536     super.addClientBehavior(eventName, behavior);
537   }
538 
539   @Override
540   public String getFamily()
541   {
542     return COMPONENT_FAMILY;
543   }
544 
545   @Override
546   protected FacesBean.Type getBeanType()
547   {
548     return TYPE;
549   }
550 
551   /**
552    * Construct an instance of the CoreOutputText.
553    */
554   protected CoreOutputText(
555     String rendererType
556     )
557   {
558     super(rendererType);
559   }
560 
561   static
562   {
563     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Output","org.apache.myfaces.trinidad.Text");
564   }
565 }