< prev index next >

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

Print this page

    rev 48358 : 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.

    @@ -781,23 +781,22 @@
             if (name == null) {
                 return;
             }
             Object m = attr.getAttribute(StyleConstants.ModelAttribute);
             if (m instanceof OptionListModel) {
    -            @SuppressWarnings("unchecked")
    -            OptionListModel<Option> model = (OptionListModel<Option>) m;
    +            OptionListModel model = (OptionListModel) m;

                 for (int i = 0; i < model.getSize(); i++) {
                     if (model.isSelectedIndex(i)) {
                         Option option = model.getElementAt(i);
                         appendBuffer(buffer, name, option.getValue());
                     }
                 }
             } else if (m instanceof ComboBoxModel) {
                 @SuppressWarnings("unchecked")
    -            ComboBoxModel<?> model = (ComboBoxModel)m;
    -            Option option = (Option)model.getSelectedItem();
    +            ComboBoxModel<Option> model = (ComboBoxModel<Option>)m;
    +            Option option = model.getSelectedItem();
                 if (option != null) {
                     appendBuffer(buffer, name, option.getValue());
                 }
             }
         }

    @@ -900,12 +899,11 @@
                                     }
                                 }
                             } catch (BadLocationException e) {
                             }
                         } else if (m instanceof OptionListModel) {
    -                        @SuppressWarnings("unchecked")
    -                        OptionListModel<?> model = (OptionListModel) m;
    +                        OptionListModel model = (OptionListModel) m;
                             int size = model.getSize();
                             for (int i = 0; i < size; i++) {
                                 model.removeIndexInterval(i, i);
                             }
                             BitSet selectionRange = model.getInitialSelection();

    @@ -913,12 +911,11 @@
                                 if (selectionRange.get(i)) {
                                     model.addSelectionInterval(i, i);
                                 }
                             }
                         } else if (m instanceof OptionComboBoxModel) {
    -                        @SuppressWarnings("unchecked")
    -                        OptionComboBoxModel<?> model = (OptionComboBoxModel) m;
    +                        OptionComboBoxModel model = (OptionComboBoxModel) m;
                             Option option = model.getInitialSelection();
                             if (option != null) {
                                 model.setSelectedItem(option);
                             }
                         } else if (m instanceof JToggleButton.ToggleButtonModel) {

< prev index next >