[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit/javascript JavaScript.java,1.13,1.14
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-21 03:45:04
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv2259/src/com/meterware/httpunit/javascript Modified Files: JavaScript.java Log Message: Added JavaScript support for Radio buttons Index: JavaScript.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- JavaScript.java 20 Aug 2002 15:09:28 -0000 1.13 +++ JavaScript.java 21 Aug 2002 03:45:01 -0000 1.14 @@ -140,9 +140,10 @@ private Object convertIfNeeded( final Object property ) { if (property == null) return NOT_FOUND; - if (!(property instanceof ScriptableDelegate)) return property; try { + if (property instanceof ScriptableDelegate[]) return toScriptable( (ScriptableDelegate[]) property ); + if (!(property instanceof ScriptableDelegate)) return property; return toScriptable( (ScriptableDelegate) property ); } catch (PropertyException e) { throw new RuntimeException( e.toString() ); @@ -156,6 +157,16 @@ } + private Object toScriptable( ScriptableDelegate[] list ) + throws PropertyException, NotAFunctionException, JavaScriptException, SAXException { + Object[] delegates = new Object[ list.length ]; + for (int i = 0; i < delegates.length; i++) { + delegates[i] = toScriptable( list[i] ); + } + return Context.getCurrentContext().newArray( this, delegates ); + } + + public void put( String propertyName, Scriptable scriptable, Object value ) { if (_scriptable == null || _scriptable.get( propertyName ) == null) { super.put( propertyName, scriptable, value ); @@ -412,7 +423,7 @@ private void initializeControls() throws PropertyException, NotAFunctionException, JavaScriptException, SAXException { - ScriptableDelegate scriptables[] = getDelegate().getControls(); + ScriptableDelegate scriptables[] = getDelegate().getElementDelegates(); Control[] controls = new Control[ scriptables.length ]; for (int i = 0; i < controls.length; i++) { controls[ i ] = (Control) toScriptable( scriptables[ i ] ); |