martinc 01/10/04 22:05:48 Modified: doc Tag: STRUTS_1_0_BRANCH struts-html.xml src/share/org/apache/struts/taglib/html Tag: STRUTS_1_0_BRANCH OptionTag.java OptionsTag.java Log: Added 'style' and 'styleClass' attributes for <html:option> and <html:options> tags. PR: 3289 Submitted by: Joe Hrynyk Revision Changes Path No revision No revision 1.11.2.6 +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.11.2.5 retrieving revision 1.11.2.6 diff -u -r1.11.2.5 -r1.11.2.6 --- struts-html.xml 2001/09/23 18:48:48 1.11.2.5 +++ struts-html.xml 2001/10/05 05:05:47 1.11.2.6 @@ -2886,6 +2886,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> @@ -3034,6 +3051,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> No revision No revision 1.6.2.3 +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.6.2.2 retrieving revision 1.6.2.3 diff -u -r1.6.2.2 -r1.6.2.3 --- OptionTag.java 2001/06/10 03:51:41 1.6.2.2 +++ OptionTag.java 2001/10/05 05:05:48 1.6.2.3 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v 1.6.2.2 2001/06/10 03:51:41 craigmcc Exp $ - * $Revision: 1.6.2.2 $ - * $Date: 2001/06/10 03:51:41 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v 1.6.2.3 2001/10/05 05:05:48 martinc Exp $ + * $Revision: 1.6.2.3 $ + * $Date: 2001/10/05 05:05:48 $ * * ==================================================================== * @@ -82,7 +82,7 @@ * the server if this option is selected. * * @author Craig R. McClanahan - * @version $Revision: 1.6.2.2 $ $Date: 2001/06/10 03:51:41 $ + * @version $Revision: 1.6.2.3 $ $Date: 2001/10/05 05:05:48 $ */ 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.7.2.6 +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.7.2.5 retrieving revision 1.7.2.6 diff -u -r1.7.2.5 -r1.7.2.6 --- OptionsTag.java 2001/10/04 03:44:17 1.7.2.5 +++ OptionsTag.java 2001/10/05 05:05:48 1.7.2.6 @@ -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");