KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > tree > HtmlTreeImageCommandLink


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.custom.tree;
17
18 import javax.faces.component.html.HtmlCommandLink;
19 import javax.faces.context.FacesContext;
20
21
22 /**
23  * HTML image link.
24  *
25  * @author <a HREF="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
26  * @version $Revision: 1.3 $ $Date: 2004/10/13 11:50:58 $
27  * $Log: HtmlTreeImageCommandLink.java,v $
28  * Revision 1.3 2004/10/13 11:50:58 matze
29  * renamed packages to org.apache
30  *
31  * Revision 1.2 2004/07/01 21:53:07 mwessendorf
32  * ASF switch
33  *
34  * Revision 1.1 2004/04/22 10:20:23 manolito
35  * tree component
36  *
37  */

38 public class HtmlTreeImageCommandLink
39         extends HtmlCommandLink
40 {
41
42     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.HtmlTreeImageCommandLink";
43     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "org.apache.myfaces.HtmlTreeImageCommandLink";
44
45     private String JavaDoc image;
46
47
48     public HtmlTreeImageCommandLink()
49     {
50         setRendererType(DEFAULT_RENDERER_TYPE);
51     }
52
53
54     public String JavaDoc getFamily()
55     {
56         return "org.apache.myfaces.HtmlTree";
57     }
58
59
60     public String JavaDoc getImage()
61     {
62         return image;
63     }
64
65
66     public void setImage(String JavaDoc image)
67     {
68         this.image = image;
69     }
70
71
72     public Object JavaDoc saveState(FacesContext context)
73     {
74         Object JavaDoc values[] = new Object JavaDoc[2];
75         values[0] = super.saveState(context);
76         values[1] = image;
77         return ((Object JavaDoc)(values));
78     }
79
80
81     public void restoreState(FacesContext context, Object JavaDoc state)
82     {
83         Object JavaDoc values[] = (Object JavaDoc[])state;
84         super.restoreState(context, values[0]);
85         image = (String JavaDoc)values[1];
86     }
87 }
88
Popular Tags