haul 2002/08/09 01:38:23 Modified: src/java/org/apache/cocoon/components/flow/javascript JSCocoon.java ScriptableMap.java Log: Deleted unused code / corrections. Revision Changes Path 1.4 +0 -14 xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/JSCocoon.java Index: JSCocoon.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/JSCocoon.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- JSCocoon.java 2 Jul 2002 09:04:07 -0000 1.3 +++ JSCocoon.java 9 Aug 2002 08:38:23 -0000 1.4 @@ -282,23 +282,9 @@ // what should be done with the redirector ?? // ignore it or call sendPage with it? - // return JSCocoon.mapToObject(result); return (result!=null? new ScriptableMap(result) : null); } - // Really needed? Java objects are accessible from JS... - // Besides, evaluating the returned object throws an error... - // I reckon it's a missing prototype but have no idea what to - // pass to setPrototype. - public static Scriptable mapToObject( Map map ) { - NativeObject obj = new NativeObject(); - Iterator iter = map.keySet().iterator(); - while(iter.hasNext()){ - String key = (String) iter.next(); - obj.put(key, obj, (String) map.get(key)); - } - return obj; - } public static Parameters jsobjectToParameters(Scriptable jsobject){ Parameters params = new Parameters(); 1.2 +5 -56 xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/ScriptableMap.java Index: ScriptableMap.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/ScriptableMap.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ScriptableMap.java 2 Jul 2002 08:32:07 -0000 1.1 +++ ScriptableMap.java 9 Aug 2002 08:38:23 -0000 1.2 @@ -75,47 +75,25 @@ return "Map"; } - /** - * Add pseudo-property "length" as map.size(). Any existing key - * "length" will be hidden by this and only accessible by index - * number. - */ public boolean has(String name, Scriptable start) { - return name.equals("length") || this.map.containsKey(name); + return this.map.containsKey(name); } + /** + * no numeric properties + */ public boolean has(int index, Scriptable start) { - return 0 <= index && index < this.map.size(); + return false; } - /** - * Add pseudo-property "length" as map.size(). Any existing key - * "length" will be hidden by this and only accessible by index - * number. - */ public Object get(String name, Scriptable start) { - if (name.equals("length")) - return new Integer(this.map.size()); if (this.map.containsKey(name)) return this.map.get(name); return NOT_FOUND; } - /** - * Access an entry by index number. The position is determined - * through the position of the key in the enumeration - * map.values().iterator() - */ public Object get(int index, Scriptable start) { - if (0 <= index && index < this.map.size()) { - Iterator iter = this.map.values().iterator(); - Object result = null; - for (int i = 0; i < index; i++) - iter.next(); - result = iter.next(); - return result; - } return NOT_FOUND; } @@ -126,43 +104,14 @@ map.put(name, value); } - /** - * Allow only to change an existing entry. The position is - * determined through the position of the key in the enumeration - * map.values().iterator() - */ public void put(int index, Scriptable start, Object value) { - if (0 <= index && index < this.map.size()) { - Iterator iter = this.map.keySet().iterator(); - Object key = null; - for (int i = 0; i < index; i++) - iter.next(); - key = iter.next(); - if (value instanceof NativeJavaObject) { - value = ((NativeJavaObject)value).unwrap(); - } - this.map.put(key,value); - } } public void delete(String id) { map.remove(id); } - /** - * Allow only to change an existing entry. The position is - * determined through the position of the key in the enumeration - * map.values().iterator() - */ public void delete(int index) { - if (0 <= index && index < this.map.size()) { - Iterator iter = this.map.keySet().iterator(); - Object key = null; - for (int i = 0; i < index; i++) - iter.next(); - key = iter.next(); - this.map.remove(key); - } } public Scriptable getPrototype() {
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]