< prev index next >

## src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java

Print this page

    rev 48858 : Work in progress for JDK-6303622
    Use generic in Swing components like JComboBox
    1. Added generic return type and parameter type for JComboBox.
    2. Modified JList related classes as well.
    3. Reverted the changes made to "getSelectedValues" as suggested by Joe.
    4. Modified files that were failing on Linux and Mac as well.

     514                 }
     515                 replaceEntities = true;
     516                 setCanWrapLines(!inPre);
     517                 write(segment.array, segment.offset, segment.count);
     518                 setCanWrapLines(false);
     519                 replaceEntities = false;
     520             }
     521         }
     522     }
     523
     524     /**
     525      * Writes out the content of the SELECT form element.
     526      *
     527      * @param attr the AttributeSet associated with the form element
     528      * @exception IOException on any I/O error
     529      */
     530     protected void selectContent(AttributeSet attr) throws IOException {
     531         Object model = attr.getAttribute(StyleConstants.ModelAttribute);
     532         incrIndent();
     533         if (model instanceof OptionListModel) {
     534             @SuppressWarnings("unchecked")
     535             OptionListModel<Option> listModel = (OptionListModel<Option>) model;
     536             int size = listModel.getSize();
     537             for (int i = 0; i < size; i++) {
     538                 Option option = listModel.getElementAt(i);
     539                 writeOption(option);
     540             }
     541         } else if (model instanceof OptionComboBoxModel) {
     542             @SuppressWarnings("unchecked")
     543             OptionComboBoxModel<Option> comboBoxModel = (OptionComboBoxModel<Option>) model;
     544             int size = comboBoxModel.getSize();
     545             for (int i = 0; i < size; i++) {
     546                 Option option = comboBoxModel.getElementAt(i);
     547                 writeOption(option);
     548             }
     549         }
     550         decrIndent();
     551     }
     552
     553
     554     /**
     555      * Writes out the content of the Option form element.
     556      * @param option  an Option
     557      * @exception IOException on any I/O error
     558      *
     559      */
     560     protected void writeOption(Option option) throws IOException {
     561
     562         indentSmart();
     563         write('<');
     514                 }
     515                 replaceEntities = true;
     516                 setCanWrapLines(!inPre);
     517                 write(segment.array, segment.offset, segment.count);
     518                 setCanWrapLines(false);
     519                 replaceEntities = false;
     520             }
     521         }
     522     }
     523
     524     /**
     525      * Writes out the content of the SELECT form element.
     526      *
     527      * @param attr the AttributeSet associated with the form element
     528      * @exception IOException on any I/O error
     529      */
     530     protected void selectContent(AttributeSet attr) throws IOException {
     531         Object model = attr.getAttribute(StyleConstants.ModelAttribute);
     532         incrIndent();
     533         if (model instanceof OptionListModel) {
     534             OptionListModel listModel = (OptionListModel) model;

     535             int size = listModel.getSize();
     536             for (int i = 0; i < size; i++) {
     537                 Option option = listModel.getElementAt(i);
     538                 writeOption(option);
     539             }
     540         } else if (model instanceof OptionComboBoxModel) {
     541             OptionComboBoxModel comboBoxModel = (OptionComboBoxModel) model;

     542             int size = comboBoxModel.getSize();
     543             for (int i = 0; i < size; i++) {
     544                 Option option = comboBoxModel.getElementAt(i);
     545                 writeOption(option);
     546             }
     547         }
     548         decrIndent();
     549     }
     550
     551
     552     /**
     553      * Writes out the content of the Option form element.
     554      * @param option  an Option
     555      * @exception IOException on any I/O error
     556      *
     557      */
     558     protected void writeOption(Option option) throws IOException {
     559
     560         indentSmart();
     561         write('<');

< prev index next >