JAL-1483 model and api for feature display list on alignment view (refactor)
[jalview.git] / src / jalview / api / AlignViewportI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3  * Copyright (C) 2014 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 java.awt.Color;
24 import java.util.Hashtable;
25 import java.util.Map;
26
27 import jalview.analysis.Conservation;
28 import jalview.datamodel.AlignmentAnnotation;
29 import jalview.datamodel.AlignmentI;
30 import jalview.datamodel.AlignmentView;
31 import jalview.datamodel.CigarArray;
32 import jalview.datamodel.ColumnSelection;
33 import jalview.datamodel.SequenceCollectionI;
34 import jalview.datamodel.SequenceGroup;
35 import jalview.datamodel.SequenceI;
36 import jalview.schemes.ColourSchemeI;
37
38 /**
39  * @author jimp
40  * 
41  */
42 public interface AlignViewportI
43 {
44
45   int getCharWidth();
46
47   int getEndRes();
48
49   int getCharHeight();
50
51   /**
52    * calculate the height for visible annotation, revalidating bounds where
53    * necessary ABSTRACT GUI METHOD
54    * 
55    * @return total height of annotation
56    */
57   public int calcPanelHeight();
58
59   boolean hasHiddenColumns();
60
61   boolean isValidCharWidth();
62
63   boolean isShowConsensusHistogram();
64
65   boolean isShowSequenceLogo();
66
67   boolean isNormaliseSequenceLogo();
68
69   ColourSchemeI getGlobalColourScheme();
70
71   AlignmentI getAlignment();
72
73   ColumnSelection getColumnSelection();
74
75   Hashtable[] getSequenceConsensusHash();
76
77   Hashtable[] getRnaStructureConsensusHash();
78
79   boolean getIgnoreGapsConsensus();
80
81   boolean getCentreColumnLabels();
82
83   boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
84
85   AlignmentAnnotation getAlignmentQualityAnnot();
86
87   AlignmentAnnotation getAlignmentConservationAnnotation();
88
89   /**
90    * get the container for alignment consensus annotation
91    * 
92    * @return
93    */
94   AlignmentAnnotation getAlignmentConsensusAnnotation();
95
96   /**
97    * Test to see if viewport is still open and active
98    * 
99    * @return true indicates that all references to viewport should be dropped
100    */
101   boolean isClosed();
102
103   /**
104    * get the associated calculation thread manager for the view
105    * 
106    * @return
107    */
108   AlignCalcManagerI getCalcManager();
109
110   /**
111    * get the percentage gaps allowed in a conservation calculation
112    * 
113    */
114   public int getConsPercGaps();
115
116   /**
117    * set the consensus result object for the viewport
118    * 
119    * @param hconsensus
120    */
121   void setSequenceConsensusHash(Hashtable[] hconsensus);
122
123   /**
124    * 
125    * @return the alignment annotatino row for the structure consensus
126    *         calculation
127    */
128   AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
129
130   /**
131    * set the Rna structure consensus result object for the viewport
132    * 
133    * @param hStrucConsensus
134    */
135   void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
136
137   /**
138    * set global colourscheme
139    * 
140    * @param rhc
141    */
142   void setGlobalColourScheme(ColourSchemeI rhc);
143
144   Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
145
146   void setHiddenRepSequences(
147           Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
148
149   /**
150    * hides or shows dynamic annotation rows based on groups and group and
151    * alignment associated auto-annotation state flags apply the current
152    * group/autoannotation settings to the alignment view. Usually you should
153    * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
154    * ensure the annotation panel bounds are set correctly.
155    * 
156    * @param applyGlobalSettings
157    *          - apply to all autoannotation rows or just the ones associated
158    *          with the current visible region
159    * @param preserveNewGroupSettings
160    *          - don't apply global settings to groups which don't already have
161    *          group associated annotation
162    */
163   void updateGroupAnnotationSettings(boolean applyGlobalSettings,
164           boolean preserveNewGroupSettings);
165
166   void setSequenceColour(SequenceI seq, Color col);
167
168   Color getSequenceColour(SequenceI seq);
169
170   void updateSequenceIdColours();
171
172   SequenceGroup getSelectionGroup();
173
174   SequenceI[] getSequenceSelection();
175
176   void clearSequenceColours();
177
178   CigarArray getViewAsCigars(boolean selectedRegionOnly);
179
180   AlignmentView getAlignmentView(boolean selectedOnly);
181
182   AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
183
184   String[] getViewAsString(boolean selectedRegionOnly);
185
186   void setSelectionGroup(SequenceGroup sg);
187
188   char getGapCharacter();
189
190   void setColumnSelection(ColumnSelection cs);
191
192   void setConservation(Conservation cons);
193
194   FeaturesDisplayedI getFeaturesDisplayed();
195
196   String getSequenceSetId();
197
198 }