KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > faces > internal > PageFlowApplication


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  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow.faces.internal;
19
20 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
21 import org.apache.beehive.netui.util.logging.Logger;
22
23 import javax.faces.FacesException;
24 import javax.faces.application.Application;
25 import javax.faces.application.NavigationHandler;
26 import javax.faces.application.StateManager;
27 import javax.faces.application.ViewHandler;
28 import javax.faces.component.UIComponent;
29 import javax.faces.context.FacesContext;
30 import javax.faces.convert.Converter;
31 import javax.faces.el.MethodBinding;
32 import javax.faces.el.PropertyResolver;
33 import javax.faces.el.ReferenceSyntaxException;
34 import javax.faces.el.ValueBinding;
35 import javax.faces.el.VariableResolver;
36 import javax.faces.event.ActionListener;
37 import javax.faces.validator.Validator;
38 import java.util.Collection JavaDoc;
39 import java.util.Iterator JavaDoc;
40 import java.util.Locale JavaDoc;
41
42 /**
43  * Internal class used in JSF/Page Flow integration. This is the main hook for overriding base JSF behavior.
44  * @see org.apache.beehive.netui.pageflow.faces.PageFlowApplicationFactory
45  */

46 public class PageFlowApplication
47         extends Application
48 {
49     private static final String JavaDoc BACKING_BINDING_START = "#{" + InternalConstants.BACKING_CLASS_IMPLICIT_OBJECT + '.';
50     
51     private static final Logger _log = Logger.getInstance( PageFlowApplication.class );
52     
53     private Application _delegate;
54
55     
56     public PageFlowApplication( Application delegate )
57     {
58         if ( _log.isDebugEnabled() )
59         {
60             _log.debug( "Adapting Application" + delegate );
61         }
62         
63         _delegate = delegate;
64     }
65     
66     public ActionListener getActionListener()
67     {
68         return _delegate.getActionListener();
69     }
70
71     public void setActionListener( ActionListener listener )
72     {
73         _delegate.setActionListener( new PageFlowActionListener( listener ) );
74     }
75
76     public Locale JavaDoc getDefaultLocale()
77     {
78         return _delegate.getDefaultLocale();
79     }
80
81     public void setDefaultLocale( Locale JavaDoc locale )
82     {
83         _delegate.setDefaultLocale( locale );
84     }
85
86     public String JavaDoc getDefaultRenderKitId()
87     {
88         return _delegate.getDefaultRenderKitId();
89     }
90
91     public void setDefaultRenderKitId( String JavaDoc renderKitId )
92     {
93         _delegate.setDefaultRenderKitId( renderKitId );
94     }
95
96     public String JavaDoc getMessageBundle()
97     {
98         return _delegate.getMessageBundle();
99     }
100
101     public void setMessageBundle( String JavaDoc bundle )
102     {
103         _delegate.setMessageBundle( bundle );
104     }
105
106     public NavigationHandler getNavigationHandler()
107     {
108         return _delegate.getNavigationHandler();
109     }
110
111     public void setNavigationHandler( NavigationHandler handler )
112     {
113         _delegate.setNavigationHandler( new PageFlowNavigationHandler( handler ) );
114     }
115
116     public PropertyResolver getPropertyResolver()
117     {
118         return _delegate.getPropertyResolver();
119     }
120
121     public void setPropertyResolver( PropertyResolver resolver )
122     {
123         _delegate.setPropertyResolver( resolver );
124     }
125
126     public VariableResolver getVariableResolver()
127     {
128         return _delegate.getVariableResolver();
129     }
130
131     public void setVariableResolver( VariableResolver resolver )
132     {
133         _delegate.setVariableResolver( resolver );
134     }
135
136     public ViewHandler getViewHandler()
137     {
138         return _delegate.getViewHandler();
139     }
140
141     public void setViewHandler( ViewHandler handler )
142     {
143         _delegate.setViewHandler( handler instanceof PageFlowViewHandler ? handler : new PageFlowViewHandler( handler ) );
144     }
145
146     public StateManager getStateManager()
147     {
148         return _delegate.getStateManager();
149     }
150
151     public void setStateManager( StateManager manager )
152     {
153         _delegate.setStateManager( manager );
154     }
155
156     public void addComponent( String JavaDoc componentType, String JavaDoc componentClass )
157     {
158         _delegate.addComponent( componentType, componentClass );
159     }
160
161     public UIComponent createComponent( String JavaDoc componentType )
162             throws FacesException
163     {
164         return _delegate.createComponent( componentType );
165     }
166
167     public UIComponent createComponent( ValueBinding componentBinding, FacesContext context, String JavaDoc componentType )
168             throws FacesException
169     {
170         return _delegate.createComponent( componentBinding, context, componentType );
171     }
172
173     public Iterator JavaDoc getComponentTypes()
174     {
175         return _delegate.getComponentTypes();
176     }
177
178     public void addConverter( String JavaDoc converterId, String JavaDoc converterClass )
179     {
180         _delegate.addConverter( converterId, converterClass );
181     }
182
183     public void addConverter( Class JavaDoc targetClass, String JavaDoc converterClass )
184     {
185         _delegate.addConverter( targetClass, converterClass );
186     }
187
188     public Converter createConverter( String JavaDoc converterId )
189     {
190         return _delegate.createConverter( converterId );
191     }
192
193     public Converter createConverter( Class JavaDoc targetClass )
194     {
195         return _delegate.createConverter( targetClass );
196     }
197
198     public Iterator JavaDoc getConverterIds()
199     {
200         return _delegate.getConverterIds();
201     }
202
203     public Iterator JavaDoc getConverterTypes()
204     {
205         return _delegate.getConverterTypes();
206     }
207
208     public MethodBinding createMethodBinding( String JavaDoc ref, Class JavaDoc params[] )
209             throws ReferenceSyntaxException
210     {
211         MethodBinding mb = _delegate.createMethodBinding( ref, params );
212         
213         if ( ref.startsWith( BACKING_BINDING_START ) && ref.charAt( ref.length() - 1 ) == '}' )
214         {
215             String JavaDoc methodName = ref.substring( BACKING_BINDING_START.length(), ref.length() - 1 );
216             return new BackingClassMethodBinding( methodName, params, mb );
217         }
218         else
219         {
220             return mb;
221         }
222     }
223     
224     public Iterator JavaDoc getSupportedLocales()
225     {
226         return _delegate.getSupportedLocales();
227     }
228
229     public void setSupportedLocales( Collection JavaDoc locales )
230     {
231         _delegate.setSupportedLocales( locales );
232     }
233
234     public void addValidator( String JavaDoc validatorId, String JavaDoc validatorClass )
235     {
236         _delegate.addValidator( validatorId, validatorClass );
237     }
238
239     public Validator createValidator( String JavaDoc validatorId )
240             throws FacesException
241     {
242         return _delegate.createValidator( validatorId );
243     }
244
245     public Iterator JavaDoc getValidatorIds()
246     {
247         return _delegate.getValidatorIds();
248     }
249
250     public ValueBinding createValueBinding( String JavaDoc ref )
251             throws ReferenceSyntaxException
252     {
253         return _delegate.createValueBinding( ref );
254     }
255 }
256
Popular Tags