[jboss-cvs] jboss-seam/src/main/org/jboss/seam/jsf ...
Gavin King
gavin.king at jboss.com
Wed Oct 11 21:37:28 EDT 2006
User: gavin
Date: 06/10/11 21:37:28
Modified: src/main/org/jboss/seam/jsf SeamPhaseListener.java
Added: src/main/org/jboss/seam/jsf SeamApplication11.java
SeamApplication12.java SeamApplicationFactory.java
Removed: src/main/org/jboss/seam/jsf SeamApplication.java
Log:
support for JSF 1.2 RI
Revision Changes Path
1.90 +1 -14 jboss-seam/src/main/org/jboss/seam/jsf/SeamPhaseListener.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamPhaseListener.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/jsf/SeamPhaseListener.java,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- SeamPhaseListener.java 11 Oct 2006 04:42:12 -0000 1.89
+++ SeamPhaseListener.java 12 Oct 2006 01:37:28 -0000 1.90
@@ -34,20 +34,7 @@
public class SeamPhaseListener extends AbstractSeamPhaseListener
{
- private static final Log log = LogFactory.getLog( SeamPhaseListener.class );
-
- public SeamPhaseListener()
- {
- try
- {
- ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
- factory.setApplication( new SeamApplication( factory.getApplication() ) );
- }
- catch (RuntimeException re)
- {
- log.info("Unable to replace JSF Application object");
- }
- }
+ private static final Log log = LogFactory.getLog(SeamPhaseListener.class);
public void beforePhase(PhaseEvent event)
{
1.1 date: 2006/10/12 01:37:28; author: gavin; state: Exp;jboss-seam/src/main/org/jboss/seam/jsf/SeamApplication11.java
Index: SeamApplication11.java
===================================================================
package org.jboss.seam.jsf;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;
import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.application.NavigationHandler;
import javax.faces.application.StateManager;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.el.MethodBinding;
import javax.faces.el.PropertyResolver;
import javax.faces.el.ReferenceSyntaxException;
import javax.faces.el.ValueBinding;
import javax.faces.el.VariableResolver;
import javax.faces.event.ActionListener;
import javax.faces.validator.Validator;
import org.jboss.seam.actionparam.ActionParamMethodBinding;
import org.jboss.seam.actionparam.ActionParamValueBinding;
public class SeamApplication11 extends Application
{
protected Application application;
public Application getDelegate()
{
return application;
}
public SeamApplication11(Application app)
{
this.application = app;
}
@Override
public void addComponent(String componentType, String componentClass)
{
application.addComponent(componentType, componentClass);
}
@Override
public void addConverter(String converterId, String converterClass)
{
application.addConverter(converterId, converterClass);
}
@Override
public void addConverter(Class targetClass, String converterClass)
{
application.addConverter(targetClass, converterClass);
}
@Override
public void addValidator(String validatorId, String validatorClass)
{
application.addValidator(validatorId, validatorClass);
}
@Override
public UIComponent createComponent(String componentType)
throws FacesException
{
return application.createComponent(componentType);
}
@Override
public UIComponent createComponent(ValueBinding componentBinding,
FacesContext context, String componentType) throws FacesException
{
return application.createComponent(componentBinding, context, componentType);
}
@Override
public Converter createConverter(String converterId)
{
return application.createConverter(converterId);
}
@Override
public Converter createConverter(Class targetClass)
{
return application.createConverter(targetClass);
}
@Override
public MethodBinding createMethodBinding(String ref, Class[] params)
throws ReferenceSyntaxException
{
return new ActionParamMethodBinding(application, ref);
//return app.createMethodBinding(ref, params);
}
@Override
public Validator createValidator(String validatorId) throws FacesException
{
return application.createValidator(validatorId);
}
@Override
public ValueBinding createValueBinding(String ref)
throws ReferenceSyntaxException
{
return new ActionParamValueBinding(application, ref);
//return app.createValueBinding(ref);
}
@Override
public ActionListener getActionListener()
{
return application.getActionListener();
}
@Override
public Iterator getComponentTypes()
{
return application.getComponentTypes();
}
@Override
public Iterator getConverterIds()
{
return application.getConverterIds();
}
@Override
public Iterator getConverterTypes()
{
return application.getComponentTypes();
}
@Override
public Locale getDefaultLocale()
{
return application.getDefaultLocale();
}
@Override
public String getDefaultRenderKitId()
{
return application.getDefaultRenderKitId();
}
@Override
public String getMessageBundle()
{
return application.getMessageBundle();
}
@Override
public NavigationHandler getNavigationHandler()
{
return application.getNavigationHandler();
}
@Override
public PropertyResolver getPropertyResolver()
{
return application.getPropertyResolver();
}
@Override
public StateManager getStateManager()
{
return application.getStateManager();
}
@Override
public Iterator getSupportedLocales()
{
return application.getSupportedLocales();
}
@Override
public Iterator getValidatorIds()
{
return application.getValidatorIds();
}
@Override
public VariableResolver getVariableResolver()
{
return application.getVariableResolver();
}
@Override
public ViewHandler getViewHandler()
{
return application.getViewHandler();
}
@Override
public void setActionListener(ActionListener listener)
{
application.setActionListener(listener);
}
@Override
public void setDefaultLocale(Locale locale)
{
application.setDefaultLocale(locale);
}
@Override
public void setDefaultRenderKitId(String renderKitId)
{
application.setDefaultRenderKitId(renderKitId);
}
@Override
public void setMessageBundle(String bundle)
{
application.setMessageBundle(bundle);
}
@Override
public void setNavigationHandler(NavigationHandler handler)
{
application.setNavigationHandler(handler);
}
@Override
public void setPropertyResolver(PropertyResolver resolver)
{
application.setPropertyResolver(resolver);
}
@Override
public void setStateManager(StateManager manager)
{
application.setStateManager(manager);
}
@Override
public void setSupportedLocales(Collection locales)
{
application.setSupportedLocales(locales);
}
@Override
public void setVariableResolver(VariableResolver resolver)
{
application.setVariableResolver(resolver);
}
@Override
public void setViewHandler(ViewHandler handler)
{
application.setViewHandler(handler);
}
}
1.1 date: 2006/10/12 01:37:28; author: gavin; state: Exp;jboss-seam/src/main/org/jboss/seam/jsf/SeamApplication12.java
Index: SeamApplication12.java
===================================================================
package org.jboss.seam.jsf;
import java.lang.reflect.Method;
import javax.el.ELException;
import javax.el.ELResolver;
import javax.el.ExpressionFactory;
import javax.faces.application.Application;
import javax.faces.context.FacesContext;
public class SeamApplication12 extends SeamApplication11
{
private final Method getELResolverMethod;
private final Method addELResolverMethod;
private final Method getExpressionFactoryMethod;
private final Method evaluateExpressionMethod;
public SeamApplication12(Application application)
{
super(application);
try
{
getELResolverMethod = application.getClass().getMethod("getELResolver");
addELResolverMethod = application.getClass().getMethod("addELResolver", ELResolver.class);
getExpressionFactoryMethod = application.getClass().getMethod("getExpressionFactory");
evaluateExpressionMethod = application.getClass().getMethod("evaluateExpressionGet", FacesContext.class, String.class, Class.class);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
public ELResolver getELResolver()
{
try
{
return (ELResolver) getELResolverMethod.invoke(application);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
public void addELResolver(ELResolver resolver)
{
try
{
addELResolverMethod.invoke(application, resolver);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
public ExpressionFactory getExpressionFactory() {
try
{
return (ExpressionFactory) getExpressionFactoryMethod.invoke(application);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
public Object evaluateExpressionGet(FacesContext context, String expression,
Class expectedType) throws ELException {
try
{
return evaluateExpressionMethod.invoke(application, context, expression, expectedType);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}
1.1 date: 2006/10/12 01:37:28; author: gavin; state: Exp;jboss-seam/src/main/org/jboss/seam/jsf/SeamApplicationFactory.java
Index: SeamApplicationFactory.java
===================================================================
package org.jboss.seam.jsf;
import javax.faces.application.Application;
import javax.faces.application.ApplicationFactory;
public class SeamApplicationFactory extends ApplicationFactory
{
private final ApplicationFactory delegate;
private boolean isJsf12;
public SeamApplicationFactory(ApplicationFactory af)
{
delegate = af;
try
{
delegate.getApplication().getClass().getMethod("getELResolver");
isJsf12 = true;
}
catch (NoSuchMethodException nsme)
{
isJsf12 = false;
}
}
@Override
public Application getApplication()
{
return isJsf12 ?
new SeamApplication12( delegate.getApplication() ) :
new SeamApplication11( delegate.getApplication() );
}
@Override
public void setApplication(Application application)
{
delegate.setApplication(application);
}
}
More information about the jboss-cvs-commits
mailing list