protected void addOption ( AbstractRenderAppender buffer , String type , String optionValue , String optionDisplay , int idx , String altText , char accessKey , boolean disabled ) throws JspException { ServletRequest req = pageContext . getRequest ( ) ; if ( _cr == null ) _cr = TagRenderingBase . Factory . getConstantRendering ( req ) ; assert ( buffer != null ) ; assert ( optionValue != null ) ; assert ( optionDisplay != null ) ; assert ( type != null ) ; if ( _orientation != null && isVertical ( ) ) { _cr . TR_TD ( buffer ) ; } _inputState . clear ( ) ; _inputState . type = type ; _inputState . name = getQualifiedDataSourceName ( ) ; _inputState . value = optionValue ; _inputState . style = _style ; _inputState . styleClass = _class ; if ( isMatched ( optionValue , null ) ) { _inputState . checked = true ; } _inputState . disabled = isDisabled ( ) ; _inputState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , ALT , altText ) ; if ( accessKey != 0x00 ) _inputState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , ACCESSKEY , Character . toString ( accessKey ) ) ; // if there are attributes defined push them to the options. if ( _attrs != null && _attrs . size ( ) > 0 ) { Iterator iterator = _attrs . keySet ( ) . iterator ( ) ; for ( ; iterator . hasNext ( ) ; ) { String key = ( String ) iterator . next ( ) ; if ( key == null ) continue ; String value = ( String ) _attrs . get ( key ) ; _inputState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , key , value ) ; } } TagRenderingBase br = TagRenderingBase . Factory . getRendering ( TagRenderingBase . INPUT_BOOLEAN_TAG , req ) ; br . doStartTag ( buffer , _inputState ) ; br . doEndTag ( buffer ) ; String ls = _labelStyle ; String lsc = _labelStyleClass ; _spanState . style = ls ; _spanState . styleClass = lsc ; br = TagRenderingBase . Factory . getRendering ( TagRenderingBase . SPAN_TAG , req ) ; br . doStartTag ( buffer , _spanState ) ; buffer . append ( optionDisplay ) ; br . doEndTag ( buffer ) ; // backward compatibility this is now overridden by the _orientation if ( _orientation == null ) { _cr . BR ( buffer ) ; } else { if ( isVertical ( ) ) { _cr . TR_TD ( buffer ) ; } else { _cr . NBSP ( buffer ) ; } } }
This will create a new option in the HTML .