< prev index next >

## src/java.desktop/share/classes/javax/swing/text/html/FormView.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.

    *** 781,803 ****
              if (name == null) {
                  return;
              }
              Object m = attr.getAttribute(StyleConstants.ModelAttribute);
              if (m instanceof OptionListModel) {
    !             @SuppressWarnings("unchecked")
    !             OptionListModel<Option> model = (OptionListModel<Option>) 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();
                  if (option != null) {
                      appendBuffer(buffer, name, option.getValue());
                  }
              }
          }
    --- 781,802 ----
              if (name == null) {
                  return;
              }
              Object m = attr.getAttribute(StyleConstants.ModelAttribute);
              if (m instanceof OptionListModel) {
    !             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<Option> model = (ComboBoxModel<Option>)m;
    !             Option option = model.getSelectedItem();
                  if (option != null) {
                      appendBuffer(buffer, name, option.getValue());
                  }
              }
          }
    *** 900,911 ****
                                      }
                                  }
                              } catch (BadLocationException e) {
                              }
                          } else if (m instanceof OptionListModel) {
    !                         @SuppressWarnings("unchecked")
    !                         OptionListModel<?> model = (OptionListModel) m;
                              int size = model.getSize();
                              for (int i = 0; i < size; i++) {
                                  model.removeIndexInterval(i, i);
                              }
                              BitSet selectionRange = model.getInitialSelection();
    --- 899,909 ----
                                      }
                                  }
                              } catch (BadLocationException e) {
                              }
                          } else if (m instanceof OptionListModel) {
    !                         OptionListModel model = (OptionListModel) m;
                              int size = model.getSize();
                              for (int i = 0; i < size; i++) {
                                  model.removeIndexInterval(i, i);
                              }
                              BitSet selectionRange = model.getInitialSelection();
    *** 913,924 ****
                                  if (selectionRange.get(i)) {
                                      model.addSelectionInterval(i, i);
                                  }
                              }
                          } else if (m instanceof OptionComboBoxModel) {
    !                         @SuppressWarnings("unchecked")
    !                         OptionComboBoxModel<?> model = (OptionComboBoxModel) m;
                              Option option = model.getInitialSelection();
                              if (option != null) {
                                  model.setSelectedItem(option);
                              }
                          } else if (m instanceof JToggleButton.ToggleButtonModel) {
    --- 911,921 ----
                                  if (selectionRange.get(i)) {
                                      model.addSelectionInterval(i, i);
                                  }
                              }
                          } else if (m instanceof OptionComboBoxModel) {
    !                         OptionComboBoxModel model = (OptionComboBoxModel) m;
                              Option option = model.getInitialSelection();
                              if (option != null) {
                                  model.setSelectedItem(option);
                              }
                          } else if (m instanceof JToggleButton.ToggleButtonModel) {

< prev index next >