Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: javax/faces/component/UIGraphic.java


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 javax.faces.component;
17  
18  import javax.faces.context.FacesContext;
19  import javax.faces.el.ValueBinding;
20  
21  /**
22   * see Javadoc of JSF Specification
23   * 
24   * @author Manfred Geiler (latest modification by $Author: mwessendorf $)
25   * @version $Revision: 166994 $ $Date: 2004-07-01 18:12:40 -0400 (Thu, 01 Jul 2004) $
26   */
27  public class UIGraphic
28          extends UIComponentBase
29  {
30      private static final String URL_PROPERTY = "url";
31      private static final String VALUE_PROPERTY = "value";
32  
33      public String getUrl()
34      {
35          return (String)getValue();
36      }
37  
38      public void setUrl(String url)
39      {
40          setValue(url);
41      }
42  
43      public ValueBinding getValueBinding(String name)
44      {
45          if (URL_PROPERTY.equals(name))
46          {
47              return super.getValueBinding(VALUE_PROPERTY);
48          }
49          else
50          {
51              return super.getValueBinding(name);
52          }
53      }
54  
55      public void setValueBinding(String name,
56                                  ValueBinding binding)
57      {
58          if (URL_PROPERTY.equals(name))
59          {
60              super.setValueBinding(VALUE_PROPERTY, binding);
61          }
62          else
63          {
64              super.setValueBinding(name, binding);
65          }
66      }
67  
68  
69      //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
70  
71      public static final String COMPONENT_TYPE = "javax.faces.Graphic";
72      public static final String COMPONENT_FAMILY = "javax.faces.Graphic";
73      private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Image";
74  
75      private Object _value = null;
76  
77      public UIGraphic()
78      {
79          setRendererType(DEFAULT_RENDERER_TYPE);
80      }
81  
82      public String getFamily()
83      {
84          return COMPONENT_FAMILY;
85      }
86  
87      public void setValue(Object value)
88      {
89          _value = value;
90      }
91  
92      public Object getValue()
93      {
94          if (_value != null) return _value;
95          ValueBinding vb = getValueBinding("value");
96          return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
97      }
98  
99  
100     public Object saveState(FacesContext context)
101     {
102         Object values[] = new Object[2];
103         values[0] = super.saveState(context);
104         values[1] = _value;
105         return ((Object) (values));
106     }
107 
108     public void restoreState(FacesContext context, Object state)
109     {
110         Object values[] = (Object[])state;
111         super.restoreState(context, values[0]);
112         _value = (Object)values[1];
113     }
114     //------------------ GENERATED CODE END ---------------------------------------
115 }