coliver 2003/02/23 14:52:37
Modified: src/java/org/apache/cocoon/components/flow/javascript
ScriptablePointer.java
ScriptablePropertyPointer.java
ScriptablePropertyHandler.java
Log:
removed println's
Revision Changes Path
1.3 +4 -7
xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/ScriptablePointer.java
Index: ScriptablePointer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/ScriptablePointer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ScriptablePointer.java 23 Feb 2003 19:20:25 -0000 1.2
+++ ScriptablePointer.java 23 Feb 2003 22:52:37 -0000 1.3
@@ -68,9 +68,9 @@
public boolean isCollection() {
if (node instanceof NativeArray) {
- return true;
- }
- return false;
+ return true;
+ }
+ return false;
}
public ScriptablePointer(QName name,
@@ -95,10 +95,7 @@
}
public void setValue(Object value){
- System.out.println("attempt to set " + getName() + " to " + value);
- System.out.println("node="+node + "->"
+java.util.Arrays.asList(node.getIds()));
- getParent().setValue(value);
- //handler.setProperty(node, getName().toString(), value);
+ getParent().setValue(value);
}
}
1.3 +38 -44
xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyPointer.java
Index: ScriptablePropertyPointer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyPointer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ScriptablePropertyPointer.java 23 Feb 2003 19:20:25 -0000 1.2
+++ ScriptablePropertyPointer.java 23 Feb 2003 22:52:37 -0000 1.3
@@ -67,9 +67,9 @@
Object obj = getBaseValue();
if (obj instanceof Scriptable) {
Scriptable node = (Scriptable)obj;
- if (node instanceof NativeArray) {
- return (int)((NativeArray)node).jsGet_length();
- }
+ if (node instanceof NativeArray) {
+ return (int)((NativeArray)node).jsGet_length();
+ }
if (ScriptableObject.hasProperty(node, "length")) {
Object val = ScriptableObject.getProperty(node, "length");
if (val instanceof Number) {
@@ -81,21 +81,21 @@
}
public Object getValue() {
- Object val = getNode();
- if (val instanceof NativeArray) {
- NativeArray arr = (NativeArray)val;
- List list = new LinkedList();
- int len = (int)arr.jsGet_length();
- for (int i = 0; i < len; i++) {
- Object obj = arr.get(i, arr);
- if (obj == Undefined.instance) {
- obj = null;
- }
- list.add(obj);
- }
- return list;
- }
- return super.getValue();
+ Object val = getNode();
+ if (val instanceof NativeArray) {
+ NativeArray arr = (NativeArray)val;
+ List list = new LinkedList();
+ int len = (int)arr.jsGet_length();
+ for (int i = 0; i < len; i++) {
+ Object obj = arr.get(i, arr);
+ if (obj == Undefined.instance) {
+ obj = null;
+ }
+ list.add(obj);
+ }
+ return list;
+ }
+ return super.getValue();
}
public void setValue(Object value){
@@ -106,7 +106,7 @@
if (val instanceof Scriptable) {
ScriptableObject.putProperty((Scriptable)val, index, value);
} else {
- super.setValue(value);
+ super.setValue(value);
}
}
}
@@ -117,13 +117,13 @@
} else {
Object val = handler.getProperty(getBean(), getPropertyName());
if (val instanceof Scriptable) {
- try {
- ScriptableObject.deleteProperty((Scriptable)val, index);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ try {
+ ScriptableObject.deleteProperty((Scriptable)val, index);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
} else {
- super.remove();
+ super.remove();
}
}
}
@@ -131,16 +131,16 @@
public boolean isCollection() {
Object obj = getBaseValue();
if (obj instanceof NativeArray) {
- return true;
- }
- return super.isCollection();
+ return true;
+ }
+ return super.isCollection();
}
public String asPath(){
Object obj = getBaseValue();
- if (!(obj instanceof Scriptable)) {
- return super.asPath();
- }
+ if (!(obj instanceof Scriptable)) {
+ return super.asPath();
+ }
StringBuffer buffer = new StringBuffer();
buffer.append(getParent().asPath());
if (buffer.length() == 0){
@@ -173,25 +173,19 @@
}
public Object getImmediateNode() {
- System.out.println("get immediate node: " + getBean() + ": " +
- getPropertyName() + ": " +
- index);
Object value;
if (index == WHOLE_COLLECTION) {
value = handler.getProperty(getBean(), getPropertyName());
}
else {
value = handler.getProperty(getBean(), getPropertyName());
- if (value instanceof Scriptable) {
- System.out.println("getting indexed property: " +
- getPropertyName() + ": " +
- index);
- value = ScriptableObject.getProperty((Scriptable)value, index);
- if (value == ScriptableObject.NOT_FOUND) {
- value = null;
- } else if (value instanceof Wrapper) {
- value = ((Wrapper)value).unwrap();
- }
+ if (value instanceof Scriptable) {
+ value = ScriptableObject.getProperty((Scriptable)value, index);
+ if (value == ScriptableObject.NOT_FOUND) {
+ value = null;
+ } else if (value instanceof Wrapper) {
+ value = ((Wrapper)value).unwrap();
+ }
} else {
return super.getImmediateNode();
}
1.3 +24 -29
xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyHandler.java
Index: ScriptablePropertyHandler.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/ScriptablePropertyHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ScriptablePropertyHandler.java 23 Feb 2003 19:20:25 -0000 1.2
+++ ScriptablePropertyHandler.java 23 Feb 2003 22:52:37 -0000 1.3
@@ -53,34 +53,31 @@
public Object getProperty(Object obj, String propertyName) {
Context cx = null;
- System.out.println("getProperty: " + propertyName);
try {
cx = Context.enter();
Scriptable s = (Scriptable)obj;
- System.out.println("s="+s);
Object result = ScriptableObject.getProperty(s, propertyName);
if (result == ScriptableObject.NOT_FOUND) {
- result = ScriptableObject.getProperty(s, "get" +
propertyName.substring(0, 1).toUpperCase() + (propertyName.length() > 1 ?
propertyName.substring(1) : ""));
- if (result != ScriptableObject.NOT_FOUND &&
- result instanceof Function) {
- try {
- result = ((Function)result).call(cx,
-
ScriptableObject.getTopLevelScope(s), s, new Object[] {});
- } catch (JavaScriptException exc) {
- exc.printStackTrace();
- result = Undefined.instance;
- }
- }
- if (result == Undefined.instance ||
- result == Scriptable.NOT_FOUND) {
- result = null;
- }
+ result = ScriptableObject.getProperty(s, "get" +
propertyName.substring(0, 1).toUpperCase() + (propertyName.length() > 1 ?
propertyName.substring(1) : ""));
+ if (result != ScriptableObject.NOT_FOUND &&
+ result instanceof Function) {
+ try {
+ result = ((Function)result).call(cx,
+
ScriptableObject.getTopLevelScope(s), s, new Object[] {});
+ } catch (JavaScriptException exc) {
+ exc.printStackTrace();
+ result = Undefined.instance;
+ }
+ }
+ if (result == Undefined.instance ||
+ result == Scriptable.NOT_FOUND) {
+ result = null;
+ }
} else if (result instanceof Wrapper) {
result = ((Wrapper)result).unwrap();
} else if (result == Undefined.instance) {
- result = null;
- }
- System.out.println("getProperty: " + propertyName + " = " + result);
+ result = null;
+ }
return result;
} finally {
Context.exit();
@@ -112,15 +109,13 @@
Context cx = null;
try {
cx = Context.enter();
- System.out.println("setProperty: " + propertyName +
- " = " + Context.toObject(value, (Scriptable)obj));
- if (!(value == null
- || value instanceof String
- || value instanceof Number
- || value instanceof Boolean)) {
- value = Context.toObject(value,
- (Scriptable)obj);
- }
+ if (!(value == null
+ || value instanceof String
+ || value instanceof Number
+ || value instanceof Boolean)) {
+ value = Context.toObject(value,
+ (Scriptable)obj);
+ }
ScriptableObject.putProperty((Scriptable)obj,
propertyName, value);
} finally {