2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.ws.params.simple;
21 import jalview.ws.params.OptionI;
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.List;
28 public class Option implements OptionI
31 String name, value, defvalue, description;
33 ArrayList<String> possibleVals = new ArrayList<String>();
40 public String getName()
46 public String getValue()
48 return value == null ? defvalue : value;
52 public void setValue(String selectedItem)
58 public URL getFurtherDetails()
64 public boolean isRequired()
70 public String getDescription()
76 public List<String> getPossibleValues()
81 public Option(Option opt)
83 name = new String(opt.name);
84 if (opt.value != null)
85 value = new String(opt.value);
86 if (opt.defvalue != null)
87 defvalue = new String(opt.defvalue);
88 if (opt.description != null)
89 description = new String(opt.description);
90 if (opt.possibleVals != null)
92 possibleVals = (ArrayList<String>) opt.possibleVals.clone();
94 required = opt.required;
95 // URLs are singletons - so we copy by reference. nasty but true.
96 fdetails = opt.fdetails;
103 public Option(String name2, String description2, boolean isrequired,
104 String defValue, String value, Collection<String> possibleVals,
108 description = description2;
110 this.required = isrequired;
111 this.defvalue = defValue;
112 if (possibleVals != null)
114 this.possibleVals = new ArrayList<String>();
115 this.possibleVals.addAll(possibleVals);
117 this.fdetails = fdetails;
121 public OptionI copy()
123 Option opt = new Option(this);