1 package jalview.ext.treeviewer;
3 import java.awt.Dimension;
4 import java.awt.Graphics2D;
5 import java.awt.MenuContainer;
6 import java.awt.Rectangle;
7 import java.awt.event.MouseListener;
11 import javax.accessibility.Accessible;
14 * Interface for a panel that supports viewing a phylogenetic tree, should
15 * probably be part of a {@link TreeFrameI}. Does not necessarily have to be a
18 * Implementations must always contain a {@link TreeI}.
20 * @author kjvanderheide
23 public interface TreePanelI extends Accessible, MenuContainer
25 public void addMouseListener(MouseListener listener);
28 * Look for a tree node at the specified coordinates inside the panel.
31 * X coordinate on the panel to look at.
33 * Y coordinate on the panel to look at.
34 * @return The tree node if one was found, otherwise null.
36 public abstract TreeNodeI findNode(int x, int y);
38 public int getHeight();
41 * Method for adding a tree node to the Set of nodes that are associated with
42 * some operation outside of the tree, such as nodes belonging to currently
43 * selected Jalview alignment sequences.
47 public void addToMatchingNodes(TreeNodeI matchedNode);
49 public abstract Set<Long> getMatchingNodesIds();
51 public MouseListener[] getMouseListeners();
54 * Gets the current partitioning threshold which is the ratio of the
55 * partitioning x coordinate to the total panel width.
57 * @return The partition threshold.
59 public float getPartitionThreshold();
61 public abstract TreeI getTree();
64 * Gets the File from where the Tree originates.
68 public abstract File getTreeFile();
70 public abstract Rectangle getVisibleArea();
72 public int getWidth();
75 * Method for triggering PaintRefresher refreshes with the actual tree panel
76 * using the sequence set id the panel was registered with.
78 * @see jalview.gui.PaintRefresher#Refresh(java.awt.Component, String,
80 * @param alignmentChanged
81 * @param validateSequences
83 public void notifyPaintRefresher(boolean alignmentChanged,
84 boolean validateSequences);
87 * Method for triggering PaintRefresher refreshes with the actual tree panel
88 * using a new sequence set id.
90 * @see jalview.gui.PaintRefresher#Refresh(java.awt.Component, String,
92 * @param newSeqSetIdentifier
93 * @param alignmentChanged
94 * @param validateSequences
96 public void notifyPaintRefresher(String newSeqSetIdentifier,
97 boolean alignmentChanged, boolean validateSequences);
99 public abstract void paintToFile(Graphics2D pg, int width, int height);
102 * Registers the actual tree viewing panel used with PaintRefresher, this
103 * method is necessary as panels cannot be registered at this interface level
104 * because there is no guarantee an implementation will be a Component.
106 * @see jalview.gui.PaintRefresher#Register(java.awt.Component, String)
107 * @param sequenceSetIdentifier
109 public void registerWithPaintRefresher(String sequenceSetIdentifier);
111 public void removeMouseListener(MouseListener listener);
113 public void repaint();
115 public abstract void setMatchingNodes(Set<Long> matchingNodes);
117 public void setMaximumSize(Dimension maximumSize);
119 public void setMinimumSize(Dimension minimumSize);
121 public void setPreferredSize(Dimension preferredSize);
123 public abstract void setTreeFile(File file);
126 * Checks if the tree has been cut to display just a sub tree.
128 * @return True if the panel is currently showing only a subtree, otherwise
131 public boolean showingSubTree();