[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit Button.java,1.11,1.12 FormControl.java,1.
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2004-03-03 02:40:15
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1799/src/com/meterware/httpunit Modified Files: Button.java FormControl.java Log Message: Patch #812709 (from Michael Corum): Support JavaScript changing disabled attribute on Buttons Index: Button.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/Button.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Button.java 5 Dec 2003 04:06:53 -0000 1.11 +++ Button.java 3 Mar 2004 02:20:11 -0000 1.12 @@ -44,6 +44,7 @@ return BUTTON_TYPE; } + Button( WebForm form ) { super( form ); } @@ -52,6 +53,8 @@ Button( WebForm form, Node node ) { super( form, node ); _onClickEvent = NodeUtils.getNodeAttribute( node, "onclick" ); + + supportAttribute( "disabled" ); } @@ -118,6 +121,15 @@ public void click() throws IOException, SAXException { doButtonAction(); } + + + public void set( String propertyName, Object value ) { + if (propertyName.equalsIgnoreCase( "disabled" )) { + setDisabled( value instanceof Boolean && ((Boolean) value).booleanValue() ); + } else { + super.set( propertyName, value ); + } + } } Index: FormControl.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- FormControl.java 5 Dec 2003 04:06:53 -0000 1.44 +++ FormControl.java 3 Mar 2004 02:20:11 -0000 1.45 @@ -45,7 +45,7 @@ private String _valueAttribute; private final boolean _readOnly; - private final boolean _disabled; + private boolean _disabled; private final String _onChangeEvent; private final String _onClickEvent; private final WebForm _form; @@ -162,6 +162,11 @@ } + void setDisabled( boolean disabled ) { + _disabled = disabled; + } + + /** * Returns true if this control is disabled, meaning that it will not send a value to the server as part of a request. **/ |