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.jbgui;
23 import jalview.gui.structurechooser.StructureChooserQuerySource;
24 import jalview.gui.structurechooser.ThreeDBStructureChooserQuerySource;
27 * This inner class provides the data model for the structure filter combo-box
32 public class FilterOption
40 private boolean addSeparatorAfter;
42 private StructureChooserQuerySource querySource;
45 * Model for structure filter option
48 * - the name of the Option
50 * - the value of the option
52 * - the category of the filter option
53 * @param addSeparatorAfter
54 * - if true, a horizontal separator is rendered immediately after
55 * this filter option, otherwise
56 * @param structureChooserQuerySource
57 * - the query source that actions this filter
59 public FilterOption(String name, String value, String view,
60 boolean addSeparatorAfter,
61 StructureChooserQuerySource structureChooserQuerySource)
66 this.querySource = structureChooserQuerySource;
67 this.addSeparatorAfter = addSeparatorAfter;
70 public String getName()
75 public void setName(String name)
80 public String getValue()
85 public void setValue(String value)
90 public String getView()
95 public void setView(String view)
101 public String toString()
106 public boolean isAddSeparatorAfter()
108 return addSeparatorAfter;
111 public void setAddSeparatorAfter(boolean addSeparatorAfter)
113 this.addSeparatorAfter = addSeparatorAfter;
116 public StructureChooserQuerySource getQuerySource()
122 public boolean equals(Object obj)
124 if (obj instanceof FilterOption)
126 FilterOption o = (FilterOption) obj;
127 return o.name.equals(name) && o.querySource == querySource
128 && o.value.equals(value) && o.view == view;
132 return super.equals(obj);
137 public int hashCode()
139 return ("" + name + ":" + value).hashCode()
140 + (view != null ? view.hashCode() : 0)
141 + (querySource != null ? querySource.hashCode() : 0);