< prev index next >

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

    *** 41,51 ****
       * accurate reset, if the user requests a reset of the form.
       *
       * @author Sunita Mani
       */
      @SuppressWarnings("serial") // Superclass is not serializable across versions
    ! class OptionListModel<E> extends DefaultListModel<E> implements ListSelectionModel, Serializable {

          private static final int MIN = -1;
          private static final int MAX = Integer.MAX_VALUE;
          private int selectionMode = SINGLE_SELECTION;
    --- 41,51 ----
       * accurate reset, if the user requests a reset of the form.
       *
       * @author Sunita Mani
       */
      @SuppressWarnings("serial") // Superclass is not serializable across versions
    ! class OptionListModel extends DefaultListModel<Option> implements ListSelectionModel, Serializable {

          private static final int MIN = -1;
          private static final int MAX = Integer.MAX_VALUE;
          private int selectionMode = SINGLE_SELECTION;
    *** 174,184 ****
          private void set(int r) {
              if (value.get(r)) {
                  return;
              }
              value.set(r);
    !         Option option = (Option)get(r);
              option.setSelection(true);
              markAsDirty(r);

              // Update minimum and maximum indices
              minIndex = Math.min(minIndex, r);
    --- 174,184 ----
          private void set(int r) {
              if (value.get(r)) {
                  return;
              }
              value.set(r);
    !         Option option = get(r);
              option.setSelection(true);
              markAsDirty(r);

              // Update minimum and maximum indices
              minIndex = Math.min(minIndex, r);
    *** 189,199 ****
          private void clear(int r) {
              if (!value.get(r)) {
                  return;
              }
              value.clear(r);
    !         Option option = (Option)get(r);
              option.setSelection(false);
              markAsDirty(r);

              // Update minimum and maximum indices
              /*
    --- 189,199 ----
          private void clear(int r) {
              if (!value.get(r)) {
                  return;
              }
              value.clear(r);
    !         Option option = get(r);
              option.setSelection(false);
              markAsDirty(r);

              // Update minimum and maximum indices
              /*
    *** 466,478 ****
           * @return a clone of the receiver
           * @exception CloneNotSupportedException if the receiver does not
           *    both (a) implement the <code>Cloneable</code> interface
           *    and (b) define a <code>clone</code> method
           */
    !     public Object clone() throws CloneNotSupportedException {
              @SuppressWarnings("unchecked")
    !         OptionListModel<E> clone = (OptionListModel)super.clone();
              clone.value = (BitSet)value.clone();
              clone.listenerList = new EventListenerList();
              return clone;
          }

    --- 466,478 ----
           * @return a clone of the receiver
           * @exception CloneNotSupportedException if the receiver does not
           *    both (a) implement the <code>Cloneable</code> interface
           *    and (b) define a <code>clone</code> method
           */
    !     public OptionListModel clone() throws CloneNotSupportedException {
              @SuppressWarnings("unchecked")
    !         OptionListModel clone = (OptionListModel)super.clone();
              clone.value = (BitSet)value.clone();
              clone.listenerList = new EventListenerList();
              return clone;
          }

< prev index next >