You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2004/02/27 14:32:18 UTC
cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding JavaScriptJXPathBinding.java
antonio 2004/02/27 05:32:18
Modified: src/blocks/woody/java/org/apache/cocoon/woody/binding
JavaScriptJXPathBinding.java
Log:
Adding log messages
Revision Changes Path
1.8 +59 -53 cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JavaScriptJXPathBinding.java
Index: JavaScriptJXPathBinding.java
===================================================================
RCS file: /home/cvs//cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JavaScriptJXPathBinding.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JavaScriptJXPathBinding.java 3 Feb 2004 12:26:21 -0000 1.7
+++ JavaScriptJXPathBinding.java 27 Feb 2004 13:32:18 -0000 1.8
@@ -75,7 +75,9 @@
private final Script loadScript;
private final Script saveScript;
- public JavaScriptJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String id, String path, Script loadScript, Script saveScript) {
+ public JavaScriptJXPathBinding(
+ JXPathBindingBuilderBase.CommonAttributes commonAtts, String id,
+ String path, Script loadScript, Script saveScript) {
super(commonAtts);
this.id = id;
this.path = path;
@@ -84,64 +86,68 @@
}
public void doLoad(Widget frmModel, JXPathContext jctx) {
- if (this.loadScript == null) {
- return;
- }
-
- Widget widget = frmModel.getWidget(this.id);
-
- // Move to widget context
- Pointer pointer = jctx.getPointer(this.path);
+ if (this.loadScript != null) {
+ Widget widget = frmModel.getWidget(this.id);
+
+ // Move to widget context
+ Pointer pointer = jctx.getPointer(this.path);
+
+ // FIXME: remove this ugly hack and get the request from the
+ // Avalon context once binding builder are real components
+ Request request = ObjectModelHelper.getRequest(CocoonComponentManager.getCurrentEnvironment().getObjectModel());
- // FIXME: remove this ugly hack and get the request from the Avalon context once
- // binding builder are real components
- Request request = ObjectModelHelper.getRequest(CocoonComponentManager.getCurrentEnvironment().getObjectModel());
-
- try {
- Map values = new HashMap(3);
- values.put("widget", widget);
- values.put("jxpathPointer", pointer);
- if (pointer.getNode() != null) {
- values.put("jxpathContext", jctx.getRelativeContext(pointer));
+ try {
+ Map values = new HashMap(3);
+ values.put("widget", widget);
+ values.put("jxpathPointer", pointer);
+ if (pointer.getNode() != null) {
+ values.put("jxpathContext", jctx.getRelativeContext(pointer));
+ }
+
+ JavaScriptHelper.execScript(this.loadScript, values, request);
+
+ } catch(RuntimeException re) {
+ // rethrow
+ throw re;
+ } catch(Exception e) {
+ throw new CascadingRuntimeException("Error invoking JavaScript event handler", e);
+ }
+ } else {
+ if (this.getLogger().isInfoEnabled()) {
+ this.getLogger().info("[Javascript Binding] - loadForm: No javascript code avaliable. Widget id=" + this.getId());
}
-
- JavaScriptHelper.execScript(this.loadScript, values, request);
-
- } catch(RuntimeException re) {
- // rethrow
- throw re;
- } catch(Exception e) {
- throw new CascadingRuntimeException("Error invoking JavaScript event handler", e);
}
}
public void doSave(Widget frmModel, JXPathContext jctx) throws BindingException {
- if (this.saveScript == null) {
- return;
- }
-
- Widget widget = frmModel.getWidget(this.id);
-
- // Move to widget context and create the path if needed
- Pointer pointer = jctx.createPath(this.path);
- JXPathContext widgetCtx = jctx.getRelativeContext(pointer);
- try {
- // FIXME: remove this ugly hack and get the request from the Avalon context once
- // binding builder are real components
- Request request = ObjectModelHelper.getRequest(CocoonComponentManager.getCurrentEnvironment().getObjectModel());
+ if (this.saveScript != null) {
+ Widget widget = frmModel.getWidget(this.id);
- Map values = new HashMap();
- values.put("widget", widget);
- values.put("jxpathContext", widgetCtx);
- values.put("jxpathPointer", pointer);
-
- JavaScriptHelper.execScript(this.saveScript, values, request);
-
- } catch(RuntimeException re) {
- // rethrow
- throw re;
- } catch(Exception e) {
- throw new CascadingRuntimeException("Error invoking JavaScript event handler", e);
+ // Move to widget context and create the path if needed
+ Pointer pointer = jctx.createPath(this.path);
+ JXPathContext widgetCtx = jctx.getRelativeContext(pointer);
+ try {
+ // FIXME: remove this ugly hack and get the request from the Avalon context once
+ // binding builder are real components
+ Request request = ObjectModelHelper.getRequest(CocoonComponentManager.getCurrentEnvironment().getObjectModel());
+
+ Map values = new HashMap();
+ values.put("widget", widget);
+ values.put("jxpathContext", widgetCtx);
+ values.put("jxpathPointer", pointer);
+
+ JavaScriptHelper.execScript(this.saveScript, values, request);
+
+ } catch(RuntimeException re) {
+ // rethrow
+ throw re;
+ } catch(Exception e) {
+ throw new CascadingRuntimeException("Error invoking JavaScript event handler", e);
+ }
+ } else {
+ if (this.getLogger().isInfoEnabled()) {
+ this.getLogger().info("[Javascript Binding] - saveForm: No javascript code avaliable. <wb:javascript id=" + this.getId() + ">");
+ }
}
}
}