View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    * 
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   */
19  package org.apache.myfaces.trinidad.component;
20  
21  import java.io.IOException;
22  import java.util.Iterator;
23  import java.util.List;
24  import java.util.Map;
25  import javax.faces.component.UIComponent;
26  
27  import javax.faces.context.FacesContext;
28  import javax.faces.el.MethodBinding;
29  import javax.faces.event.FacesListener;
30  import org.apache.myfaces.trinidad.bean.FacesBean;
31  import org.apache.myfaces.trinidad.event.AttributeChangeListener;
32  
33  /**
34   * Pure abstract base class for all UIX components.
35   */
36  abstract public class UIXComponent extends UIComponent
37  {
38    /**
39     * Returns the FacesBean used for storing the component's state.
40     */
41    abstract public FacesBean getFacesBean();
42  
43    /**
44     * Adds an AttributeChangeListener.  Attribute change events are not
45     * delivered for any programmatic change to a property.  They are only
46     * delivered when a renderer changes a property without the application's
47     * specific request.  An example of an attribute change events might
48     * include the width of a column that supported client-side resizing.
49     */
50    abstract public void addAttributeChangeListener(AttributeChangeListener acl);
51  
52    /**
53     * Removes an AttributeChangeListener.  Attribute change events are not
54     * delivered for any programmatic change to a property.  They are only
55     * delivered when a renderer changes a property without the application's
56     * specific request.  An example of an attribute change events might
57     * include the width of a column that supported client-side resizing.
58     */
59    abstract public void removeAttributeChangeListener(AttributeChangeListener acl);
60  
61    /**
62     * Gets the registered AttributeChangeListeners.
63     */ 
64    abstract public AttributeChangeListener[] getAttributeChangeListeners();
65  
66    /**
67     * Sets a method binding to an AttributeChangeListener.  Attribute
68     * change events are not
69     * delivered for any programmatic change to a property.  They are only
70     * delivered when a renderer changes a property without the application's
71     * specific request.  An example of an attribute change events might
72     * include the width of a column that supported client-side resizing.
73     */
74    abstract public void setAttributeChangeListener(MethodBinding mb);
75  
76    /**
77     * Gets the method binding to an AttributeChangeListener.  Attribute
78     * change events are not
79     * delivered for any programmatic change to a property.  They are only
80     * delivered when a renderer changes a property without the application's
81     * specific request.  An example of an attribute change events might
82     * include the width of a column that supported client-side resizing.
83     */
84    abstract public MethodBinding getAttributeChangeListener();
85  
86    abstract public void markInitialState();
87  
88    // JSF 1.2 methods that we're adding up front
89    abstract public int getFacetCount();
90    abstract public void encodeAll(FacesContext context) throws IOException;
91  
92    
93    // Everything below here is a UIComponent method
94  
95    @SuppressWarnings("unchecked")
96    @Override
97    public abstract Map getAttributes();
98  
99    @SuppressWarnings("unchecked")
100   @Override
101   public abstract List getChildren();
102 
103   @SuppressWarnings("unchecked")
104   @Override
105   public abstract Map getFacets();
106 
107   @SuppressWarnings("unchecked")
108   @Override
109   public abstract Iterator getFacetsAndChildren();
110 
111   @SuppressWarnings("unchecked")
112   @Override
113   protected abstract FacesListener[] getFacesListeners(Class clazz);
114 
115   public abstract Object saveState(FacesContext context);
116   public abstract void restoreState(FacesContext context, Object state);
117   public abstract boolean isTransient();
118   public abstract void setTransient(boolean trans);
119 }