KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > taglib > core > SelectItemTagBase


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.taglib.core;
17
18 import org.apache.myfaces.taglib.UIComponentTagBase;
19 import org.apache.myfaces.renderkit.JSFAttr;
20
21 import javax.faces.component.UIComponent;
22
23 /**
24  * @author Thomas Spiegl (latest modification by $Author: matze $)
25  * @version $Revision: 1.3 $ $Date: 2004/10/13 11:51:01 $
26  * $Log: SelectItemTagBase.java,v $
27  * Revision 1.3 2004/10/13 11:51:01 matze
28  * renamed packages to org.apache
29  *
30  * Revision 1.2 2004/07/01 22:01:36 mwessendorf
31  * ASF switch
32  *
33  * Revision 1.1 2004/06/23 13:44:22 royalts
34  * no message
35  *
36  */

37 public class SelectItemTagBase
38     extends UIComponentTagBase
39 {
40     //private static final Log log = LogFactory.getLog(SelectItemTag.class);
41

42     public String JavaDoc getComponentType()
43     {
44         return "javax.faces.SelectItem";
45     }
46
47     public String JavaDoc getRendererType()
48     {
49         return null;
50     }
51
52     // UISelectItem attributes
53
private String JavaDoc _itemDisabled;
54     private String JavaDoc _itemDescription;
55     private String JavaDoc _itemLabel;
56     private String JavaDoc _itemValue;
57
58     protected void setProperties(UIComponent component)
59     {
60         super.setProperties(component);
61
62         setBooleanProperty(component, JSFAttr.ITEM_DISABLED_ATTR, _itemDisabled);
63         setStringProperty(component, JSFAttr.ITEM_DESCRIPTION_ATTR, _itemDescription);
64         setStringProperty(component, JSFAttr.ITEM_LABEL_ATTR, _itemLabel);
65         setStringProperty(component, JSFAttr.ITEM_VALUE_ATTR, _itemValue);
66
67         if (_itemValue == null &&
68             component.getValueBinding("binding") == null &&
69             component.getValueBinding("value") == null)
70         {
71             throw new IllegalArgumentException JavaDoc("SelectItem with no value");
72         }
73     }
74
75     public void setItemDisabled(String JavaDoc itemDisabled)
76     {
77         _itemDisabled = itemDisabled;
78     }
79
80     public void setItemDescription(String JavaDoc itemDescription)
81     {
82         _itemDescription = itemDescription;
83     }
84
85     public void setItemLabel(String JavaDoc itemLabel)
86     {
87         _itemLabel = itemLabel;
88     }
89
90     public void setItemValue(String JavaDoc itemValue)
91     {
92         _itemValue = itemValue;
93     }
94
95 }
96
Popular Tags