Synergy Home Page

au.edu.swin.synergy.lib
Class BListModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--au.edu.swin.synergy.lib.BListModel
Direct Known Subclasses:
BComboBoxModel

public class BListModel
extends AbstractListModel

Provides a generic means of placing items in a JList or anything else that accepts a ListModel and have more control over its contents.

Author:
Tristan Austin Please complete these missing tags
Copyright Belongs To:
 
See Also:
Serialized Form

Field Summary
protected  Vector listContent
          The content of the list model
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
BListModel()
           
 
Method Summary
 void addElement(Object obj)
          Adds the specified component to the end of this list.
 void doRefresh()
          This will fire the contents changed event to all the List objects containing this model.
 Object getElementAt(int index)
          Returns the component at the specified index.
 int getSize()
          This will get the number of elements in the list
 int indexOf(Object element)
          Gets the index of the specified element.
 void removeAllElements()
          Removes all components from this list and sets its size to zero.
 void removeElement(Object element)
          This will remove the given element from the list
 void removeElementAt(int index)
          This will remove the element at the given location from the list.
 void set(int index, Object element)
          This will set the given element at the specified index.
 void setContents(Vector updatedContents)
          By using this method to set the contents of the model, either initially or to update them, and it will retain the current selection settings.
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listContent

protected Vector listContent
The content of the list model
Constructor Detail

BListModel

public BListModel()
Method Detail

getSize

public int getSize()
This will get the number of elements in the list
Parameters:
-  
Returns:
The size of the list as an int Please complete the missing tags for getSize
Overrides:
getSize in class AbstractListModel
Pre Condition:
 
Post Condition:
 

getElementAt

public Object getElementAt(int index)
Returns the component at the specified index.
Note: Although this method is not deprecated, the preferred method to use is get(int), which implements the List interface defined in the 1.2 Collections framework.
Parameters:
index - an index into this list.
Returns:
the component at the specified index.
Throws:
ArrayIndexOutOfBoundsException - if the index is negative or not less than the current size of this list. given.
Overrides:
getElementAt in class AbstractListModel
See Also:
Please complete the missing tags for getElementAt
Pre Condition:
 
Post Condition:
 

set

public void set(int index,
                Object element)
This will set the given element at the specified index. Any element already in this location will be overwritten
Parameters:
index - The location to set the element
element - The element to set Please complete the missing tags for set
Returns:
 
Pre Condition:
 
Post Condition:
 

setContents

public void setContents(Vector updatedContents)
By using this method to set the contents of the model, either initially or to update them, and it will retain the current selection settings.
Parameters:
updatedContents - The contents of the list Please complete the missing tags for setContents
Returns:
 
Pre Condition:
 
Post Condition:
 

addElement

public void addElement(Object obj)
Adds the specified component to the end of this list.
Parameters:
obj - the component to be added.
Returns:
 
See Also:
Please complete the missing tags for addElement
Pre Condition:
 
Post Condition:
 

removeElementAt

public void removeElementAt(int index)
This will remove the element at the given location from the list.
Parameters:
index - The index of the element to remove
Returns:
 
Throws:
IndexOutOfBoundsException - if the index is outside the bounds of the content Please complete the missing tags for removeElementAt
Pre Condition:
 
Post Condition:
 

removeElement

public void removeElement(Object element)
This will remove the given element from the list
Parameters:
element - The element to remove Please complete the missing tags for removeElement
Returns:
 
Pre Condition:
 
Post Condition:
 

removeAllElements

public void removeAllElements()
Removes all components from this list and sets its size to zero.
Note: Although this method is not deprecated, the preferred method to use is clear(), which implements the List interface defined in the 1.2 Collections framework.
Parameters:
-  
Returns:
 
See Also:
#clear(), Please complete the missing tags for removeAllElements
Pre Condition:
 
Post Condition:
 

indexOf

public int indexOf(Object element)
Gets the index of the specified element.
Parameters:
-  
Returns:
The index in the list, -1 if it doens't exist Please complete the missing tags for indexOf
Pre Condition:
 
Post Condition:
 

doRefresh

public void doRefresh()
This will fire the contents changed event to all the List objects containing this model. This is handy if the display text changes and needs to be updated.

Synergy Home Page