KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > ui > common > tag > GenericPickerTag


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 package org.alfresco.web.ui.common.tag;
18
19 import javax.faces.FacesException;
20 import javax.faces.component.UICommand;
21 import javax.faces.component.UIComponent;
22 import javax.faces.el.MethodBinding;
23 import javax.faces.el.ValueBinding;
24
25 import org.alfresco.web.ui.common.component.UIGenericPicker;
26
27 /**
28  * @author Kevin Roast
29  */

30 public class GenericPickerTag extends BaseComponentTag
31 {
32    private final static Class JavaDoc QUERYCALLBACK_CLASS_ARGS[] = {int.class, String JavaDoc.class};
33    
34    /**
35     * @see javax.faces.webapp.UIComponentTag#getComponentType()
36     */

37    public String JavaDoc getComponentType()
38    {
39       return "org.alfresco.faces.GenericPicker";
40    }
41    
42    /**
43     * @see javax.faces.webapp.UIComponentTag#getRendererType()
44     */

45    public String JavaDoc getRendererType()
46    {
47       return null;
48    }
49    
50    /**
51     * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
52     */

53    protected void setProperties(UIComponent component)
54    {
55       super.setProperties(component);
56       setBooleanProperty(component, "showFilter", this.showFilter);
57       setBooleanProperty(component, "showContains", this.showContains);
58       setBooleanProperty(component, "showAddButton", this.showAddButton);
59       setBooleanProperty(component, "filterRefresh", this.filterRefresh);
60       setStringProperty(component, "addButtonLabel", this.addButtonLabel);
61       setActionProperty((UICommand)component, this.action);
62       setActionListenerProperty((UICommand)component, this.actionListener);
63       setIntProperty(component, "width", this.width);
64       setIntProperty(component, "height", this.height);
65       setStringBindingProperty(component, "filters", this.filters);
66       if (queryCallback != null)
67       {
68          if (isValueReference(queryCallback))
69          {
70             MethodBinding b = getFacesContext().getApplication().createMethodBinding(queryCallback, QUERYCALLBACK_CLASS_ARGS);
71             ((UIGenericPicker)component).setQueryCallback(b);
72          }
73          else
74          {
75             throw new FacesException("Query Callback method binding incorrectly specified: " + queryCallback);
76          }
77       }
78    }
79    
80    /**
81     * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release()
82     */

83    public void release()
84    {
85       super.release();
86       this.showFilter = null;
87       this.showContains = null;
88       this.showAddButton = null;
89       this.addButtonLabel = null;
90       this.action = null;
91       this.actionListener = null;
92       this.width = null;
93       this.height = null;
94       this.queryCallback = null;
95       this.filters = null;
96       this.filterRefresh = null;
97    }
98    
99    /**
100     * Set the showFilter
101     *
102     * @param showFilter the showFilter
103     */

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

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

124    public void setShowAddButton(String JavaDoc showAddButton)
125    {
126       this.showAddButton = showAddButton;
127    }
128
129    /**
130     * Set the addButtonLabel
131     *
132     * @param addButtonLabel the addButtonLabel
133     */

134    public void setAddButtonLabel(String JavaDoc addButtonLabel)
135    {
136       this.addButtonLabel = addButtonLabel;
137    }
138
139    /**
140     * Set the action
141     *
142     * @param action the action
143     */

144    public void setAction(String JavaDoc action)
145    {
146       this.action = action;
147    }
148
149    /**
150     * Set the actionListener
151     *
152     * @param actionListener the actionListener
153     */

154    public void setActionListener(String JavaDoc actionListener)
155    {
156       this.actionListener = actionListener;
157    }
158
159    /**
160     * Set the width
161     *
162     * @param width the width
163     */

164    public void setWidth(String JavaDoc width)
165    {
166       this.width = width;
167    }
168
169    /**
170     * Set the height
171     *
172     * @param height the height
173     */

174    public void setHeight(String JavaDoc height)
175    {
176       this.height = height;
177    }
178
179    /**
180     * Set the queryCallback
181     *
182     * @param queryCallback the queryCallback
183     */

184    public void setQueryCallback(String JavaDoc queryCallback)
185    {
186       this.queryCallback = queryCallback;
187    }
188    
189    /**
190     * Set the filters
191     *
192     * @param filters the filters
193     */

194    public void setFilters(String JavaDoc filters)
195    {
196       this.filters = filters;
197    }
198    
199    /**
200     * Set the filterRefresh
201     *
202     * @param filterRefresh the filterRefresh
203     */

204    public void setFilterRefresh(String JavaDoc filterRefresh)
205    {
206       this.filterRefresh = filterRefresh;
207    }
208
209
210    /** the filterRefresh */
211    private String JavaDoc filterRefresh;
212    
213    /** the filters */
214    private String JavaDoc filters;
215       
216    /** the queryCallback */
217    private String JavaDoc queryCallback;
218
219    /** the showFilter */
220    private String JavaDoc showFilter;
221
222    /** the showContains */
223    private String JavaDoc showContains;
224
225    /** the showAddButton */
226    private String JavaDoc showAddButton;
227
228    /** the addButtonLabel */
229    private String JavaDoc addButtonLabel;
230
231    /** the action */
232    private String JavaDoc action;
233
234    /** the actionListener */
235    private String JavaDoc actionListener;
236
237    /** the width */
238    private String JavaDoc width;
239
240    /** the height */
241    private String JavaDoc height;
242 }
243
Popular Tags