JAL-1953 first pass of adding javadoc, some methods renamed
[jalview.git] / src / jalview / ext / treeviewer / TreeViewerBindingI.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.ext.treeviewer;
22
23 import jalview.commands.CommandI;
24 import jalview.datamodel.SequenceI;
25 import jalview.gui.AlignmentPanel;
26 import jalview.structure.SelectionListener;
27 import jalview.structure.SelectionSource;
28
29 import java.awt.event.ActionListener;
30 import java.awt.event.MouseListener;
31 import java.util.Map;
32
33 /**
34  * 
35  * Interface for associating the nodes of a tree viewer with Jalview alignment
36  * sequences and communicating between the two. Assumes a tree viewer will both
37  * want to receive and send selection events.
38  * 
39  * @author kjvanderheide
40  *
41  * 
42  */
43 public interface TreeViewerBindingI
44         extends ActionListener, MouseListener, SelectionListener,
45         SelectionSource
46 {
47   /**
48    * Gets the mapping for sequences with their associated tree nodes
49    * 
50    * @return
51    */
52   public Map<SequenceI, TreeNodeI> getAlignmentWithNodes();
53
54   /**
55    * Gets the mapping for tree nodes with their associated sequences
56    * 
57    * @return
58    */
59   public Map<TreeNodeI, SequenceI> getNodesWithAlignment();
60
61   /**
62    * 
63    * @param x
64    *          coordinate that functions as the clustering threshold
65    */
66   public void partitionTree(final int x);
67
68   public void showMatchingChildSequences(TreeNodeI parentNode);
69
70   public void showMatchingSequence(TreeNodeI nodeToMatch);
71
72   /**
73    * If a node is selected in the tree panel this method highlights the
74    * corresponding sequence in the Jalview alignment view. If an internal node
75    * is selected all child sequences get highlighted as well.
76    */
77   public void showNodeSelectionOnAlign(TreeNodeI node);
78
79   /**
80    * Sorts the given alignment by the order in which the sequences appear in the
81    * tree.
82    * 
83    * @param alignPanel
84    *          Panel containing the alignment to be sorted.
85    * @return the sorting Command
86    */
87   public CommandI sortAlignmentIn(AlignmentPanel alignPanel);
88
89   public void sortByTree_actionPerformed();
90
91   public void treeSelectionChanged(SequenceI sequence);
92
93 }