2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.ws.jws2.dm;
23 import java.net.MalformedURLException;
25 import java.util.List;
27 import compbio.metadata.Option;
28 import jalview.util.MessageManager;
29 import jalview.ws.jws2.ParameterUtils;
30 import jalview.ws.params.OptionI;
32 public class JabaOption implements jalview.ws.params.OptionI
34 public JabaOption(Option rg)
42 public String getValue()
44 return opt.getDefaultValue();
48 public String getName()
54 public URL getFurtherDetails()
58 return new URL(opt.getBasicURL().toExternalForm() + "/"
59 + opt.getFurtherDetails());
60 } catch (NullPointerException q)
62 } catch (MalformedURLException q)
70 public boolean isRequired()
72 return opt.isRequired();
76 public String getDescription()
78 return opt.getDescription();
82 public List<String> getPossibleValues()
84 // TODO: assert typesafety
85 return opt.getPossibleValues();
89 public void setValue(String selectedItem)
93 opt.setDefaultValue(selectedItem);
96 throw new IllegalArgumentException(MessageManager
97 .formatMessage("error.invalid_value_for_option", new String[]
98 { selectedItem, opt.getName() }));
103 public OptionI copy()
105 return new JabaOption(ParameterUtils.copyOption(opt));
109 * get the underlying Jaba option or parameter object. Note - use copy first
110 * if you want to modify the value of the option.
114 public Option getOption()