Merging of SWF-367 back into trunk. This has all of the SWF 2.0 goodies.
@@ -1,58 +0,0 @@
|
||||
package org.springframework.faces.el;
|
||||
|
||||
import javax.el.ELContext;
|
||||
import javax.el.ELResolver;
|
||||
import javax.el.ExpressionFactory;
|
||||
import javax.el.FunctionMapper;
|
||||
import javax.el.VariableMapper;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.springframework.binding.expression.el.DefaultELContextFactory;
|
||||
import org.springframework.binding.expression.el.ELExpressionParser;
|
||||
|
||||
/**
|
||||
* A JSF-aware ExpressionParser that allows JSF 1.1 managed beans to be referenced in expressions in the FlowDefinition.
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
public class Jsf11ELExpressionParser extends ELExpressionParser {
|
||||
|
||||
/**
|
||||
* Creates a new JSF 1.1 compatible expression parser
|
||||
* @param expressionFactory the unified EL expression factory implementation
|
||||
*/
|
||||
public Jsf11ELExpressionParser(ExpressionFactory expressionFactory) {
|
||||
super(expressionFactory, new Jsf11ELContextFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Inner helper class that plus in the EL Resolver that resolves expressions using JSF 1.1 APIs.
|
||||
*/
|
||||
private static class Jsf11ELContextFactory extends DefaultELContextFactory {
|
||||
|
||||
public ELContext getEvaluationContext(Object target) {
|
||||
return new Jsf11ELContext(FacesContext.getCurrentInstance());
|
||||
}
|
||||
|
||||
private static class Jsf11ELContext extends ELContext {
|
||||
|
||||
private ELResolver baseResolver;
|
||||
|
||||
public Jsf11ELContext(FacesContext context) {
|
||||
baseResolver = new Jsf11ELResolverAdapter(context);
|
||||
}
|
||||
|
||||
public ELResolver getELResolver() {
|
||||
return baseResolver;
|
||||
}
|
||||
|
||||
public FunctionMapper getFunctionMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public VariableMapper getVariableMapper() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package org.springframework.faces.el;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.el.ELContext;
|
||||
import javax.el.ELException;
|
||||
import javax.el.ELResolver;
|
||||
import javax.el.PropertyNotWritableException;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.el.EvaluationException;
|
||||
import javax.faces.el.PropertyNotFoundException;
|
||||
import javax.faces.el.PropertyResolver;
|
||||
import javax.faces.el.VariableResolver;
|
||||
|
||||
/**
|
||||
* An adapter for using JSF 1.1 {@link VariableResolver}s and {@link PropertyResolver}s in an {@link ELContext}.
|
||||
* @author Jeremy Grelle0
|
||||
*/
|
||||
public class Jsf11ELResolverAdapter extends ELResolver {
|
||||
|
||||
private FacesContext facesContext;
|
||||
|
||||
/**
|
||||
* Creates a new adapter that adapts JSF 1.1 EL constructs to the Unified EL Resolver construct.
|
||||
* @param facesContext the current faces context
|
||||
*/
|
||||
public Jsf11ELResolverAdapter(FacesContext facesContext) {
|
||||
this.facesContext = facesContext;
|
||||
}
|
||||
|
||||
public Class getCommonPropertyType(ELContext context, Object base) {
|
||||
return Object.class;
|
||||
}
|
||||
|
||||
public Iterator getFeatureDescriptors(ELContext context, Object base) {
|
||||
return Collections.EMPTY_LIST.iterator();
|
||||
}
|
||||
|
||||
public Class getType(ELContext context, Object base, Object property) {
|
||||
if (property == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
context.setPropertyResolved(true);
|
||||
if (base == null) {
|
||||
Object var = getVariableResolver().resolveVariable(facesContext, property.toString());
|
||||
return (var != null) ? var.getClass() : null;
|
||||
} else {
|
||||
if (base instanceof List || base.getClass().isArray()) {
|
||||
return getPropertyResolver().getType(base, Integer.parseInt(property.toString()));
|
||||
} else {
|
||||
return getPropertyResolver().getType(base, property);
|
||||
}
|
||||
}
|
||||
} catch (PropertyNotFoundException ex) {
|
||||
throw new javax.el.PropertyNotFoundException(ex.getMessage(), ex.getCause());
|
||||
} catch (EvaluationException ex) {
|
||||
throw new ELException(ex.getMessage(), ex.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
public Object getValue(ELContext context, Object base, Object property) {
|
||||
if (property == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
context.setPropertyResolved(true);
|
||||
if (base == null) {
|
||||
return getVariableResolver().resolveVariable(facesContext, property.toString());
|
||||
} else {
|
||||
if (base instanceof List || base.getClass().isArray()) {
|
||||
return getPropertyResolver().getValue(base, Integer.parseInt(property.toString()));
|
||||
} else {
|
||||
return getPropertyResolver().getValue(base, property);
|
||||
}
|
||||
}
|
||||
} catch (PropertyNotFoundException ex) {
|
||||
throw new javax.el.PropertyNotFoundException(ex.getMessage(), ex.getCause());
|
||||
} catch (EvaluationException ex) {
|
||||
throw new ELException(ex.getMessage(), ex.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isReadOnly(ELContext context, Object base, Object property) {
|
||||
if (property == null) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
context.setPropertyResolved(true);
|
||||
if (base == null) {
|
||||
return false; // VariableResolver provides no way to determine isReadOnly
|
||||
} else {
|
||||
if (base instanceof List || base.getClass().isArray()) {
|
||||
return getPropertyResolver().isReadOnly(base, Integer.parseInt(property.toString()));
|
||||
} else {
|
||||
return getPropertyResolver().isReadOnly(base, property);
|
||||
}
|
||||
}
|
||||
} catch (PropertyNotFoundException ex) {
|
||||
throw new javax.el.PropertyNotFoundException(ex.getMessage(), ex.getCause());
|
||||
} catch (EvaluationException ex) {
|
||||
throw new ELException(ex.getMessage(), ex.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(ELContext context, Object base, Object property, Object value) {
|
||||
if (property == null) {
|
||||
throw new PropertyNotWritableException("Property is Null");
|
||||
}
|
||||
try {
|
||||
context.setPropertyResolved(true);
|
||||
if (base instanceof List || base.getClass().isArray()) {
|
||||
getPropertyResolver().setValue(base, Integer.parseInt(property.toString()), value);
|
||||
} else {
|
||||
getPropertyResolver().setValue(base, property, value);
|
||||
}
|
||||
|
||||
} catch (PropertyNotFoundException ex) {
|
||||
throw new javax.el.PropertyNotFoundException(ex.getMessage(), ex.getCause());
|
||||
} catch (EvaluationException ex) {
|
||||
throw new ELException(ex.getMessage(), ex.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
private VariableResolver getVariableResolver() {
|
||||
return facesContext.getApplication().getVariableResolver();
|
||||
}
|
||||
|
||||
private PropertyResolver getPropertyResolver() {
|
||||
return facesContext.getApplication().getPropertyResolver();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package org.springframework.faces.el;
|
||||
|
||||
import javax.el.ELContext;
|
||||
import javax.el.ExpressionFactory;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.springframework.binding.expression.el.DefaultELContextFactory;
|
||||
import org.springframework.binding.expression.el.ELExpressionParser;
|
||||
|
||||
/**
|
||||
* A JSF-aware ExpressionParser that allows JSF 1.2 managed beans to be referenced in expressions in the FlowDefinition.
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
public class Jsf12ELExpressionParser extends ELExpressionParser {
|
||||
|
||||
/**
|
||||
* Creates a JSF 1.2 expression parser
|
||||
* @param expressionFactory the unified EL expression factory implementation to use
|
||||
*/
|
||||
public Jsf12ELExpressionParser(ExpressionFactory expressionFactory) {
|
||||
super(expressionFactory, new Jsf12ELContextFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple little helper that grabs the current EL context from the faces context to support EL expression
|
||||
* evaluation.
|
||||
*/
|
||||
private static class Jsf12ELContextFactory extends DefaultELContextFactory {
|
||||
public ELContext getEvaluationContext(Object target) {
|
||||
return FacesContext.getCurrentInstance().getELContext();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,34 +4,32 @@ import java.io.IOException;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.render.Renderer;
|
||||
|
||||
import org.apache.shale.remoting.Mechanism;
|
||||
import org.apache.shale.remoting.XhtmlHelper;
|
||||
import org.springframework.faces.ui.resource.FlowResourceHelper;
|
||||
|
||||
public class ExtJsRenderer extends Renderer {
|
||||
|
||||
private static final String EXT_CSS = "/org/springframework/faces/ui/ext/resources/css/ext-all.css";
|
||||
private static final String EXT_CSS = "/ext/resources/css/ext-all.css";
|
||||
|
||||
private static final String EXT_SCRIPT = "/org/springframework/faces/ui/ext/ext.js";
|
||||
private static final String EXT_SCRIPT = "/ext/ext.js";
|
||||
|
||||
private static final String SPRING_FACES_SCRIPT = "/org/springframework/faces/ui/SpringFaces.js";
|
||||
private static final String SPRING_FACES_SCRIPT = "/spring-faces/SpringFaces.js";
|
||||
|
||||
private XhtmlHelper resourceHelper = new XhtmlHelper();
|
||||
private FlowResourceHelper resourceHelper = new FlowResourceHelper();
|
||||
|
||||
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
|
||||
|
||||
ExtJsComponent extJsComponent = (ExtJsComponent) component;
|
||||
|
||||
ResponseWriter writer = context.getResponseWriter();
|
||||
if (extJsComponent.getIncludeExtStyles().equals(Boolean.TRUE)) {
|
||||
resourceHelper.renderStyleLink(context, EXT_CSS);
|
||||
}
|
||||
|
||||
if (extJsComponent.getIncludeExtStyles().equals(Boolean.TRUE))
|
||||
resourceHelper.linkStylesheet(context, extJsComponent, writer, Mechanism.CLASS_RESOURCE, EXT_CSS);
|
||||
if (extJsComponent.getIncludeExtScript().equals(Boolean.TRUE)) {
|
||||
resourceHelper.renderScriptLink(context, EXT_SCRIPT);
|
||||
}
|
||||
|
||||
if (extJsComponent.getIncludeExtScript().equals(Boolean.TRUE))
|
||||
resourceHelper.linkJavascript(context, extJsComponent, writer, Mechanism.CLASS_RESOURCE, EXT_SCRIPT);
|
||||
|
||||
resourceHelper.linkJavascript(context, extJsComponent, writer, Mechanism.CLASS_RESOURCE, SPRING_FACES_SCRIPT);
|
||||
resourceHelper.renderScriptLink(context, SPRING_FACES_SCRIPT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,13 @@ public class ExtValidateAllRenderer extends ExtJsRenderer {
|
||||
|
||||
ResponseWriter writer = context.getResponseWriter();
|
||||
|
||||
if (component.getChildCount() == 0)
|
||||
if (component.getChildCount() == 0) {
|
||||
throw new FacesException("A Spring Faces advisor expects to have at least one child component.");
|
||||
}
|
||||
|
||||
if (!(component.getChildren().get(0) instanceof UICommand))
|
||||
if (!(component.getChildren().get(0) instanceof UICommand)) {
|
||||
throw new FacesException("ValidateAll expects to have a child of type UICommand.");
|
||||
}
|
||||
|
||||
UIComponent advisedChild = (UIComponent) component.getChildren().get(0);
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
SpringFaces = {};
|
||||
|
||||
SpringFaces.advisors = [];
|
||||
|
||||
SpringFaces.ExtGenericFieldAdvisor = function(config){
|
||||
|
||||
Ext.apply(this, config);
|
||||
};
|
||||
|
||||
SpringFaces.ExtGenericFieldAdvisor.prototype = {
|
||||
|
||||
targetElId : "",
|
||||
msgElId : "",
|
||||
decoratorType : "",
|
||||
decorator : null,
|
||||
decoratorAttrs : "",
|
||||
|
||||
apply : function(){
|
||||
|
||||
var target = document.getElementById(this.targetElId);
|
||||
var msgEl = document.getElementById(this.msgElId);
|
||||
|
||||
this.decorator = eval("new "+ this.decoratorType + "(" + this.decoratorAttrs +");" );
|
||||
|
||||
this.decorator.msgTarget=msgEl;
|
||||
this.decorator.applyTo(target);
|
||||
}
|
||||
};
|
||||
|
||||
SpringFaces.applyAdvisors = function(){
|
||||
|
||||
for (var x=0; x<SpringFaces.advisors.length; x++) {
|
||||
SpringFaces.advisors[x].apply();
|
||||
}
|
||||
};
|
||||
|
||||
SpringFaces.validateAll = function(){
|
||||
var valid = true;
|
||||
for(x in SpringFaces.advisors) {
|
||||
if (SpringFaces.advisors[x].decorator &&
|
||||
!SpringFaces.advisors[x].decorator.validate()) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
};
|
||||
|
||||
Ext.onReady(SpringFaces.applyAdvisors);
|
||||
|
Before Width: | Height: | Size: 870 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 893 B |
|
Before Width: | Height: | Size: 865 B |
|
Before Width: | Height: | Size: 995 B |
|
Before Width: | Height: | Size: 884 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 992 B |
|
Before Width: | Height: | Size: 833 B |
|
Before Width: | Height: | Size: 1010 B |
|
Before Width: | Height: | Size: 1005 B |
|
Before Width: | Height: | Size: 810 B |
|
Before Width: | Height: | Size: 810 B |
|
Before Width: | Height: | Size: 810 B |
|
Before Width: | Height: | Size: 810 B |
|
Before Width: | Height: | Size: 851 B |
|
Before Width: | Height: | Size: 839 B |
|
Before Width: | Height: | Size: 1001 B |
|
Before Width: | Height: | Size: 949 B |
|
Before Width: | Height: | Size: 1016 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 995 B |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 819 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 825 B |
|
Before Width: | Height: | Size: 825 B |
|
Before Width: | Height: | Size: 868 B |
|
Before Width: | Height: | Size: 869 B |
|
Before Width: | Height: | Size: 832 B |
|
Before Width: | Height: | Size: 133 B |
|
Before Width: | Height: | Size: 947 B |
|
Before Width: | Height: | Size: 860 B |
|
Before Width: | Height: | Size: 834 B |
|
Before Width: | Height: | Size: 829 B |
|
Before Width: | Height: | Size: 817 B |
|
Before Width: | Height: | Size: 855 B |
|
Before Width: | Height: | Size: 701 B |
|
Before Width: | Height: | Size: 817 B |
|
Before Width: | Height: | Size: 829 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 823 B |
|
Before Width: | Height: | Size: 836 B |
|
Before Width: | Height: | Size: 837 B |
|
Before Width: | Height: | Size: 843 B |
|
Before Width: | Height: | Size: 839 B |
|
Before Width: | Height: | Size: 931 B |
|
Before Width: | Height: | Size: 930 B |
|
Before Width: | Height: | Size: 955 B |
|
Before Width: | Height: | Size: 648 B |
|
Before Width: | Height: | Size: 971 B |
|
Before Width: | Height: | Size: 697 B |
|
Before Width: | Height: | Size: 815 B |
|
Before Width: | Height: | Size: 771 B |
|
Before Width: | Height: | Size: 875 B |
|
Before Width: | Height: | Size: 884 B |
|
Before Width: | Height: | Size: 925 B |
|
Before Width: | Height: | Size: 925 B |
|
Before Width: | Height: | Size: 923 B |
|
Before Width: | Height: | Size: 923 B |
|
Before Width: | Height: | Size: 875 B |
|
Before Width: | Height: | Size: 875 B |
|
Before Width: | Height: | Size: 879 B |
|
Before Width: | Height: | Size: 879 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1015 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 955 B |
|
Before Width: | Height: | Size: 823 B |
|
Before Width: | Height: | Size: 823 B |
|
Before Width: | Height: | Size: 825 B |
|
Before Width: | Height: | Size: 826 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 842 B |
|
Before Width: | Height: | Size: 842 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 842 B |
|
Before Width: | Height: | Size: 843 B |
|
Before Width: | Height: | Size: 829 B |
|
Before Width: | Height: | Size: 838 B |