/*
* 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;
public class JSimpleDiscreteWrapper extends JDiscreteWrapper
{
java.util.Vector objects = new java.util.Vector();
java.util.Vector choices = new java.util.Vector();
public JSimpleDiscreteWrapper(String _name, JAccessAdapter _aa)
{
super(_name, _aa);
}
public String[] getChoiceNames()
{
java.util.Vector result = new java.util.Vector();
for(JWrapper wrp : choices)
{
result.add(wrp.getName());
}
return result.toArray(new String[0]);
}
public T selectObject(int i) throws Exception
{
return objects.get(i);
}
public void addObject(T _object, JWrapper _wrapper)
{
objects.add(_object);
choices.add(_wrapper);
}
public int getSelectedIndex()
{
T object = null;
try
{
object = getRawValue();//access_adapter.get();
}
catch(Exception ex) {System.out.println(ex);}
if(object==null) { return 0; } // this is a obscure for now
for(int i=0; i
|