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 org.apache.myfaces.trinidad.bean.FacesBean;
25  import org.apache.myfaces.trinidad.bean.PropertyKey;
26  import org.apache.myfaces.trinidad.component.UIXSelectItem;
27  import org.apache.myfaces.trinidad.util.ComponentUtils;
28  
29  /**
30   *
31   * The selectItem tag represents a single item that the user
32   * may select from a list, choice, radio, or shuttle Trinidad control.
33   * It may be used in place of the JSF selectItem or selectItems
34   * tags, but is very similar (largely not requiring "item" in front
35   * of its attributes.)
36   *
37   * <h4>Events:</h4>
38   * <table border="1" width="100%" cellpadding="3" summary="">
39   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
40   * <th align="left">Type</th>
41   * <th align="left">Phases</th>
42   * <th align="left">Description</th>
43   * </tr>
44   * <tr class="TableRowColor">
45   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
46   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
47   * <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>
48   * </tr>
49   * </table>
50   */
51  public class CoreSelectItem extends UIXSelectItem
52  {
53    static public final FacesBean.Type TYPE = new FacesBean.Type(
54      UIXSelectItem.TYPE);
55    static public final PropertyKey LABEL_KEY =
56      TYPE.registerKey("label", String.class);
57    static public final PropertyKey DISABLED_KEY =
58      TYPE.registerKey("disabled", Boolean.class, Boolean.FALSE);
59    static public final PropertyKey LONG_DESC_KEY =
60      TYPE.registerKey("longDesc", String.class);
61    static public final PropertyKey SHORT_DESC_KEY =
62      TYPE.registerKey("shortDesc", String.class);
63  
64    static public final String COMPONENT_FAMILY =
65      "org.apache.myfaces.trinidad.SelectItem";
66    static public final String COMPONENT_TYPE =
67      "org.apache.myfaces.trinidad.CoreSelectItem";
68  
69    /**
70     * Construct an instance of the CoreSelectItem.
71     */
72    public CoreSelectItem()
73    {
74      super(null);
75    }
76  
77    /**
78     * Gets the user-visible text of the item
79     *
80     * @return  the new label value
81     */
82    final public String getLabel()
83    {
84      return ComponentUtils.resolveString(getProperty(LABEL_KEY));
85    }
86  
87    /**
88     * Sets the user-visible text of the item
89     * 
90     * @param label  the new label value
91     */
92    final public void setLabel(String label)
93    {
94      setProperty(LABEL_KEY, (label));
95    }
96  
97    /**
98     * Gets whether the item is disabled.  By default, no
99     *           items are disabled.
100    *
101    * @return  the new disabled value
102    */
103   final public boolean isDisabled()
104   {
105     return ComponentUtils.resolveBoolean(getProperty(DISABLED_KEY), false);
106   }
107 
108   /**
109    * Sets whether the item is disabled.  By default, no
110    *           items are disabled.
111    * 
112    * @param disabled  the new disabled value
113    */
114   final public void setDisabled(boolean disabled)
115   {
116     setProperty(DISABLED_KEY, disabled ? Boolean.TRUE : Boolean.FALSE);
117   }
118 
119   /**
120    * Gets the description associated with this option.
121    *         This is used in selectManyShuttle and selectOrderShuttle, and ignored otherwise.
122    *
123    * @return  the new longDesc value
124    */
125   final public String getLongDesc()
126   {
127     return ComponentUtils.resolveString(getProperty(LONG_DESC_KEY));
128   }
129 
130   /**
131    * Sets the description associated with this option.
132    *         This is used in selectManyShuttle and selectOrderShuttle, and ignored otherwise.
133    * 
134    * @param longDesc  the new longDesc value
135    */
136   final public void setLongDesc(String longDesc)
137   {
138     setProperty(LONG_DESC_KEY, (longDesc));
139   }
140 
141   /**
142    * Gets The short description of the bean.  This text
143    *          is commonly used by user agents to display advisory information about the option.
144    *
145    * @return  the new shortDesc value
146    */
147   final public String getShortDesc()
148   {
149     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
150   }
151 
152   /**
153    * Sets The short description of the bean.  This text
154    *          is commonly used by user agents to display advisory information about the option.
155    * 
156    * @param shortDesc  the new shortDesc value
157    */
158   final public void setShortDesc(String shortDesc)
159   {
160     setProperty(SHORT_DESC_KEY, (shortDesc));
161   }
162 
163   @Override
164   public String getFamily()
165   {
166     return COMPONENT_FAMILY;
167   }
168 
169   @Override
170   protected FacesBean.Type getBeanType()
171   {
172     return TYPE;
173   }
174 
175   /**
176    * Construct an instance of the CoreSelectItem.
177    */
178   protected CoreSelectItem(
179     String rendererType
180     )
181   {
182     super(rendererType);
183   }
184 
185   static
186   {
187     TYPE.lock();
188   }
189 }