1 45 46 package edu.rice.cs.util.docnavigation; 47 48 import javax.swing.AbstractListModel ; 50 import java.util.*; 51 52 class IDocList<ItemT extends INavigatorItem> extends AbstractListModel { 53 private Vector<ItemT> _docs = new Vector<ItemT>(); 54 55 public Enumeration<ItemT> elements() { 56 return _docs.elements(); 57 } 58 59 public void clear() { _docs.clear(); } 60 61 public boolean isEmpty() { return _docs.isEmpty(); } 62 63 public ItemT get(int index) { 64 return _docs.get(index); 65 } 66 67 public Object getElementAt(int i) { 68 return _docs.get(i); 69 } 70 71 public int size() { return _docs.size(); } 72 public int getSize() { return size(); } 73 74 public void add(ItemT d) { 75 _docs.addElement(d); 76 fireIntervalAdded(this, size() - 1, size() - 1); 77 } 78 79 84 public INavigatorItem remove(ItemT doc) { 85 int index = _docs.indexOf(doc); 86 if( index == -1 ) { 87 return null; 88 } 89 90 ItemT ret = _docs.remove(index); 91 fireIntervalRemoved(this, index, index); 92 return ret; 93 } 94 } 95 | Popular Tags |