[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit FormControl.java,1.13,1.14
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-05 19:42:57
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv11224/src/com/meterware/httpunit Modified Files: FormControl.java Log Message: Added support for checkbox.clicked property Index: FormControl.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- FormControl.java 1 Aug 2002 20:23:15 -0000 1.13 +++ FormControl.java 5 Aug 2002 19:42:52 -0000 1.14 @@ -449,6 +449,32 @@ } + public ScriptableObject getScriptableObject() { + return new Scriptable(); + } + + + class Scriptable extends FormControl.Scriptable { + + public Object get( String propertyName ) { + if (propertyName.equalsIgnoreCase( "checked" )) { + return isChecked() ? Boolean.TRUE : Boolean.FALSE; + } else { + return super.get( propertyName ); + } + } + + + public void set( String propertyName, Object value ) { + if (propertyName.equalsIgnoreCase( "checked" )) { + setChecked( value instanceof Boolean && ((Boolean) value).booleanValue() ); + } else { + super.set( propertyName, value ); + } + } + } + + String getQueryValue() { final String value = getValueAttribute(); return value.length() == 0 ? "on" : value; |