craigmcc 01/05/04 17:54:34 Modified: doc struts-html.xml src/share/org/apache/struts/taglib/html BaseHandlerTag.java OptionTag.java Log: Add optional "disabled" and "readonly" attributes to all of the relevant HTML custom tags. PR: Bugzilla #1622 Submitted by: [EMAIL PROTECTED] Revision Changes Path 1.7 +170 -0 jakarta-struts/doc/struts-html.xml Index: struts-html.xml =================================================================== RCS file: /home/cvs/jakarta-struts/doc/struts-html.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- struts-html.xml 2001/04/20 00:26:52 1.6 +++ struts-html.xml 2001/05/05 00:54:31 1.7 @@ -88,6 +88,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>onblur</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -304,6 +314,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>onblur</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -539,6 +559,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>name</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -853,6 +883,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>maxlength</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -1406,6 +1446,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>locale</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -2529,6 +2579,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>name</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -2761,6 +2821,16 @@ </info> </attribute> + <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this option should be + disabled. + </info> + </attribute> + <attribute> <name>key</name> <required>false</required> @@ -2964,6 +3034,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>maxlength</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -3125,6 +3205,16 @@ </info> </attribute> + <attribute> + <name>readonly</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + read only. + </info> + </attribute> + <attribute> <name>redisplay</name> <required>false</required> @@ -3225,6 +3315,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>name</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -3398,6 +3498,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>onblur</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -3729,6 +3839,16 @@ </info> </attribute> + <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + <attribute> <name>multiple</name> <required>false</required> @@ -3972,6 +4092,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>onblur</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -4181,6 +4311,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>name</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -4204,6 +4344,16 @@ </attribute> <attribute> + <name>readonly</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + read only. + </info> + </attribute> + + <attribute> <name>value</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -4432,6 +4582,16 @@ </attribute> <attribute> + <name>disabled</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + disabled. + </info> + </attribute> + + <attribute> <name>name</name> <required>false</required> <rtexprvalue>true</rtexprvalue> @@ -4452,6 +4612,16 @@ property if value is not specified. The corresponding bean property (if any) must be of type String. </info> + </attribute> + + <attribute> + <name>readonly</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + Set to <code>true</code> if this input field should be + read only. + </info> </attribute> <attribute> 1.3 +43 -6 jakarta-struts/src/share/org/apache/struts/taglib/html/BaseHandlerTag.java Index: BaseHandlerTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseHandlerTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BaseHandlerTag.java 2001/05/04 19:25:16 1.2 +++ BaseHandlerTag.java 2001/05/05 00:54:33 1.3 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseHandlerTag.java,v 1.2 2001/05/04 19:25:16 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2001/05/04 19:25:16 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseHandlerTag.java,v 1.3 2001/05/05 00:54:33 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/05/05 00:54:33 $ * * ==================================================================== * @@ -71,7 +71,7 @@ * appropriate implementations of these. * * @author Don Clasen - * @version $Revision: 1.2 $ $Date: 2001/05/04 19:25:16 $ + * @version $Revision: 1.3 $ $Date: 2001/05/05 00:54:33 $ */ public abstract class BaseHandlerTag extends BodyTagSupport { @@ -137,7 +137,7 @@ /** Content changed after component lost focus event. */ private String onchange = null; -// Focus Events +// Focus Events and States /** Component lost focus event. */ private String onblur = null; @@ -145,6 +145,12 @@ /** Component has received focus event. */ private String onfocus = null; + /** Component is disabled. */ + private boolean disabled = false; + + /** Component is readonly. */ + private boolean readonly = false; + // CSS Style Support /** Style attribute associated with component. */ @@ -307,7 +313,7 @@ return onselect; } -// Focus Events +// Focus Events and States /** Sets the onBlur event handler. */ public void setOnblur(String onBlur) { @@ -329,6 +335,26 @@ return onfocus; } + /** Sets the disabled event handler. */ + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + + /** Returns the disabled event handler. */ + public boolean getDisabled() { + return disabled; + } + + /** Sets the readonly event handler. */ + public void setReadonly(boolean readonly) { + this.readonly = readonly; + } + + /** Returns the readonly event handler. */ + public boolean getReadonly() { + return readonly; + } + // CSS Style Support /** Sets the style attribute. */ @@ -386,6 +412,8 @@ onchange = null; onblur = null; onfocus = null; + disabled = false; + readonly = false; style = null; styleClass = null; styleId = null; @@ -550,6 +578,15 @@ handlers.append(onfocus); handlers.append("\""); } + + if (disabled) { + handlers.append(" disabled"); + } + + if (readonly) { + handlers.append(" readonly"); + } + } 1.6 +21 -4 jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java Index: OptionTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- OptionTag.java 2001/04/17 23:57:01 1.5 +++ OptionTag.java 2001/05/05 00:54:33 1.6 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v 1.5 2001/04/17 23:57:01 craigmcc Exp $ - * $Revision: 1.5 $ - * $Date: 2001/04/17 23:57:01 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v 1.6 2001/05/05 00:54:33 craigmcc Exp $ + * $Revision: 1.6 $ + * $Date: 2001/05/05 00:54:33 $ * * ==================================================================== * @@ -82,7 +82,7 @@ * the server if this option is selected. * * @author Craig R. McClanahan - * @version $Revision: 1.5 $ $Date: 2001/04/17 23:57:01 $ + * @version $Revision: 1.6 $ $Date: 2001/05/05 00:54:33 $ */ public class OptionTag extends BodyTagSupport { @@ -129,6 +129,20 @@ /** + * Is this option disabled? + */ + protected boolean disabled = false; + + public boolean getDisabled() { + return (this.disabled); + } + + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + + + /** * The key used to look up the text displayed to the user for this * option, if any. */ @@ -233,6 +247,8 @@ results.append("<option value=\""); results.append(value); results.append("\""); + if (disabled) + results.append(" disabled"); if (selectTag.isMatched(value)) results.append(" selected"); results.append(">"); @@ -259,6 +275,7 @@ super.release(); bundle = Action.MESSAGES_KEY; + disabled = false; key = null; locale = Action.LOCALE_KEY; text = null;