bruno 2004/05/08 04:27:54
Modified: src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3
ScriptableWidget.java
Log:
* fixed problem in assigning validator property
* use getChild instead of lookupWidget in get/has properties
* added get/set/removeAttribute
Revision Changes Path
1.4 +20 -10
cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java
Index: ScriptableWidget.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ScriptableWidget.java 7 May 2004 16:43:43 -0000 1.3
+++ ScriptableWidget.java 8 May 2004 11:27:54 -0000 1.4
@@ -118,8 +118,8 @@
}
public boolean has(String id, Scriptable start) {
- if (delegate != null) {
- Widget sub = delegate.lookupWidget(id);
+ if (delegate != null && delegate instanceof ContainerWidget) {
+ Widget sub = ((ContainerWidget)delegate).getChild(id);
if (sub != null) {
return true;
}
@@ -147,8 +147,8 @@
if (result != NOT_FOUND) {
return result;
}
- if (delegate != null) {
- Widget sub = delegate.lookupWidget(id);
+ if (delegate != null && delegate instanceof ContainerWidget) {
+ Widget sub = ((ContainerWidget)delegate).getChild(id);
if (sub != null) {
return wrap(sub);
}
@@ -520,6 +520,18 @@
}
}
+ public void jsFunction_setAttribute(String name, Object value) {
+ delegate.setAttribute(name, value);
+ }
+
+ public Object jsFunction_getAttribute(String jsname) {
+ return delegate.getAttribute(jsname);
+ }
+
+ public void jsFunction_removeAttribute(String name) {
+ delegate.removeAttribute(name);
+ }
+
public Widget jsFunction_unwrap() {
return delegate;
}
@@ -671,11 +683,9 @@
}
if (value instanceof Function) {
- if (delegate instanceof ValueChangedListenerEnabled) {
- if (this.validator == null)
- delegate.addValidator(this);
- this.validator = (Function)value;
- }
+ if (this.validator == null)
+ delegate.addValidator(this);
+ this.validator = (Function)value;
}
}