Package weka.gui

Class CheckBoxList.CheckBoxListModel

All Implemented Interfaces:
Serializable, ListModel
Enclosing class:
CheckBoxList

public class CheckBoxList.CheckBoxListModel extends DefaultListModel
A specialized model.
Version:
$Revision: 10219 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
  • Constructor Details

    • CheckBoxListModel

      public CheckBoxListModel()
      initializes the model with no data.
    • CheckBoxListModel

      public CheckBoxListModel(Object[] listData)
      Constructs a CheckBoxListModel from an array of objects and then applies setModel to it.
      Parameters:
      listData - the data to use
    • CheckBoxListModel

      public CheckBoxListModel(Vector listData)
      Constructs a CheckBoxListModel from a Vector and then applies setModel to it.
  • Method Details

    • add

      public void add(int index, Object element)
      Inserts the specified element at the specified position in this list.
      Overrides:
      add in class DefaultListModel
      Parameters:
      index - index at which the specified element is to be inserted
      element - element to be inserted
    • addElement

      public void addElement(Object obj)
      Adds the specified component to the end of this list.
      Overrides:
      addElement in class DefaultListModel
      Parameters:
      obj - the component to be added
    • contains

      public boolean contains(Object elem)
      Tests whether the specified object is a component in this list.
      Overrides:
      contains in class DefaultListModel
      Parameters:
      elem - the element to check
      Returns:
      true if the element is in the list
    • copyInto

      public void copyInto(Object[] anArray)
      Copies the components of this list into the specified array.
      Overrides:
      copyInto in class DefaultListModel
      Parameters:
      anArray - the array into which the components get copied
      Throws:
      IndexOutOfBoundsException - if the array is not big enough
    • elementAt

      public Object elementAt(int index)
      Returns the component at the specified index. Throws an ArrayIndexOutOfBoundsException if the index is negative or not less than the size of the list.
      Overrides:
      elementAt in class DefaultListModel
      Parameters:
      index - an index into this list
      Returns:
      the component at the specified index
      Throws:
      ArrayIndexOutOfBoundsException
    • firstElement

      public Object firstElement()
      Returns the first component of this list. Throws a NoSuchElementException if this vector has no components.
      Overrides:
      firstElement in class DefaultListModel
      Returns:
      the first component of this list
      Throws:
      NoSuchElementException
    • get

      public Object get(int index)
      Returns the element at the specified position in this list.
      Overrides:
      get in class DefaultListModel
      Parameters:
      index - of element to return
      Throws:
      ArrayIndexOutOfBoundsException
    • getElementAt

      public Object getElementAt(int index)
      Returns the component at the specified index.
      Specified by:
      getElementAt in interface ListModel
      Overrides:
      getElementAt in class DefaultListModel
      Parameters:
      index - an index into this list
      Returns:
      the component at the specified index
      Throws:
      ArrayIndexOutOfBoundsException
    • indexOf

      public int indexOf(Object elem)
      Searches for the first occurrence of elem.
      Overrides:
      indexOf in class DefaultListModel
      Parameters:
      elem - an object
      Returns:
      the index of the first occurrence of the argument in this list; returns -1 if the object is not found
    • indexOf

      public int indexOf(Object elem, int index)
      Searches for the first occurrence of elem, beginning the search at index.
      Overrides:
      indexOf in class DefaultListModel
      Parameters:
      elem - the desired component
      index - the index from which to begin searching
      Returns:
      the index where the first occurrence of elem is found after index; returns -1 if the elem is not found in the list
    • insertElementAt

      public void insertElementAt(Object obj, int index)
      Inserts the specified object as a component in this list at the specified index.
      Overrides:
      insertElementAt in class DefaultListModel
      Parameters:
      obj - the component to insert
      index - where to insert the new component
      Throws:
      ArrayIndexOutOfBoundsException
    • lastElement

      public Object lastElement()
      Returns the last component of the list. Throws a NoSuchElementException if this vector has no components.
      Overrides:
      lastElement in class DefaultListModel
      Returns:
      the last component of the list
      Throws:
      NoSuchElementException
    • lastIndexOf

      public int lastIndexOf(Object elem)
      Returns the index of the last occurrence of elem.
      Overrides:
      lastIndexOf in class DefaultListModel
      Parameters:
      elem - the desired component
      Returns:
      the index of the last occurrence of elem in the list; returns -1 if the object is not found
    • lastIndexOf

      public int lastIndexOf(Object elem, int index)
      Searches backwards for elem, starting from the specified index, and returns an index to it.
      Overrides:
      lastIndexOf in class DefaultListModel
      Parameters:
      elem - the desired component
      index - the index to start searching from
      Returns:
      the index of the last occurrence of the elem in this list at position less than index; returns -1 if the object is not found
    • remove

      public Object remove(int index)
      Removes the element at the specified position in this list. Returns the element that was removed from the list.
      Overrides:
      remove in class DefaultListModel
      Parameters:
      index - the index of the element to removed
      Throws:
      ArrayIndexOutOfBoundsException
    • removeElement

      public boolean removeElement(Object obj)
      Removes the first (lowest-indexed) occurrence of the argument from this list.
      Overrides:
      removeElement in class DefaultListModel
      Parameters:
      obj - the component to be removed
      Returns:
      true if the argument was a component of this list; false otherwise
    • set

      public Object set(int index, Object element)
      Replaces the element at the specified position in this list with the specified element.
      Overrides:
      set in class DefaultListModel
      Parameters:
      index - index of element to replace
      element - element to be stored at the specified position
      Throws:
      ArrayIndexOutOfBoundsException
    • setElementAt

      public void setElementAt(Object obj, int index)
      Sets the component at the specified index of this list to be the specified object. The previous component at that position is discarded.
      Overrides:
      setElementAt in class DefaultListModel
      Parameters:
      obj - what the component is to be set to
      index - the specified index
      Throws:
      ArrayIndexOutOfBoundsException
    • toArray

      public Object[] toArray()
      Returns an array containing all of the elements in this list in the correct order.
      Overrides:
      toArray in class DefaultListModel
      Returns:
      an array containing the elements of the list
    • getChecked

      public boolean getChecked(int index)
      returns the checked state of the element at the given index
      Parameters:
      index - the index of the element to return the checked state for
      Returns:
      the checked state of the specifed element
    • setChecked

      public void setChecked(int index, boolean checked)
      sets the checked state of the element at the given index
      Parameters:
      index - the index of the element to set the checked state for
      checked - the new checked state