< prev index next >

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

    *** 3606,3622 ****
                          int size = HTML.getIntegerAttributeValue(attr,
                                                                   HTML.Attribute.SIZE,
                                                                   1);
                          boolean multiple = attr.getAttribute(HTML.Attribute.MULTIPLE) != null;
                          if ((size > 1) || multiple) {
    !                         OptionListModel<Option> m = new OptionListModel<Option>();
                              if (multiple) {
                                  m.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                              }
                              selectModel = m;
                          } else {
    !                         selectModel = new OptionComboBoxModel<Option>();
                          }
                          attr.addAttribute(StyleConstants.ModelAttribute,
                                            selectModel);

                      }
    --- 3606,3622 ----
                          int size = HTML.getIntegerAttributeValue(attr,
                                                                   HTML.Attribute.SIZE,
                                                                   1);
                          boolean multiple = attr.getAttribute(HTML.Attribute.MULTIPLE) != null;
                          if ((size > 1) || multiple) {
    !                         OptionListModel m = new OptionListModel();
                              if (multiple) {
                                  m.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                              }
                              selectModel = m;
                          } else {
    !                         selectModel = new OptionComboBoxModel();
                          }
                          attr.addAttribute(StyleConstants.ModelAttribute,
                                            selectModel);

                      }
    *** 3624,3643 ****
                      // build the element, unless this is an option.
                      if (t == HTML.Tag.OPTION) {
                          option = new Option(attr);

                          if (selectModel instanceof OptionListModel) {
    !                         @SuppressWarnings("unchecked")
    !                         OptionListModel<Option> m = (OptionListModel<Option>) selectModel;
                              m.addElement(option);
                              if (option.isSelected()) {
                                  m.addSelectionInterval(optionCount, optionCount);
                                  m.setInitialSelection(optionCount);
                              }
                          } else if (selectModel instanceof OptionComboBoxModel) {
    !                         @SuppressWarnings("unchecked")
    !                         OptionComboBoxModel<Option> m = (OptionComboBoxModel<Option>) selectModel;
                              m.addElement(option);
                              if (option.isSelected()) {
                                  m.setSelectedItem(option);
                                  m.setInitialSelection(option);
                              }
    --- 3624,3641 ----
                      // build the element, unless this is an option.
                      if (t == HTML.Tag.OPTION) {
                          option = new Option(attr);

                          if (selectModel instanceof OptionListModel) {
    !                         OptionListModel m = (OptionListModel) selectModel;
                              m.addElement(option);
                              if (option.isSelected()) {
                                  m.addSelectionInterval(optionCount, optionCount);
                                  m.setInitialSelection(optionCount);
                              }
                          } else if (selectModel instanceof OptionComboBoxModel) {
    !                         OptionComboBoxModel m = (OptionComboBoxModel) selectModel;
                              m.addElement(option);
                              if (option.isSelected()) {
                                  m.setSelectedItem(option);
                                  m.setInitialSelection(option);
                              }

< prev index next >