SWF-451 - Introduce a "Spring Javascript" javascript abstraction framework usable by both JSF and MVC environments.
SWF-454 - Create a Dojo 1.0 implementation of Spring Javascript
This commit is contained in:
@@ -32,7 +32,7 @@ public class AjaxEventInterceptorRenderer extends DojoRenderer {
|
||||
renderIds = processIds;
|
||||
}
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append("SpringFaces.advisors.push(new SpringFaces.DojoAjaxEventAdvisor({");
|
||||
script.append("Spring.advisors.push(new Spring.RemoteEventAdvisor({");
|
||||
script.append("event:'" + event + "'");
|
||||
script.append(", targetId: '" + ((UIComponent) component.getChildren().get(0)).getClientId(context) + "'");
|
||||
script.append(", sourceId : '" + component.getClientId(context) + "'");
|
||||
|
||||
@@ -19,7 +19,7 @@ public abstract class BaseDojoParentComponentRenderer extends BaseSpringFacesPar
|
||||
|
||||
private String dijitTheme = "tundra";
|
||||
|
||||
private String springFacesDojoJsResourceUri = "/spring-faces/SpringFaces-Dojo.js";
|
||||
private String springDojoJsResourceUri = "/spring/Spring-Dojo.js";
|
||||
|
||||
private FlowResourceHelper resourceHelper = new FlowResourceHelper();
|
||||
|
||||
@@ -33,7 +33,7 @@ public abstract class BaseDojoParentComponentRenderer extends BaseSpringFacesPar
|
||||
dojoAttributes.put("djConfig", "parseOnLoad: true");
|
||||
resourceHelper.renderScriptLink(context, dojoJsResourceUri, dojoAttributes);
|
||||
|
||||
resourceHelper.renderScriptLink(context, springFacesDojoJsResourceUri);
|
||||
resourceHelper.renderScriptLink(context, springDojoJsResourceUri);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.faces.ui.resource.FlowResourceHelper;
|
||||
|
||||
public abstract class BaseSpringFacesParentComponentRenderer extends BaseParentComponentRenderer {
|
||||
|
||||
private String springFacesJsResourceUri = "/spring-faces/SpringFaces.js";
|
||||
private String springJsResourceUri = "/spring/Spring.js";
|
||||
|
||||
private FlowResourceHelper resourceHelper = new FlowResourceHelper();
|
||||
|
||||
@@ -17,6 +17,6 @@ public abstract class BaseSpringFacesParentComponentRenderer extends BaseParentC
|
||||
|
||||
super.encodeBegin(context, component);
|
||||
|
||||
resourceHelper.renderScriptLink(context, springFacesJsResourceUri);
|
||||
resourceHelper.renderScriptLink(context, springJsResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class DojoAdvisorRenderer extends DojoRenderer {
|
||||
|
||||
writer.startElement(SCRIPT_ELEMENT, component);
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append(" SpringFaces.advisors.push(new SpringFaces.DojoGenericFieldAdvisor({ ");
|
||||
script.append(" Spring.advisors.push(new Spring.ValidatingFieldAdvisor({ ");
|
||||
script.append(" targetElId : '" + advisedChild.getClientId(context) + "', ");
|
||||
script.append(" msgElId : '" + advisedChild.getClientId(context) + ":msg', ");
|
||||
script.append(" decoratorType : '" + ((DojoAdvisor) component).getDojoComponentType() + "', ");
|
||||
|
||||
@@ -34,7 +34,7 @@ public class DojoRenderer extends SpringFacesRenderer {
|
||||
|
||||
private String dijitTheme = "tundra";
|
||||
|
||||
private String springFacesDojoJsResourceUri = "/spring-faces/SpringFaces-Dojo.js";
|
||||
private String springDojoJsResourceUri = "/spring/Spring-Dojo.js";
|
||||
|
||||
private FlowResourceHelper resourceHelper = new FlowResourceHelper();
|
||||
|
||||
@@ -49,6 +49,6 @@ public class DojoRenderer extends SpringFacesRenderer {
|
||||
dojoAttributes.put("djConfig", "parseOnLoad: true");
|
||||
resourceHelper.renderScriptLink(context, dojoJsResourceUri, dojoAttributes);
|
||||
|
||||
resourceHelper.renderScriptLink(context, springFacesDojoJsResourceUri);
|
||||
resourceHelper.renderScriptLink(context, springDojoJsResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ExtAdvisorRenderer extends ExtJsRenderer {
|
||||
|
||||
writer.startElement(SCRIPT_ELEMENT, component);
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append(" SpringFaces.advisors.push(new SpringFaces.ExtGenericFieldAdvisor({ ");
|
||||
script.append(" Spring.advisors.push(new Spring.ValidatingFieldAdvisor({ ");
|
||||
script.append(" targetElId : '" + advisedChild.getClientId(context) + "', ");
|
||||
script.append(" msgElId : '" + advisedChild.getClientId(context) + ":msg', ");
|
||||
script.append(" decoratorType : '" + ((ExtAdvisor) component).getExtComponentType() + "', ");
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ExtJsRenderer extends SpringFacesRenderer {
|
||||
|
||||
private static final String EXT_SCRIPT = "/ext/ext.js";
|
||||
|
||||
private static final String SPRING_FACES_EXT_SCRIPT = "/spring-faces/SpringFaces-Ext.js";
|
||||
private static final String SPRING_EXT_SCRIPT = "/spring/Spring-Ext.js";
|
||||
|
||||
private FlowResourceHelper resourceHelper = new FlowResourceHelper();
|
||||
|
||||
@@ -46,6 +46,6 @@ public class ExtJsRenderer extends SpringFacesRenderer {
|
||||
resourceHelper.renderScriptLink(context, EXT_SCRIPT);
|
||||
}
|
||||
|
||||
resourceHelper.renderScriptLink(context, SPRING_FACES_EXT_SCRIPT);
|
||||
resourceHelper.renderScriptLink(context, SPRING_EXT_SCRIPT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoParentComponentRen
|
||||
if (!StringUtils.hasText(renderIds)) {
|
||||
renderIds = processIds;
|
||||
}
|
||||
onclick.append("SpringFaces.AjaxHandler.submitForm('" + component.getClientId(context) + "', ");
|
||||
onclick.append("Spring.RemotingHandler.submitForm('" + component.getClientId(context) + "', ");
|
||||
onclick.append("'" + RendererUtils.getFormId(context, component) + "', ");
|
||||
onclick.append("'" + processIds + "', '" + renderIds + "', " + encodeParams(context, component)
|
||||
+ "); return false;");
|
||||
|
||||
@@ -107,8 +107,7 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
|
||||
|
||||
advisorParams.append("}");
|
||||
StringBuffer advisorScript = new StringBuffer();
|
||||
advisorScript.append("SpringFaces.advisors.push(new SpringFaces.DojoCommandLinkAdvisor("
|
||||
+ advisorParams.toString() + ")");
|
||||
advisorScript.append("Spring.advisors.push(new Spring.CommandLinkAdvisor(" + advisorParams.toString() + ")");
|
||||
// Apply the advisor immediately if this is an AJAX request
|
||||
if (JsfUtils.isAsynchronousFlowRequest()) {
|
||||
advisorScript.append(".apply()");
|
||||
|
||||
@@ -25,13 +25,13 @@ import org.springframework.faces.ui.resource.FlowResourceHelper;
|
||||
|
||||
public class SpringFacesRenderer extends Renderer {
|
||||
|
||||
private String springFacesJsResourceUri = "/spring-faces/SpringFaces.js";
|
||||
private String springJsResourceUri = "/spring/Spring.js";
|
||||
|
||||
private FlowResourceHelper resourceHelper = new FlowResourceHelper();
|
||||
|
||||
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
|
||||
|
||||
resourceHelper.renderScriptLink(context, springFacesJsResourceUri);
|
||||
resourceHelper.renderScriptLink(context, springJsResourceUri);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ValidateAllRenderer extends SpringFacesRenderer {
|
||||
+ "');");
|
||||
script.append(" var " + handlerVar + " = " + elementVar + ".onclick;");
|
||||
script.append(elementVar + ".onclick" + " = function(){");
|
||||
script.append(" if(!SpringFaces.validateAll()) return false; ");
|
||||
script.append(" if(!Spring.validateAll()) return false; ");
|
||||
script.append(handlerVar + "();");
|
||||
script.append("};");
|
||||
|
||||
|
||||
@@ -117,6 +117,10 @@ public class ResourceServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
private URL getRequestResourceURL(String localResourcePath) throws MalformedURLException {
|
||||
if (localResourcePath.contains("/resources")){
|
||||
localResourcePath = localResourcePath.replaceAll("/resources", "");
|
||||
}
|
||||
|
||||
String jarResourcePath = "META-INF" + localResourcePath;
|
||||
|
||||
URL resource;
|
||||
|
||||
Reference in New Issue
Block a user