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.input;
23  
24  import java.awt.Color;
25  import java.util.Arrays;
26  import java.util.Collection;
27  import java.util.Collections;
28  import java.util.List;
29  import java.util.Map;
30  import javax.faces.component.behavior.ClientBehavior;
31  import javax.faces.component.behavior.ClientBehaviorHolder;
32  import org.apache.myfaces.trinidad.bean.FacesBean;
33  import org.apache.myfaces.trinidad.bean.PropertyKey;
34  import org.apache.myfaces.trinidad.component.UIXChoose;
35  import org.apache.myfaces.trinidad.util.ComponentUtils;
36  
37  /**
38   *
39   * The chooseColor control creates a palette for picking colors.
40   *           A chooseColor can display two sets of colors:
41   *           <html:ul>
42   *             <html:li>
43   *             A set of standard colors, as specified by the colorData
44   *             attribute.
45   *             </html:li>
46   *             <html:li>
47   *             A set of custom colors which extend the set of colors available
48   *             in the standard palette.  Custom colors are specified by the
49   *             customColorData attribute.
50   *             </html:li>
51   *           </html:ul>
52   * 
53   *           <html:p>
54   *           Both the colorData and customColorData attributes accept both
55   *           List and array objects, each of which contain one java.awt.Color
56   *           instance for each color to display.
57   *           </html:p>
58   *           <html:p>
59   *           In order to simplify the use of standard palettes, Apache Trinidad makes
60   *           certain palettes available via the requestContext.colorPalette EL implicit
61   *           object.  The &quot;#{requestContext.colorPalette}&quot; implicit object
62   *           provides access to four standard color palettes:
63   *           <html:ul>
64   *           <html:li><html:code>&quot;default49&quot;</html:code>: 49 colors, including
65   *            one transparent entry.</html:li>
66   *           <html:li><html:code>&quot;opaque49&quot;</html:code>: 49 colors, without
67   *            a transparent entry.</html:li>
68   *           <html:li><html:code>&quot;default80&quot;</html:code>: 80 colors, including
69   *            one transparent entry.</html:li>
70   *           <html:li><html:code>&quot;web216&quot;</html:code>: the 216 &quot;web-safe&quot;
71   *            colors.</html:li>
72   *           </html:ul>
73   *           </html:p>
74   *
75   * <h4>Events:</h4>
76   * <table border="1" width="100%" cellpadding="3" summary="">
77   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
78   * <th align="left">Type</th>
79   * <th align="left">Phases</th>
80   * <th align="left">Description</th>
81   * </tr>
82   * <tr class="TableRowColor">
83   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
84   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
85   * <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>
86   * </tr>
87   * </table>
88   */
89  public class CoreChooseColor extends UIXChoose
90                               implements ClientBehaviorHolder
91  {
92    static public final FacesBean.Type TYPE = new FacesBean.Type(
93      UIXChoose.TYPE);
94    static public final PropertyKey COLOR_DATA_KEY =
95      TYPE.registerKey("colorData", List.class, null, 0, PropertyKey.Mutable.SOMETIMES);
96    static public final PropertyKey CUSTOM_COLOR_DATA_KEY =
97      TYPE.registerKey("customColorData", List.class, null, 0, PropertyKey.Mutable.SOMETIMES);
98    static public final PropertyKey WIDTH_KEY =
99      TYPE.registerKey("width", Integer.class);
100   static public final PropertyKey INLINE_STYLE_KEY =
101     TYPE.registerKey("inlineStyle", String.class);
102   static public final PropertyKey STYLE_CLASS_KEY =
103     TYPE.registerKey("styleClass", String.class);
104   static public final PropertyKey SHORT_DESC_KEY =
105     TYPE.registerKey("shortDesc", String.class);
106   static public final PropertyKey PARTIAL_TRIGGERS_KEY =
107     TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
108   static public final PropertyKey ONCLICK_KEY =
109     TYPE.registerKey("onclick", String.class);
110   static public final PropertyKey ONDBLCLICK_KEY =
111     TYPE.registerKey("ondblclick", String.class);
112   static public final PropertyKey ONMOUSEDOWN_KEY =
113     TYPE.registerKey("onmousedown", String.class);
114   static public final PropertyKey ONMOUSEUP_KEY =
115     TYPE.registerKey("onmouseup", String.class);
116   static public final PropertyKey ONMOUSEOVER_KEY =
117     TYPE.registerKey("onmouseover", String.class);
118   static public final PropertyKey ONMOUSEMOVE_KEY =
119     TYPE.registerKey("onmousemove", String.class);
120   static public final PropertyKey ONMOUSEOUT_KEY =
121     TYPE.registerKey("onmouseout", String.class);
122   static public final PropertyKey ONKEYPRESS_KEY =
123     TYPE.registerKey("onkeypress", String.class);
124   static public final PropertyKey ONKEYDOWN_KEY =
125     TYPE.registerKey("onkeydown", String.class);
126   static public final PropertyKey ONKEYUP_KEY =
127     TYPE.registerKey("onkeyup", String.class);
128 
129   static public final String COMPONENT_FAMILY =
130     "org.apache.myfaces.trinidad.Choose";
131   static public final String COMPONENT_TYPE =
132     "org.apache.myfaces.trinidad.CoreChooseColor";
133   // Supported client events for client behaviors:
134   private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
135     Arrays.asList(
136       "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
137       "mouseout", "keypress", "keydown", "keyup"
138     ));
139 
140   /**
141    * Construct an instance of the CoreChooseColor.
142    */
143   public CoreChooseColor()
144   {
145     super("org.apache.myfaces.trinidad.Color");
146   }
147 
148   /**
149    * Gets the list of colors for the component
150    *
151    * @return  the new colorData value
152    */
153   @SuppressWarnings("unchecked")
154   final public List<Color> getColorData()
155   {
156     return (List)getProperty(COLOR_DATA_KEY);
157   }
158 
159   /**
160    * Sets the list of colors for the component
161    * 
162    * @param colorData  the new colorData value
163    */
164   final public void setColorData(List<Color> colorData)
165   {
166     setProperty(COLOR_DATA_KEY, (colorData));
167   }
168 
169   /**
170    * Gets the list of custom colors for the component
171    *
172    * @return  the new customColorData value
173    */
174   @SuppressWarnings("unchecked")
175   final public List<Color> getCustomColorData()
176   {
177     return (List)getProperty(CUSTOM_COLOR_DATA_KEY);
178   }
179 
180   /**
181    * Sets the list of custom colors for the component
182    * 
183    * @param customColorData  the new customColorData value
184    */
185   final public void setCustomColorData(List<Color> customColorData)
186   {
187     setProperty(CUSTOM_COLOR_DATA_KEY, (customColorData));
188   }
189 
190   /**
191    * Gets the width of the standard palette in cells
192    *
193    * @return  the new width value
194    */
195   final public int getWidth()
196   {
197     return ComponentUtils.resolveInteger(getProperty(WIDTH_KEY));
198   }
199 
200   /**
201    * Sets the width of the standard palette in cells
202    * 
203    * @param width  the new width value
204    */
205   final public void setWidth(int width)
206   {
207     setProperty(WIDTH_KEY, Integer.valueOf(width));
208   }
209 
210   /**
211    * Gets the CSS styles to use for this component.
212    *
213    * @return  the new inlineStyle value
214    */
215   final public String getInlineStyle()
216   {
217     return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
218   }
219 
220   /**
221    * Sets the CSS styles to use for this component.
222    * 
223    * @param inlineStyle  the new inlineStyle value
224    */
225   final public void setInlineStyle(String inlineStyle)
226   {
227     setProperty(INLINE_STYLE_KEY, (inlineStyle));
228   }
229 
230   /**
231    * Gets a CSS style class to use for this component.
232    *
233    * @return  the new styleClass value
234    */
235   final public String getStyleClass()
236   {
237     return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
238   }
239 
240   /**
241    * Sets a CSS style class to use for this component.
242    * 
243    * @param styleClass  the new styleClass value
244    */
245   final public void setStyleClass(String styleClass)
246   {
247     setProperty(STYLE_CLASS_KEY, (styleClass));
248   }
249 
250   /**
251    * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
252    *
253    * @return  the new shortDesc value
254    */
255   final public String getShortDesc()
256   {
257     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
258   }
259 
260   /**
261    * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
262    * 
263    * @param shortDesc  the new shortDesc value
264    */
265   final public void setShortDesc(String shortDesc)
266   {
267     setProperty(SHORT_DESC_KEY, (shortDesc));
268   }
269 
270   /**
271    * Gets the IDs of the components that should trigger a partial update.
272    *         <p>
273    *         This component will listen on the trigger components. If one of the
274    *         trigger components receives an event that will cause it to update
275    *         in some way, this component will request to be updated too.</p>
276    *         <p>
277    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
278    *         </p>
279    *         <p>
280    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
281    *         or use multiple colons to move up through the NamingContainer. For example,
282    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
283    *         ":::" will pop out of two naming containers, etc. The search for
284    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
285    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
286    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
287    *
288    * @return  the new partialTriggers value
289    */
290   final public String[] getPartialTriggers()
291   {
292     return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
293   }
294 
295   /**
296    * Sets the IDs of the components that should trigger a partial update.
297    *         <p>
298    *         This component will listen on the trigger components. If one of the
299    *         trigger components receives an event that will cause it to update
300    *         in some way, this component will request to be updated too.</p>
301    *         <p>
302    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
303    *         </p>
304    *         <p>
305    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
306    *         or use multiple colons to move up through the NamingContainer. For example,
307    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
308    *         ":::" will pop out of two naming containers, etc. The search for
309    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
310    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
311    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
312    * 
313    * @param partialTriggers  the new partialTriggers value
314    */
315   final public void setPartialTriggers(String[] partialTriggers)
316   {
317     setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
318   }
319 
320   /**
321    * Gets an onclick Javascript handler.
322    *
323    * @return  the new onclick value
324    */
325   final public String getOnclick()
326   {
327     return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
328   }
329 
330   /**
331    * Sets an onclick Javascript handler.
332    * 
333    * @param onclick  the new onclick value
334    */
335   final public void setOnclick(String onclick)
336   {
337     setProperty(ONCLICK_KEY, (onclick));
338   }
339 
340   /**
341    * Gets an ondblclick Javascript handler.
342    *
343    * @return  the new ondblclick value
344    */
345   final public String getOndblclick()
346   {
347     return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
348   }
349 
350   /**
351    * Sets an ondblclick Javascript handler.
352    * 
353    * @param ondblclick  the new ondblclick value
354    */
355   final public void setOndblclick(String ondblclick)
356   {
357     setProperty(ONDBLCLICK_KEY, (ondblclick));
358   }
359 
360   /**
361    * Gets an onmousedown Javascript handler.
362    *
363    * @return  the new onmousedown value
364    */
365   final public String getOnmousedown()
366   {
367     return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
368   }
369 
370   /**
371    * Sets an onmousedown Javascript handler.
372    * 
373    * @param onmousedown  the new onmousedown value
374    */
375   final public void setOnmousedown(String onmousedown)
376   {
377     setProperty(ONMOUSEDOWN_KEY, (onmousedown));
378   }
379 
380   /**
381    * Gets an onmouseup Javascript handler.
382    *
383    * @return  the new onmouseup value
384    */
385   final public String getOnmouseup()
386   {
387     return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
388   }
389 
390   /**
391    * Sets an onmouseup Javascript handler.
392    * 
393    * @param onmouseup  the new onmouseup value
394    */
395   final public void setOnmouseup(String onmouseup)
396   {
397     setProperty(ONMOUSEUP_KEY, (onmouseup));
398   }
399 
400   /**
401    * Gets an onmouseover Javascript handler.
402    *
403    * @return  the new onmouseover value
404    */
405   final public String getOnmouseover()
406   {
407     return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
408   }
409 
410   /**
411    * Sets an onmouseover Javascript handler.
412    * 
413    * @param onmouseover  the new onmouseover value
414    */
415   final public void setOnmouseover(String onmouseover)
416   {
417     setProperty(ONMOUSEOVER_KEY, (onmouseover));
418   }
419 
420   /**
421    * Gets an onmousemove Javascript handler.
422    *
423    * @return  the new onmousemove value
424    */
425   final public String getOnmousemove()
426   {
427     return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
428   }
429 
430   /**
431    * Sets an onmousemove Javascript handler.
432    * 
433    * @param onmousemove  the new onmousemove value
434    */
435   final public void setOnmousemove(String onmousemove)
436   {
437     setProperty(ONMOUSEMOVE_KEY, (onmousemove));
438   }
439 
440   /**
441    * Gets an onmouseout Javascript handler.
442    *
443    * @return  the new onmouseout value
444    */
445   final public String getOnmouseout()
446   {
447     return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
448   }
449 
450   /**
451    * Sets an onmouseout Javascript handler.
452    * 
453    * @param onmouseout  the new onmouseout value
454    */
455   final public void setOnmouseout(String onmouseout)
456   {
457     setProperty(ONMOUSEOUT_KEY, (onmouseout));
458   }
459 
460   /**
461    * Gets an onkeypress Javascript handler.
462    *
463    * @return  the new onkeypress value
464    */
465   final public String getOnkeypress()
466   {
467     return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
468   }
469 
470   /**
471    * Sets an onkeypress Javascript handler.
472    * 
473    * @param onkeypress  the new onkeypress value
474    */
475   final public void setOnkeypress(String onkeypress)
476   {
477     setProperty(ONKEYPRESS_KEY, (onkeypress));
478   }
479 
480   /**
481    * Gets an onkeydown Javascript handler.
482    *
483    * @return  the new onkeydown value
484    */
485   final public String getOnkeydown()
486   {
487     return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
488   }
489 
490   /**
491    * Sets an onkeydown Javascript handler.
492    * 
493    * @param onkeydown  the new onkeydown value
494    */
495   final public void setOnkeydown(String onkeydown)
496   {
497     setProperty(ONKEYDOWN_KEY, (onkeydown));
498   }
499 
500   /**
501    * Gets an onkeyup Javascript handler.
502    *
503    * @return  the new onkeyup value
504    */
505   final public String getOnkeyup()
506   {
507     return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
508   }
509 
510   /**
511    * Sets an onkeyup Javascript handler.
512    * 
513    * @param onkeyup  the new onkeyup value
514    */
515   final public void setOnkeyup(String onkeyup)
516   {
517     setProperty(ONKEYUP_KEY, (onkeyup));
518   }
519 
520   @Override
521   public String getDefaultEventName()
522   {
523     return "click";
524   }
525 
526   @Override
527   public Collection<String> getEventNames()
528   {
529     return _EVENT_NAMES;
530   }
531 
532   @Override
533   public Map<String, List<ClientBehavior>> getClientBehaviors()
534   {
535     return super.getClientBehaviors();
536   }
537 
538   @Override
539   public void addClientBehavior(
540     String         eventName,
541     ClientBehavior behavior)
542   {
543     super.addClientBehavior(eventName, behavior);
544   }
545 
546   @Override
547   public String getFamily()
548   {
549     return COMPONENT_FAMILY;
550   }
551 
552   @Override
553   protected FacesBean.Type getBeanType()
554   {
555     return TYPE;
556   }
557 
558   /**
559    * Construct an instance of the CoreChooseColor.
560    */
561   protected CoreChooseColor(
562     String rendererType
563     )
564   {
565     super(rendererType);
566   }
567 
568   static
569   {
570     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Choose","org.apache.myfaces.trinidad.Color");
571   }
572 }