2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
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/>.
18 package jalview.ws.params.simple;
20 import jalview.ws.params.OptionI;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.List;
27 public class Option implements OptionI
30 String name, value, defvalue, description;
32 ArrayList<String> possibleVals = new ArrayList<String>();
39 public String getName()
45 public String getValue()
47 return value == null ? defvalue : value;
51 public void setValue(String selectedItem)
57 public URL getFurtherDetails()
63 public boolean isRequired()
69 public String getDescription()
75 public List<String> getPossibleValues()
80 public Option(Option opt)
82 name = new String(opt.name);
83 if (opt.value != null)
84 value = new String(opt.value);
85 if (opt.defvalue != null)
86 defvalue = new String(opt.defvalue);
87 if (opt.description != null)
88 description = new String(opt.description);
89 if (opt.possibleVals != null)
91 possibleVals = (ArrayList<String>) opt.possibleVals.clone();
93 required = opt.required;
94 // URLs are singletons - so we copy by reference. nasty but true.
95 fdetails = opt.fdetails;
102 public Option(String name2, String description2, boolean isrequired,
103 String defValue, String value, Collection<String> possibleVals,
107 description = description2;
109 this.required = isrequired;
110 this.defvalue = defValue;
111 if (possibleVals != null)
113 this.possibleVals = new ArrayList<String>();
114 this.possibleVals.addAll(possibleVals);
116 this.fdetails = fdetails;
120 public OptionI copy()
122 Option opt = new Option(this);