FileDocCategorySizeDatePackage
FilterGUIListModel.javaAPI DocExample1762Mon May 31 22:51:38 BST 2004com.darwinsys.swingui

FilterGUIListModel

public class FilterGUIListModel extends ArrayList implements ListModel
FilterGUIListModel combines an ArrayList with a ListModel for ease of use.

Fields Summary
protected Object
source
ArrayList
listeners
Constructors Summary
FilterGUIListModel(Object src)

		source = src;
	
Methods Summary
public booleanadd(java.lang.Object o)

		boolean b = super.add(o);
		if (b)
			notifyListeners();
		return b;
	
public voidadd(int index, java.lang.Object element)

		super.add(index, element);
		notifyListeners();
	
public booleanaddAll(java.util.Collection o)

		boolean b = super.add(o);
		if (b)
          notifyListeners();
		return b;
	
public voidaddListDataListener(javax.swing.event.ListDataListener l)

		listeners.add(l);
	
public voidclear()

		super.clear();
		notifyListeners();
	
public java.lang.ObjectgetElementAt(int index)

		return get(index);
	
public intgetSize()

		return size();
	
voidnotifyListeners()

		// no attempt at optimziation
		ListDataEvent le = new ListDataEvent(source,
			ListDataEvent.CONTENTS_CHANGED, 0, getSize());
		for (int i=0; i<listeners.size(); i++) {
			((ListDataListener)listeners.get(i)).contentsChanged(le);
		}
	
public java.lang.Objectremove(int i)

		Object o = super.remove(i);
		notifyListeners();
		return o;
	
public booleanremove(java.lang.Object o)

		boolean b = super.remove(o);
		if (b)
			notifyListeners();
		return b;
	
public voidremoveListDataListener(javax.swing.event.ListDataListener l)


	      
		listeners.remove(l);
	
public java.lang.Objectset(int index, java.lang.Object element)

		Object o = super.set(index, element);
		notifyListeners();
		return o;