FileDocCategorySizeDatePackage
VerifierFactoryListModel.javaAPI DocJava SE 5 API4340Fri Aug 26 14:55:24 BST 2005com.sun.org.apache.bcel.internal.verifier

VerifierFactoryListModel

public class VerifierFactoryListModel extends Object implements com.sun.org.apache.bcel.internal.verifier.VerifierFactoryObserver, ListModel
This class implements an adapter; it implements both a Swing ListModel and a VerifierFactoryObserver.
version
$Id: VerifierFactoryListModel.java,v 1.1.1.1 2001/10/29 20:00:32 jvanzyl Exp $
author
Enver Haase

Fields Summary
private ArrayList
listeners
private TreeSet
cache
Constructors Summary
public VerifierFactoryListModel()


    
    VerifierFactory.attach(this);
    update(null); // fill cache.
  
Methods Summary
public synchronized voidaddListDataListener(javax.swing.event.ListDataListener l)

    listeners.add(l);
  
public synchronized java.lang.ObjectgetElementAt(int index)

    return (cache.toArray())[index];
  
public synchronized intgetSize()

    return cache.size();
  
public synchronized voidremoveListDataListener(javax.swing.event.ListDataListener l)

    listeners.remove(l);
  
public synchronized voidupdate(java.lang.String s)

    int size = listeners.size();

    Verifier[] verifiers = VerifierFactory.getVerifiers();
    int num_of_verifiers = verifiers.length;
    cache.clear();
    for (int i=0; i<num_of_verifiers; i++) {
      cache.add(verifiers[i].getClassName());
    }

    for (int i=0; i<size; i++){
      ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, num_of_verifiers-1);
      ((javax.swing.event.ListDataListener) (listeners.get(i))).contentsChanged(e);
    }