|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractListModel | +--uk.ac.man.bioinf.gui.misc.ChunkyListModel
ChunkyListModel.java This is a small extension to the list model class. It allows the addition of several elements at once, with only one fireIntervalAdded event occuring. The reason for this is essentially performance. The DefaultListModel appears to cause a huge amount of repainting whilst it is being loaded with data, which means that it gets a lot slower to add elements when they already are. Whilst there are probably better ways to solve this problem, the simplest would appear to be add the elements in chunks. Since I have written this code I have found various other ways around the repaint problem. However this code is still pretty useful because its got some nice convenience methods for adding and removing many elements at once. The class name is still pretty terrible though.
Created: Tue Nov 17 13:43:56 1998
Compliant: 1.0
Field Summary |
Fields inherited from class javax.swing.AbstractListModel |
listenerList |
Constructor Summary | |
ChunkyListModel()
|
Method Summary | |
void |
add(int index,
Object element)
|
void |
addAll(Collection collection)
This method takes a collection, adds all the elements, then fires an event. |
void |
addAll(Object[] object)
Add all the elements of this array to the list model |
void |
addAll(Vector vector)
Add all the elements of this vector to the list model |
void |
addElement(Object obj)
|
int |
capacity()
|
void |
clear()
|
boolean |
contains(Object elem)
|
void |
copyInto(Object[] anArray)
|
Object |
elementAt(int index)
|
Enumeration |
elements()
|
void |
ensureCapacity(int minCapacity)
|
Object |
firstElement()
|
Object |
get(int index)
|
Object |
getElementAt(int index)
|
int |
getSize()
Everything that follows this is just a straight copy from the default list model |
int |
indexOf(Object elem)
|
int |
indexOf(Object elem,
int index)
|
void |
insertElementAt(Object obj,
int index)
|
boolean |
isEmpty()
|
Object |
lastElement()
|
int |
lastIndexOf(Object elem)
|
int |
lastIndexOf(Object elem,
int index)
|
Object |
remove(int index)
|
void |
removeAll(Collection collection)
|
void |
removeAll(Object[] object)
Removes all the elements of this array from the list modely |
void |
removeAll(Vector vector)
|
void |
removeAllElements()
|
boolean |
removeElement(Object obj)
|
void |
removeElementAt(int index)
|
void |
removeRange(int fromIndex,
int toIndex)
|
Object |
set(int index,
Object element)
|
void |
setElementAt(Object obj,
int index)
|
void |
setSize(int newSize)
|
int |
size()
|
Object[] |
toArray()
|
List |
toList()
|
String |
toString()
|
void |
trimToSize()
|
Methods inherited from class javax.swing.AbstractListModel |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ChunkyListModel()
Method Detail |
public void addAll(Collection collection)
public void addAll(Object[] object)
object
- the arraypublic void addAll(Vector vector)
vector
- the vectorpublic List toList()
public void removeAll(Object[] object)
object
- the arraypublic void removeAll(Vector vector)
public void removeAll(Collection collection)
public int getSize()
public Object getElementAt(int index)
public void copyInto(Object[] anArray)
public void trimToSize()
public void ensureCapacity(int minCapacity)
public void setSize(int newSize)
public int capacity()
public int size()
public boolean isEmpty()
public Enumeration elements()
public boolean contains(Object elem)
public int indexOf(Object elem)
public int indexOf(Object elem, int index)
public int lastIndexOf(Object elem)
public int lastIndexOf(Object elem, int index)
public Object elementAt(int index)
public Object firstElement()
public Object lastElement()
public void setElementAt(Object obj, int index)
public void removeElementAt(int index)
public void insertElementAt(Object obj, int index)
public void addElement(Object obj)
public boolean removeElement(Object obj)
public void removeAllElements()
public String toString()
toString
in class Object
public Object[] toArray()
public Object get(int index)
public Object set(int index, Object element)
public void add(int index, Object element)
public Object remove(int index)
public void clear()
public void removeRange(int fromIndex, int toIndex)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |