1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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/>.
17 *******************************************************************************/
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;
31 ArrayList<String> possibleVals=new ArrayList<String>();
35 public String getName()
41 public String getValue()
43 return value==null ? defvalue : value;
47 public void setValue(String selectedItem)
53 public URL getFurtherDetails()
59 public boolean isRequired()
65 public String getDescription()
71 public List<String> getPossibleValues()
75 public Option(Option opt)
77 name = new String(opt.name);
79 value = new String(opt.value);
80 if (opt.defvalue!=null)
81 defvalue=new String(opt.defvalue);
82 if (opt.description!=null)
83 description=new String(opt.description);
84 if (opt.possibleVals!=null) {
85 possibleVals = (ArrayList<String>)opt.possibleVals.clone();
87 required = opt.required;
88 // URLs are singletons - so we copy by reference. nasty but true.
89 fdetails = opt.fdetails;
95 public Option(String name2, String description2, boolean isrequired,
96 String defValue, String value, Collection<String> possibleVals, URL fdetails)
99 description = description2;
101 this.required = isrequired;
102 this.defvalue = defValue;
103 if (possibleVals!=null)
105 this.possibleVals = new ArrayList<String>();
106 this.possibleVals.addAll(possibleVals);
108 this.fdetails = fdetails;
113 public OptionI copy()
115 Option opt = new Option(this);