// Decompiled by Jad v1.5.7. Copyright 1997-99 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   StringListModel.java

package com.symantec.itools.javax.swing.models;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
import javax.swing.AbstractListModel;

public class StringListModel extends AbstractListModel
    implements Serializable
{

    public StringListModel()
    {
        delegate = new Vector();
    }

    public String[] getItems()
    {
        return (String[])toArray();
    }

    public void setItems(String as[])
    {
        Vector vector = new Vector(as.length);
        for(int i = 0; i < as.length; i++)
            vector.addElement(as[i]);

        int j = delegate.size();
        int k = as.length;
        delegate = vector;
        if(j > k)
            fireIntervalRemoved(this, k, j - 1);
        else
        if(j < k)
            fireIntervalAdded(this, j, k - 1);
        fireContentsChanged(this, -1, -1);
    }

    public int getSize()
    {
        return delegate.size();
    }

    public Object getElementAt(int i)
    {
        return delegate.elementAt(i);
    }

    public void copyInto(Object aobj[])
    {
        delegate.copyInto(aobj);
    }

    public void trimToSize()
    {
        delegate.trimToSize();
    }

    public void ensureCapacity(int i)
    {
        delegate.ensureCapacity(i);
    }

    public void setSize(int i)
    {
        int j = delegate.size();
        delegate.setSize(i);
        if(j > i)
        {
            fireIntervalRemoved(this, i, j - 1);
            return;
        }
        if(j < i)
            fireIntervalAdded(this, j, i - 1);
    }

    public int capacity()
    {
        return delegate.capacity();
    }

    public int size()
    {
        return delegate.size();
    }

    public boolean isEmpty()
    {
        return delegate.isEmpty();
    }

    public Enumeration elements()
    {
        return delegate.elements();
    }

    public boolean contains(Object obj)
    {
        return delegate.contains(obj);
    }

    public int indexOf(Object obj)
    {
        return delegate.indexOf(obj);
    }

    public int indexOf(Object obj, int i)
    {
        return delegate.indexOf(obj, i);
    }

    public int lastIndexOf(Object obj)
    {
        return delegate.lastIndexOf(obj);
    }

    public int lastIndexOf(Object obj, int i)
    {
        return delegate.lastIndexOf(obj, i);
    }

    public Object elementAt(int i)
    {
        return delegate.elementAt(i);
    }

    public Object firstElement()
    {
        return delegate.firstElement();
    }

    public Object lastElement()
    {
        return delegate.lastElement();
    }

    public void setElementAt(Object obj, int i)
    {
        delegate.setElementAt(obj, i);
        fireContentsChanged(this, i, i);
    }

    public void removeElementAt(int i)
    {
        delegate.removeElementAt(i);
        fireIntervalRemoved(this, i, i);
    }

    public void insertElementAt(Object obj, int i)
    {
        delegate.insertElementAt(obj, i);
        fireIntervalAdded(this, i, i);
    }

    public void addElement(Object obj)
    {
        int i = delegate.size();
        delegate.addElement(obj);
        fireIntervalAdded(this, i, i);
    }

    public boolean removeElement(Object obj)
    {
        int i = indexOf(obj);
        boolean flag = delegate.removeElement(obj);
        if(i > 0)
            fireIntervalRemoved(this, i, i);
        return flag;
    }

    public void removeAllElements()
    {
        int i = delegate.size() - 1;
        delegate.removeAllElements();
        if(i >= 0)
            fireIntervalRemoved(this, 0, i);
    }

    public String toString()
    {
        return delegate.toString();
    }

    public Object[] toArray()
    {
        String as[] = new String[delegate.size()];
        delegate.copyInto(as);
        return as;
    }

    public Object get(int i)
    {
        return delegate.elementAt(i);
    }

    public Object set(int i, Object obj)
    {
        Object obj1 = delegate.elementAt(i);
        delegate.setElementAt(obj, i);
        fireContentsChanged(this, i, i);
        return obj1;
    }

    public void add(int i, Object obj)
    {
        delegate.insertElementAt(obj, i);
        fireIntervalAdded(this, i, i);
    }

    public Object remove(int i)
    {
        Object obj = delegate.elementAt(i);
        delegate.removeElementAt(i);
        fireIntervalRemoved(this, i, i);
        return obj;
    }

    public void clear()
    {
        int i = delegate.size() - 1;
        delegate.removeAllElements();
        if(i >= 0)
            fireIntervalRemoved(this, 0, i);
    }

    public void removeRange(int i, int j)
    {
        for(int k = j; k >= i; k--)
            delegate.removeElementAt(k);

        fireIntervalRemoved(this, i, j);
    }

    protected Vector delegate;
}
