KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > ui > common > component > UIListItems


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the GNU Lesser General Public License as
5  * published by the Free Software Foundation; either version
6  * 2.1 of the License, or (at your option) any later version.
7  * You may obtain a copy of the License at
8  *
9  * http://www.gnu.org/licenses/lgpl.txt
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the
16  * License.
17  */

18 package org.alfresco.web.ui.common.component;
19
20 import javax.faces.context.FacesContext;
21 import javax.faces.el.ValueBinding;
22
23 /**
24  * Allows a group of UIListItem objects to be represented.
25  *
26  * @author gavinc
27  */

28 public class UIListItems extends SelfRenderingComponent
29 {
30    private Object JavaDoc value;
31    
32    /**
33     * @see javax.faces.component.UIComponent#getFamily()
34     */

35    public String JavaDoc getFamily()
36    {
37       return "org.alfresco.faces.ListItems";
38    }
39    
40    /**
41     * @return Returns the object holding the decriptions
42     */

43    public Object JavaDoc getValue()
44    {
45       if (this.value == null)
46       {
47          ValueBinding vb = getValueBinding("value");
48          if (vb != null)
49          {
50             this.value = vb.getValue(getFacesContext());
51          }
52       }
53       
54       return this.value;
55    }
56
57    /**
58     * @param value Sets the object holding the description
59     */

60    public void setValue(Object JavaDoc value)
61    {
62       this.value = value;
63    }
64
65    /**
66     * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
67     */

68    public void restoreState(FacesContext context, Object JavaDoc state)
69    {
70       Object JavaDoc values[] = (Object JavaDoc[])state;
71       // standard component attributes are restored by the super class
72
super.restoreState(context, values[0]);
73       this.value = values[1];
74    }
75    
76    /**
77     * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
78     */

79    public Object JavaDoc saveState(FacesContext context)
80    {
81       Object JavaDoc values[] = new Object JavaDoc[2];
82       // standard component attributes are saved by the super class
83
values[0] = super.saveState(context);
84       values[1] = this.value;
85       return (values);
86    }
87 }
88
89
Popular Tags