system/src/sc/lang/html/Select.java
public void outputTag(StringBuilder sb, OutputCtx ctx) {
      if (optionDataSource == null || optionDataSource.size() == 0) {
           Element[] emptyIds = getChildrenById("empty");
           if (emptyIds == null) {
              // No data source specified - do the default action so this conforms to what the static HTML would produce
              if (optionDataSource == null)
                 super.outputTag(sb, ctx);
              else {
                 // If there's a data source and no elements and no empty tag, just output the start and end tags.
                 outputStartTag(sb, ctx);
                 outputEndTag(sb, ctx);
              }
           }
           else {
              outputStartTag(sb, ctx);
              for (Element emptyElement:emptyIds) {
                 emptyElement.outputTag(sb, ctx);
              }
              outputEndTag(sb, ctx);
           }
           return;
      }

      Element[] defChildren = getChildrenByIdAndType(null, Option.class);

      outputStartTag(sb, ctx);
      int ix = 0;
      int selIndex = getSelectedIndex();
      for (Object val: optionDataSource) {
         if (defChildren == null) {
            sb.append("<option");
            if (ix == selIndex)
               sb.append(" selected");
            sb.append(">");
            sb.append(val.toString());
            sb.append("</option>");
         }
         else {
            Option subOption = (Option) defChildren[ix % defChildren.length];
            subOption.setSelected(ix == selIndex);
            subOption.setOptionData(val);
            subOption.outputTag(sb, ctx);
         }
         ix++;
      }
      outputEndTag(sb, ctx);
   }
/** Output the contents of the select tag.  If there are no options, render any option tags with the 'empty' id, or if none, render the default body of the tag. */
Output the contents of the select tag.  If there are no options, render any option tags with the 'empty' id, or if none, render the default body of the tag.
Output the contents of the select tag . If there are no options render any option tags with the ' empty ' id or if none render the default body of the tag .
public void outputTag(StringBuilder sb, OutputCtx ctx) {
      if (optionDataSource == null || optionDataSource.size() == 0) {
           Element[] emptyIds = getChildrenById("empty");
           if (emptyIds == null) {
              if (optionDataSource == null)
                 super.outputTag(sb, ctx);
              else {
                 outputStartTag(sb, ctx);
                 outputEndTag(sb, ctx);
              }
           }
           else {
              outputStartTag(sb, ctx);
              for (Element emptyElement:emptyIds) {
                 emptyElement.outputTag(sb, ctx);
              }
              outputEndTag(sb, ctx);
           }
           return;
      }
      Element[] defChildren = getChildrenByIdAndType(null, Option.class);
      outputStartTag(sb, ctx);
      int ix = 0;
      int selIndex = getSelectedIndex();
      for (Object val: optionDataSource) {
         if (defChildren == null) {
            sb.append("<option");
            if (ix == selIndex)
               sb.append(" selected");
            sb.append(">");
            sb.append(val.toString());
            sb.append("</option>");
         }
         else {
            Option subOption = (Option) defChildren[ix % defChildren.length];
            subOption.setSelected(ix == selIndex);
            subOption.setOptionData(val);
            subOption.outputTag(sb, ctx);
         }
         ix++;
      }
      outputEndTag(sb, ctx);
   }
public void outputTag ( StringBuilder sb , OutputCtx ctx ) { if ( optionDataSource == null || optionDataSource . size ( ) == 0 ) { Element [ ] emptyIds = getChildrenById ( "empty" ) ; if ( emptyIds == null ) { if ( optionDataSource == null ) super . outputTag ( sb , ctx ) ; else { outputStartTag ( sb , ctx ) ; outputEndTag ( sb , ctx ) ; } } else { outputStartTag ( sb , ctx ) ; for ( Element emptyElement : emptyIds ) { emptyElement . outputTag ( sb , ctx ) ; } outputEndTag ( sb , ctx ) ; } return ; } Element [ ] defChildren = getChildrenByIdAndType ( null , Option . class ) ; outputStartTag ( sb , ctx ) ; int ix = 0 ; int selIndex = getSelectedIndex ( ) ; for ( Object val : optionDataSource ) { if ( defChildren == null ) { sb . append ( "<option" ) ; if ( ix == selIndex ) sb . append ( " selected" ) ; sb . append ( ">" ) ; sb . append ( val . toString ( ) ) ; sb . append ( "</option>" ) ; } else { Option subOption = ( Option ) defChildren [ ix % defChildren . length ] ; subOption . setSelected ( ix == selIndex ) ; subOption . setOptionData ( val ) ; subOption . outputTag ( sb , ctx ) ; } ix ++ ; } outputEndTag ( sb , ctx ) ; }
Output the contents of the select tag.
Output the contents of the select tag .
// No data source specified - do the default action so this conforms to what the static HTML would produce // If there's a data source and no elements and no empty tag, just output the start and end tags.