martinc 01/10/04 22:07:48 Modified: doc struts-html.xml src/share/org/apache/struts/taglib/html OptionTag.java OptionsTag.java Log: Port fix for Bugzilla #3289 to main trunk. PR: 3289 Submitted by: Joe Hrynyk Revision Changes Path 1.23 +35 -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.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- struts-html.xml 2001/09/18 05:50:51 1.22 +++ struts-html.xml 2001/10/05 05:07:47 1.23 @@ -3080,6 +3080,23 @@ </attribute> <attribute> + <name>style</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + CSS styles to be applied to this HTML element. + </info> + </attribute> + + <attribute> + <name>styleClass</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + CSS stylesheet class to be applied to this HTML element. + </info> + </attribute> + <attribute> <name>value</name> <required>true</required> <rtexprvalue>true</rtexprvalue> @@ -3228,6 +3245,24 @@ Property of the form bean, or the bean specified by the name attribute, that will return the collection of values to returned to the server for these options. + </info> + </attribute> + + <attribute> + <name>style</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + CSS styles to be applied to this HTML element. + </info> + </attribute> + + <attribute> + <name>styleClass</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <info> + CSS stylesheet class to be applied to this HTML element. </info> </attribute> </tag> 1.9 +44 -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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- OptionTag.java 2001/06/10 03:53:31 1.8 +++ OptionTag.java 2001/10/05 05:07:47 1.9 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v 1.8 2001/06/10 03:53:31 craigmcc Exp $ - * $Revision: 1.8 $ - * $Date: 2001/06/10 03:53:31 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v 1.9 2001/10/05 05:07:47 martinc Exp $ + * $Revision: 1.9 $ + * $Date: 2001/10/05 05:07:47 $ * * ==================================================================== * @@ -82,7 +82,7 @@ * the server if this option is selected. * * @author Craig R. McClanahan - * @version $Revision: 1.8 $ $Date: 2001/06/10 03:53:31 $ + * @version $Revision: 1.9 $ $Date: 2001/10/05 05:07:47 $ */ public class OptionTag extends BodyTagSupport { @@ -173,6 +173,34 @@ /** + * The style associated with this tag. + */ + private String style = null; + + public String getStyle() { + return style; + } + + public void setStyle(String style) { + this.style = style; + } + + + /** + * The named style class associated with this tag. + */ + private String styleClass = null; + + public String getStyleClass() { + return styleClass; + } + + public void setStyleClass(String styleClass) { + this.styleClass = styleClass; + } + + + /** * The server value for this option, also used to match against the * current property value to determine whether this option should be * marked as selected. @@ -251,6 +279,16 @@ results.append(" disabled=\"disabled\""); if (selectTag.isMatched(value)) results.append(" selected=\"selected\""); + if (style != null) { + results.append(" style=\""); + results.append(style); + results.append("\""); + } + if (styleClass != null) { + results.append(" class=\""); + results.append(styleClass); + results.append("\""); + } results.append(">"); String text = text(); if (text == null) @@ -278,6 +316,8 @@ disabled = false; key = null; locale = Action.LOCALE_KEY; + style = null; + styleClass = null; text = null; value = null; 1.14 +40 -0 jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java Index: OptionsTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- OptionsTag.java 2001/10/04 03:45:09 1.13 +++ OptionsTag.java 2001/10/05 05:07:47 1.14 @@ -165,6 +165,34 @@ /** + * The style associated with this tag. + */ + private String style = null; + + public String getStyle() { + return style; + } + + public void setStyle(String style) { + this.style = style; + } + + + /** + * The named style class associated with this tag. + */ + private String styleClass = null; + + public String getStyleClass() { + return styleClass; + } + + public void setStyleClass(String styleClass) { + this.styleClass = styleClass; + } + + + /** * Process the start of this tag. * * @exception JspException if a JSP exception has occurred @@ -291,6 +319,8 @@ labelProperty = null; name = null; property = null; + style = null; + styleClass = null; } @@ -315,6 +345,16 @@ sb.append("\""); if (matched) sb.append(" selected=\"selected\""); + if (style != null) { + sb.append(" style=\""); + sb.append(style); + sb.append("\""); + } + if (styleClass != null) { + sb.append(" class=\""); + sb.append(styleClass); + sb.append("\""); + } sb.append(">"); sb.append(ResponseUtils.filter(label)); sb.append("</option>\r\n");