wt.clients.widgets
Class ListSelectorModel

java.lang.Object
  extended byjavax.swing.AbstractListModel
      extended bywt.clients.widgets.ListSelectorModel
All Implemented Interfaces:
ListModel, Serializable
Direct Known Subclasses:
AbstractLiteObjectListSelectorModel, DiscreteQFDetailsSelectorModel, LikeQFDetailsSelectorModel, MainPanelSelectorModel, RangeQFDetailsSelectorModel, RankingDataSelectorModel, UnitsSelectorModel

public class ListSelectorModel
extends AbstractListModel

This is the model for the listSelectorlist. This extends the AbstractListModel and provides features like setListData, add, remove, sorted data

See Also:
Serialized Form

Field Summary
protected  Vector delegate
           
protected  boolean listenersEnabled
           
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
ListSelectorModel()
          Constructs a ListModel
ListSelectorModel(Object[] list)
          Constructs a ListModel and initializes its data
 
Method Summary
 void addElement(Object obj)
          Adds the element into the list.
 int capacity()
          Return the capacity of the vector
 void clear()
          Removes all the elements
 boolean contains(Object elem)
          Return true is the list already contains the element
 void copyInto(Object[] anArray)
          Copy into an array
 Object elementAt(int index)
          Return the element at the index
 Enumeration elements()
          Enumeration of the elements in the list
 void ensureCapacity(int minCapacity)
          Assign minimum capacity to the vector
protected  void fireContentsChanged(Object source, int index0, int index1)
          Fire event when list contents are changed
protected  void fireIntervalAdded(Object source, int index0, int index1)
          Fire event when an item is added to the list
 void fireIntervalRemoved(Object source, int index0, int index1)
          fire event when an item is removed from the list
 Object firstElement()
          Get the first element in the list
 Object get(int index)
          Get the object at the index
 Vector getAllValues()
           
 Object getElementAt(int index)
          Return the element at the location
protected  boolean getListenersEnabled()
          Return true if the listenersEnabled flag is enabled
 int getSize()
          Get the size of the list
 int indexOf(Object elem)
          Return the location of the element
 int indexOf(Object elem, int index)
          Return the locatin of the elment from a given index
 boolean isEmpty()
          Return true if the list is empty
 Object lastElement()
          Get the last element in the list
 int lastIndexOf(Object elem)
          Return the last index of the element
 int lastIndexOf(Object elem, int index)
           
 Object remove(int index)
          Remove the element at the given index
 void removeAllElements()
          Remove all the elements in the list
 boolean removeElement(Object obj)
          Remove element from the list
 void removeElementAt(int index)
          Remove the element in the list at the index
 void removeRange(int fromIndex, int toIndex)
          Remove elements within a range
 void setListData(Object[] list)
          Initialize the list with a set of data
 void setListData(Vector list)
          Initialize the list with a set of data
protected  void setListenersEnabled(boolean enabled)
          Set the listenersEnabled flag
 int size()
          Return the size of the vector
 Object[] toArray()
          toArray
 String toString()
          toString
 void trimToSize()
          Trim the vector to its size
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

delegate

protected Vector delegate

listenersEnabled

protected boolean listenersEnabled
Constructor Detail

ListSelectorModel

public ListSelectorModel()
Constructs a ListModel


ListSelectorModel

public ListSelectorModel(Object[] list)
Constructs a ListModel and initializes its data

Parameters:
list - an array of objects
Method Detail

setListData

public void setListData(Vector list)
Initialize the list with a set of data

Parameters:
list - a Vector of objects

setListData

public void setListData(Object[] list)
Initialize the list with a set of data

Parameters:
list - an array of Objects

getListenersEnabled

protected boolean getListenersEnabled()
Return true if the listenersEnabled flag is enabled


setListenersEnabled

protected void setListenersEnabled(boolean enabled)
Set the listenersEnabled flag

Parameters:
enabled - boolean that sets the listenersEnabled flag

fireContentsChanged

protected void fireContentsChanged(Object source,
                                   int index0,
                                   int index1)
Fire event when list contents are changed


fireIntervalAdded

protected void fireIntervalAdded(Object source,
                                 int index0,
                                 int index1)
Fire event when an item is added to the list


fireIntervalRemoved

public void fireIntervalRemoved(Object source,
                                int index0,
                                int index1)
fire event when an item is removed from the list


getSize

public int getSize()
Get the size of the list


getElementAt

public Object getElementAt(int index)
Return the element at the location

Parameters:
index - the location in the list
Returns:
Object the item in the list

copyInto

public void copyInto(Object[] anArray)
Copy into an array

Parameters:
anArray - where the data is to be copied into

trimToSize

public void trimToSize()
Trim the vector to its size


ensureCapacity

public void ensureCapacity(int minCapacity)
Assign minimum capacity to the vector


capacity

public int capacity()
Return the capacity of the vector

Returns:
capacity

size

public int size()
Return the size of the vector

Returns:
size

isEmpty

public boolean isEmpty()
Return true if the list is empty

Returns:
true if the list is empty or else false

elements

public Enumeration elements()
Enumeration of the elements in the list

Returns:
elements in the list

contains

public boolean contains(Object elem)
Return true is the list already contains the element

Returns:
true if the item is already added to the list

indexOf

public int indexOf(Object elem)
Return the location of the element

Returns:
the location of the element

indexOf

public int indexOf(Object elem,
                   int index)
Return the locatin of the elment from a given index

Returns:
index is the start index

lastIndexOf

public int lastIndexOf(Object elem)
Return the last index of the element

Returns:
the last occurence index of the element

lastIndexOf

public int lastIndexOf(Object elem,
                       int index)

elementAt

public Object elementAt(int index)
Return the element at the index

Returns:
the element at the index

firstElement

public Object firstElement()
Get the first element in the list

Returns:
the first element in the list

lastElement

public Object lastElement()
Get the last element in the list

Returns:
the last element in the list

removeElementAt

public void removeElementAt(int index)
Remove the element in the list at the index

Parameters:
index - whose element is to be removed

addElement

public void addElement(Object obj)
Adds the element into the list. If it is a string, it is added to the list in ascending order


removeElement

public boolean removeElement(Object obj)
Remove element from the list

Returns:
true if the object is removed else false

removeAllElements

public void removeAllElements()
Remove all the elements in the list


toString

public String toString()
toString


toArray

public Object[] toArray()
toArray


get

public Object get(int index)
Get the object at the index

Parameters:
index - whose element is to be returned
Returns:
the element at the given index

remove

public Object remove(int index)
Remove the element at the given index

Parameters:
index - from where the element is to be removed
Returns:
the removed object

clear

public void clear()
Removes all the elements


removeRange

public void removeRange(int fromIndex,
                        int toIndex)
Remove elements within a range

Parameters:
fromIndex -
toIndex -

getAllValues

public Vector getAllValues()