KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > ui > repo > tag > shelf > ShortcutsShelfItemTag


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

29 public class ShortcutsShelfItemTag extends BaseComponentTag
30 {
31    /**
32     * @see javax.faces.webapp.UIComponentTag#getComponentType()
33     */

34    public String JavaDoc getComponentType()
35    {
36       return "org.alfresco.faces.ShortcutsShelfItem";
37    }
38
39    /**
40     * @see javax.faces.webapp.UIComponentTag#getRendererType()
41     */

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

51    protected void setProperties(UIComponent component)
52    {
53       super.setProperties(component);
54       setStringBindingProperty(component, "value", this.value);
55       if (isValueReference(this.clickActionListener))
56       {
57          MethodBinding vb = getFacesContext().getApplication().createMethodBinding(this.clickActionListener, ACTION_CLASS_ARGS);
58          ((UIShortcutsShelfItem)component).setClickActionListener(vb);
59       }
60       else
61       {
62          throw new FacesException("Click Action listener method binding incorrectly specified: " + this.clickActionListener);
63       }
64       if (isValueReference(this.removeActionListener))
65       {
66          MethodBinding vb = getFacesContext().getApplication().createMethodBinding(this.removeActionListener, ACTION_CLASS_ARGS);
67          ((UIShortcutsShelfItem)component).setRemoveActionListener(vb);
68       }
69       else
70       {
71          throw new FacesException("Remove Action listener method binding incorrectly specified: " + this.clickActionListener);
72       }
73    }
74    
75    /**
76     * @see javax.servlet.jsp.tagext.Tag#release()
77     */

78    public void release()
79    {
80       super.release();
81       
82       this.value = null;
83       this.clickActionListener = null;
84       this.removeActionListener = null;
85    }
86    
87    /**
88     * Set the value used to bind the shortcuts list to the component
89     *
90     * @param value the value
91     */

92    public void setValue(String JavaDoc value)
93    {
94       this.value = value;
95    }
96    
97    /**
98     * Set the clickActionListener
99     *
100     * @param clickActionListener the clickActionListener
101     */

102    public void setClickActionListener(String JavaDoc clickActionListener)
103    {
104       this.clickActionListener = clickActionListener;
105    }
106    
107    /**
108     * Set the removeActionListener
109     *
110     * @param removeActionListener the removeActionListener
111     */

112    public void setRemoveActionListener(String JavaDoc removeActionListener)
113    {
114       this.removeActionListener = removeActionListener;
115    }
116
117
118    /** the clickActionListener */
119    private String JavaDoc clickActionListener;
120    
121    /** the removeActionListener */
122    private String JavaDoc removeActionListener;
123    
124    /** the value */
125    private String JavaDoc value;
126 }
127
Popular Tags