< prev index next >

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

    *** 184,253 ****
          }

          /**
           * Tests whether the specified object is a component in this list.
           *
           * @param   elem   an object
           * @return  <code>true</code> if the specified object
           *          is the same as a component in this list
           * @see Vector#contains(Object)
           */
    !     public boolean contains(Object elem) {
              return delegate.contains(elem);
          }

          /**
           * Searches for the first occurrence of <code>elem</code>.
           *
           * @param   elem   an object
           * @return  the index of the first occurrence of the argument in this
           *          list; returns <code>-1</code> if the object is not found
           * @see Vector#indexOf(Object)
           */
    !     public int indexOf(Object elem) {
              return delegate.indexOf(elem);
          }

          /**
           * Searches for the first occurrence of <code>elem</code>, beginning
           * the search at <code>index</code>.
           *
           * @param   elem    an desired component
           * @param   index   the index from which to begin searching
           * @return  the index where the first occurrence of <code>elem</code>
           *          is found after <code>index</code>; returns <code>-1</code>
           *          if the <code>elem</code> is not found in the list
           * @see Vector#indexOf(Object,int)
           */
    !      public int indexOf(Object elem, int index) {
              return delegate.indexOf(elem, index);
          }

          /**
           * Returns the index of the last occurrence of <code>elem</code>.
           *
           * @param   elem   the desired component
           * @return  the index of the last occurrence of <code>elem</code>
           *          in the list; returns <code>-1</code> if the object is not found
           * @see Vector#lastIndexOf(Object)
           */
    !     public int lastIndexOf(Object elem) {
              return delegate.lastIndexOf(elem);
          }

          /**
           * Searches backwards for <code>elem</code>, starting from the
           * specified index, and returns an index to it.
           *
           * @param  elem    the desired component
           * @param  index   the index to start searching from
           * @return the index of the last occurrence of the <code>elem</code>
           *          in this list at position less than <code>index</code>;
           *          returns <code>-1</code> if the object is not found
           * @see Vector#lastIndexOf(Object,int)
           */
    !     public int lastIndexOf(Object elem, int index) {
              return delegate.lastIndexOf(elem, index);
          }

          /**
           * Returns the component at the specified index.
    --- 184,258 ----
          }

          /**
           * Tests whether the specified object is a component in this list.
           *
    +      * @param <E> the type of the elements of this model.
           * @param   elem   an object
           * @return  <code>true</code> if the specified object
           *          is the same as a component in this list
           * @see Vector#contains(Object)
           */
    !     public boolean contains(E elem) {
              return delegate.contains(elem);
          }

          /**
           * Searches for the first occurrence of <code>elem</code>.
           *
    +      * @param <E> the type of the elements of this model.
           * @param   elem   an object
           * @return  the index of the first occurrence of the argument in this
           *          list; returns <code>-1</code> if the object is not found
           * @see Vector#indexOf(Object)
           */
    !     public int indexOf(E elem) {
              return delegate.indexOf(elem);
          }

          /**
           * Searches for the first occurrence of <code>elem</code>, beginning
           * the search at <code>index</code>.
           *
    +      * @param <E> the type of the elements of this model.
           * @param   elem    an desired component
           * @param   index   the index from which to begin searching
           * @return  the index where the first occurrence of <code>elem</code>
           *          is found after <code>index</code>; returns <code>-1</code>
           *          if the <code>elem</code> is not found in the list
           * @see Vector#indexOf(Object,int)
           */
    !      public int indexOf(E elem, int index) {
              return delegate.indexOf(elem, index);
          }

          /**
           * Returns the index of the last occurrence of <code>elem</code>.
           *
    +      * @param <E> the type of the elements of this model.
           * @param   elem   the desired component
           * @return  the index of the last occurrence of <code>elem</code>
           *          in the list; returns <code>-1</code> if the object is not found
           * @see Vector#lastIndexOf(Object)
           */
    !     public int lastIndexOf(E elem) {
              return delegate.lastIndexOf(elem);
          }

          /**
           * Searches backwards for <code>elem</code>, starting from the
           * specified index, and returns an index to it.
           *
    +      * @param <E> the type of the elements of this model.
           * @param  elem    the desired component
           * @param  index   the index to start searching from
           * @return the index of the last occurrence of the <code>elem</code>
           *          in this list at position less than <code>index</code>;
           *          returns <code>-1</code> if the object is not found
           * @see Vector#lastIndexOf(Object,int)
           */
    !     public int lastIndexOf(E elem, int index) {
              return delegate.lastIndexOf(elem, index);
          }

          /**
           * Returns the component at the specified index.
    *** 371,386 ****

          /**
           * Removes the first (lowest-indexed) occurrence of the argument
           * from this list.
           *
           * @param   obj   the component to be removed
           * @return  <code>true</code> if the argument was a component of this
           *          list; <code>false</code> otherwise
           * @see Vector#removeElement(Object)
           */
    !     public boolean removeElement(Object obj) {
              int index = indexOf(obj);
              boolean rv = delegate.removeElement(obj);
              if (index >= 0) {
                  fireIntervalRemoved(this, index, index);
              }
    --- 376,392 ----

          /**
           * Removes the first (lowest-indexed) occurrence of the argument
           * from this list.
           *
    +      * @param <E> the type of the elements of this model.
           * @param   obj   the component to be removed
           * @return  <code>true</code> if the argument was a component of this
           *          list; <code>false</code> otherwise
           * @see Vector#removeElement(Object)
           */
    !     public boolean removeElement(E obj) {
              int index = indexOf(obj);
              boolean rv = delegate.removeElement(obj);
              if (index >= 0) {
                  fireIntervalRemoved(this, index, index);
              }

< prev index next >