package cnp.ew.spin;

import java.util.*;
import cnp.ew.util.*;

public class CpStringListSpinEditorLc extends CpSpinEditorLc
{

    public CpStringListSpinEditorLc()
    {
        super("");

        CpSpinFieldLc field;
        model = new CpStringListAndSelectionModel();
        ((CpObservable)model).addObserver(this);
        addSpinField(field = new CpStringListSpinFieldLc());
        addButtons();
        setSelectedField(field);
    }

    public void setStringList(Vector stringList)
    {
        ((CpStringListAndSelectionModel)model).setStringList(stringList);
    }

    public String getSelection()
    {
        return ((CpStringListAndSelectionModel)getModel()).getSelection();
    }

    public Object getObject()
    {
        return getSelection();
    }

    public void setObject(Object object)
    {
        setSelection((String)object);
    }

    public int getSelectedIndex()
    {
        return ((CpStringListAndSelectionModel)getModel()).getSelectionIndex();
    }

    public void setSelection(String newSelection)
    {
        ((CpStringListAndSelectionModel)getModel()).setSelection(newSelection);
    }

    public void setSelectionIndex(int newSelectionIndex)
    {
        ((CpStringListAndSelectionModel)getModel()).setSelectionIndex(newSelectionIndex);
    }
}
