KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > ui > repo > tag > ItemSelectorTag


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 /*
18  * Created on 25-May-2005
19  */

20 package org.alfresco.web.ui.repo.tag;
21
22 import javax.faces.component.UIComponent;
23
24 import org.alfresco.web.ui.common.tag.HtmlComponentTag;
25
26 /**
27  * Base class for the item selector tag
28  *
29  * @author gavinc
30  */

31 public abstract class ItemSelectorTag extends HtmlComponentTag
32 {
33    /** the value */
34    private String JavaDoc value;
35
36    /** the label */
37    private String JavaDoc label;
38
39    /** the spacing */
40    private String JavaDoc spacing;
41    
42    /** the node style */
43    private String JavaDoc nodeStyle;
44    
45    /** the node style class */
46    private String JavaDoc nodeStyleClass;
47    
48    /** the id of initial selection */
49    private String JavaDoc initialSelection;
50    
51    /** Whether the component is disabled */
52    private String JavaDoc disabled;
53    
54    /**
55     * @see javax.faces.webapp.UIComponentTag#getComponentType()
56     */

57    public abstract String JavaDoc getComponentType();
58    
59    /**
60     * @see javax.faces.webapp.UIComponentTag#getRendererType()
61     */

62    public String JavaDoc getRendererType()
63    {
64       return null;
65    }
66
67    /**
68     * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
69     */

70    protected void setProperties(UIComponent component)
71    {
72       super.setProperties(component);
73       
74       setStringBindingProperty(component, "value", this.value);
75       setStringBindingProperty(component, "initialSelection", this.initialSelection);
76       setStringProperty(component, "label", this.label);
77       setStringProperty(component, "nodeStyle", this.nodeStyle);
78       setStringProperty(component, "nodeStyleClass", this.nodeStyleClass);
79       setIntProperty(component, "spacing", this.spacing);
80       setBooleanProperty(component, "disabled", this.disabled);
81    }
82    
83    /**
84     * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release()
85     */

86    public void release()
87    {
88       super.release();
89       
90       this.value = null;
91       this.label = null;
92       this.spacing = null;
93       this.nodeStyle = null;
94       this.nodeStyleClass = null;
95       this.initialSelection = null;
96       this.disabled = null;
97    }
98    
99    /**
100     * Set the value
101     *
102     * @param value the value
103     */

104    public void setValue(String JavaDoc value)
105    {
106       this.value = value;
107    }
108
109    /**
110     * Set the label
111     *
112     * @param label the label
113     */

114    public void setLabel(String JavaDoc label)
115    {
116       this.label = label;
117    }
118
119    /**
120     * Set the spacing
121     *
122     * @param spacing the spacing
123     */

124    public void setSpacing(String JavaDoc spacing)
125    {
126       this.spacing = spacing;
127    }
128
129    /**
130     * Set the node style
131     *
132     * @param nodeStyle the node style
133     */

134    public void setNodeStyle(String JavaDoc nodeStyle)
135    {
136       this.nodeStyle = nodeStyle;
137    }
138
139    /**
140     * Set the node style class
141     *
142     * @param nodeStyleClass the node style class
143     */

144    public void setNodeStyleClass(String JavaDoc nodeStyleClass)
145    {
146       this.nodeStyleClass = nodeStyleClass;
147    }
148    
149    /**
150     * Sets the id of the item to be initially selected, this is overridden
151     * however if a value is supplied
152     *
153     * @param initialSelection The id of the initial selected item
154     */

155    public void setInitialSelection(String JavaDoc initialSelection)
156    {
157       this.initialSelection = initialSelection;
158    }
159    
160    /**
161     * Sets whether the component should be rendered in a disabled state
162     *
163     * @param disabled true to render the component in a disabled state
164     */

165    public void setDisabled(String JavaDoc disabled)
166    {
167       this.disabled = disabled;
168    }
169 }
170
Popular Tags