/** * Writes out the content of the Option form element. * @param option an Option * @exception IOException on any I/O error * */ protected void writeOption(Option option) throws IOException { indent(); write('<'); write("option"); // PENDING: should this be changed to check for null first? Object value = option.getAttributes().getAttribute(HTML.Attribute.VALUE); if (value != null) { write(" value=" + value); } if (option.isSelected()) { write(" selected"); } write('>'); if (option.getLabel() != null) { write(option.getLabel()); } writeLineSeparator(); }
/** * Writes out the content of the Option form element. * * @param option * an Option * @exception IOException * on any I/O error * */ protected void writeOption(Option option) throws IOException { indent(); write('<'); write("option"); // PENDING: should this be changed to check for null first? Object value = option.getAttributes().getAttribute(HTML.Attribute.VALUE); if (value != null) { write(" value=" + value); } if (option.isSelected()) { write(" selected"); } write('>'); if (option.getLabel() != null) { write(option.getLabel()); } writeLineSeparator(); }
/** * Writes out the contents of a select element. * * @param attrSet the attrSet of the element to output as a select box * * @throws IOException on any I/O exceptions */ protected void selectContent(AttributeSet attrSet) throws IOException { writeLineSeparator(); // Extra formatting to look more like the RI. indent(); writeRaw("<select"); writeAttributes(attrSet); writeRaw(">"); incrIndent(); writeLineSeparator(); // extra formatting to look more like the RI. ComboBoxModel comboBoxModel = (ComboBoxModel) attrSet.getAttribute(StyleConstants.ModelAttribute); for (int i = 0; i < comboBoxModel.getSize(); i++) { writeOption((Option) comboBoxModel.getElementAt(i)); } // for(int i = 0; i < comboBoxModel.getSize(); i++) decrIndent(); indent(); writeRaw("</select>"); }
/** * Writes out the contents of an option element. * * @param option the option object to output as a select option * * @throws IOException on any I/O exceptions */ protected void writeOption(Option option) throws IOException { indent(); writeRaw("<option"); writeAttributes(option.getAttributes()); writeRaw(">"); writeContent(option.getLabel()); writeRaw("</option>"); writeLineSeparator(); // extra formatting to look more like the RI. }
protected void writeOption(Option option) throws IOException { writeLineSeparatorEnabled = false; super.writeOption(option); writeLineSeparatorEnabled = true; write("</option>"); writeLineSeparator(); }
/** * Stores the Option that has been marked its selected attribute set. */ public void setInitialSelection(Option option) { selectedOption = option; }
/** * Stores the Option that has been marked its * selected attribute set. */ public void setInitialSelection(Option option) { selectedOption = option; }
/** * Fetches the Option item that represents that was * initially set to a selected state. */ public Option getInitialSelection() { return selectedOption; }