JAL-3070 JAL-3066 JAL-2808 allow feature filter definition via FeatureSettingsModelI
[jalview.git] / src / jalview / api / FeatureSettingsModelI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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.
11  *  
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.
16  * 
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.
20  */
21 package jalview.api;
22
23 import jalview.datamodel.features.FeatureMatcherSetI;
24
25 import java.util.Comparator;
26
27 /**
28  * An interface that describes the settings configurable in the Feature Settings
29  * dialog.
30  * 
31  * @author gmcarstairs
32  */
33 public interface FeatureSettingsModelI extends Comparator<String>
34 {
35
36   // note Java 8 will allow default implementations of these methods in the
37   // interface, simplifying instantiating classes
38
39   /**
40    * Answers true if the specified feature type is displayed
41    * 
42    * @param type
43    * @return
44    */
45   boolean isFeatureDisplayed(String type);
46
47   /**
48    * Answers true if the specified feature group is displayed
49    * 
50    * @param group
51    * @return
52    */
53   boolean isGroupDisplayed(String group);
54
55   /**
56    * Returns the colour (or graduated colour) for the feature type, or null if
57    * not known
58    * 
59    * @param type
60    * @return
61    */
62   FeatureColourI getFeatureColour(String type);
63
64   /**
65    * Returns any filters defined for the feature type, or null if not known
66    * 
67    * @param type
68    * @return
69    */
70
71   FeatureMatcherSetI getFeatureFilters(String type);
72
73   /**
74    * Returns the transparency value, from 0 (fully transparent) to 1 (fully
75    * opaque)
76    * 
77    * @return
78    */
79   float getTransparency();
80
81   /**
82    * Returns -1 if feature1 is displayed before (below) feature 2, +1 if
83    * feature2 is displayed after (on top of) feature1, or 0 if we don't care.
84    * 
85    * <br>
86    * Note that this is the opposite ordering to how features are displayed in
87    * the feature settings dialogue. FeatureRendererModel.setFeaturePriority
88    * takes care of converting between the two.
89    * 
90    * @param feature1
91    * @param feature2
92    * @return
93    */
94   @Override
95   int compare(String feature1, String feature2);
96
97   /**
98    * Answers true if features should be initially sorted so that features with a
99    * shorter average length are displayed on top of those with a longer average
100    * length
101    * 
102    * @return
103    */
104   boolean optimiseOrder();
105
106 }