/*
* Copyright (C) 2004 Roman Krylov
* rkrylov@mail.ru
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.JWrapper;
import java.lang.*;
import java.util.*;
public abstract class JDiscreteWrapper extends JLeafWrapper
{
protected int selected;
public JDiscreteWrapper(String _name, JAccessAdapter _aa)
{
super(_name, _aa);
selected=0;
}
public int getSelectedIndex()
{
return selected;
}
public int size()
{ return getChoiceNames().length; }
public String getValue()
{ return getChoiceNames()[getSelectedIndex()]; }
public void set_value(int i) throws Exception
{
selected=i;
T value = selectObject(selected);
setRawValue(value);
}
protected T str2value(String str) throws Exception
{
String[] names = getChoiceNames();
for(int i=0; i
|