View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.shared.taglib.core;
20  
21  import org.apache.myfaces.shared.renderkit.JSFAttr;
22  
23  import javax.el.ValueExpression;
24  import javax.faces.component.UIComponent;
25  
26  public class SelectItemTagBase
27      extends org.apache.myfaces.shared.taglib.UIComponentELTagBase
28  {
29      //private static final Log log = LogFactory.getLog(SelectItemTag.class);
30  
31      public String getComponentType()
32      {
33          return "javax.faces.SelectItem";
34      }
35  
36      public String getRendererType()
37      {
38          return null;
39      }
40  
41      // UISelectItem attributes
42      private ValueExpression _itemDisabled;
43      private ValueExpression _itemDescription;
44      private ValueExpression _itemLabel;
45      private ValueExpression _itemValue;
46      private ValueExpression _escape;
47      private ValueExpression _noSelectionOption;
48  
49      protected void setProperties(UIComponent component)
50      {
51          super.setProperties(component);
52  
53          setBooleanProperty(component, JSFAttr.ITEM_DISABLED_ATTR, _itemDisabled);
54          setStringProperty(component, JSFAttr.ITEM_DESCRIPTION_ATTR, _itemDescription);
55          setStringProperty(component, org.apache.myfaces.shared.renderkit.JSFAttr.ITEM_LABEL_ATTR, _itemLabel);
56          setStringProperty(component, JSFAttr.ITEM_VALUE_ATTR, _itemValue);
57          setBooleanProperty(component, JSFAttr.ITEM_ESCAPED_ATTR, _escape, Boolean.TRUE);
58          setBooleanProperty(component, JSFAttr.NO_SELECTION_OPTION_ATTR, _noSelectionOption, Boolean.FALSE);
59      }
60  
61      public void setItemDisabled(ValueExpression itemDisabled)
62      {
63          _itemDisabled = itemDisabled;
64      }
65  
66      public void setItemDescription(ValueExpression itemDescription)
67      {
68          _itemDescription = itemDescription;
69      }
70  
71      public void setItemLabel(ValueExpression itemLabel)
72      {
73          _itemLabel = itemLabel;
74      }
75  
76      @Deprecated
77      protected void setItemValue(String itemValue)
78      {
79          _itemValue = getFacesContext().getApplication().getExpressionFactory().createValueExpression(
80                      getFacesContext().getELContext(),itemValue,String.class);
81      }
82  
83      public void setItemValue(ValueExpression itemValue)
84      {
85          _itemValue = itemValue;
86      }
87  
88      public void setEscape(ValueExpression escape)
89      {
90          _escape = escape;
91      }
92  
93      protected ValueExpression getItemValue()
94      {
95          return _itemValue;
96      }
97  
98      public void setNoSelectionOption(ValueExpression noSelectionOption)
99      {
100         _noSelectionOption = noSelectionOption;
101     }
102 
103 }