1 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 ; 39 import java.util.Iterator ; 40 import java.util.Locale ; 41 42 46 public class PageFlowApplication 47 extends Application 48 { 49 private static final String 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 getDefaultLocale() 77 { 78 return _delegate.getDefaultLocale(); 79 } 80 81 public void setDefaultLocale( Locale locale ) 82 { 83 _delegate.setDefaultLocale( locale ); 84 } 85 86 public String getDefaultRenderKitId() 87 { 88 return _delegate.getDefaultRenderKitId(); 89 } 90 91 public void setDefaultRenderKitId( String renderKitId ) 92 { 93 _delegate.setDefaultRenderKitId( renderKitId ); 94 } 95 96 public String getMessageBundle() 97 { 98 return _delegate.getMessageBundle(); 99 } 100 101 public void setMessageBundle( String 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 componentType, String componentClass ) 157 { 158 _delegate.addComponent( componentType, componentClass ); 159 } 160 161 public UIComponent createComponent( String componentType ) 162 throws FacesException 163 { 164 return _delegate.createComponent( componentType ); 165 } 166 167 public UIComponent createComponent( ValueBinding componentBinding, FacesContext context, String componentType ) 168 throws FacesException 169 { 170 return _delegate.createComponent( componentBinding, context, componentType ); 171 } 172 173 public Iterator getComponentTypes() 174 { 175 return _delegate.getComponentTypes(); 176 } 177 178 public void addConverter( String converterId, String converterClass ) 179 { 180 _delegate.addConverter( converterId, converterClass ); 181 } 182 183 public void addConverter( Class targetClass, String converterClass ) 184 { 185 _delegate.addConverter( targetClass, converterClass ); 186 } 187 188 public Converter createConverter( String converterId ) 189 { 190 return _delegate.createConverter( converterId ); 191 } 192 193 public Converter createConverter( Class targetClass ) 194 { 195 return _delegate.createConverter( targetClass ); 196 } 197 198 public Iterator getConverterIds() 199 { 200 return _delegate.getConverterIds(); 201 } 202 203 public Iterator getConverterTypes() 204 { 205 return _delegate.getConverterTypes(); 206 } 207 208 public MethodBinding createMethodBinding( String ref, Class 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 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 getSupportedLocales() 225 { 226 return _delegate.getSupportedLocales(); 227 } 228 229 public void setSupportedLocales( Collection locales ) 230 { 231 _delegate.setSupportedLocales( locales ); 232 } 233 234 public void addValidator( String validatorId, String validatorClass ) 235 { 236 _delegate.addValidator( validatorId, validatorClass ); 237 } 238 239 public Validator createValidator( String validatorId ) 240 throws FacesException 241 { 242 return _delegate.createValidator( validatorId ); 243 } 244 245 public Iterator getValidatorIds() 246 { 247 return _delegate.getValidatorIds(); 248 } 249 250 public ValueBinding createValueBinding( String ref ) 251 throws ReferenceSyntaxException 252 { 253 return _delegate.createValueBinding( ref ); 254 } 255 } 256 | Popular Tags |