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();
40 public void addToMatchingNodes(TreeNodeI matchedNode);
42 public abstract Set<Long> getMatchingNodesIds();
44 public MouseListener[] getMouseListeners();
47 * Gets the current partitioning threshold which is the ratio of the
48 * partitioning x coordinate to the total panel width.
50 * @return The partition threshold.
52 public float getPartitionThreshold();
54 public abstract TreeI getTree();
56 public abstract File getTreeFile();
58 public abstract Rectangle getVisibleArea();
60 public int getWidth();
63 * Method for triggering PaintRefresher refreshes with the actual tree panel
64 * using the sequence set id the panel was registered with.
66 * @see jalview.gui.PaintRefresher#Refresh(java.awt.Component, String,
68 * @param alignmentChanged
69 * @param validateSequences
71 public void notifyPaintRefresher(boolean alignmentChanged,
72 boolean validateSequences);
75 * Method for triggering PaintRefresher refreshes with the actual tree panel
76 * using a new sequence set id.
78 * @see jalview.gui.PaintRefresher#Refresh(java.awt.Component, String,
80 * @param newSeqSetIdentifier
81 * @param alignmentChanged
82 * @param validateSequences
84 public void notifyPaintRefresher(String newSeqSetIdentifier,
85 boolean alignmentChanged, boolean validateSequences);
87 public abstract void paintToFile(Graphics2D pg, int width, int height);
90 * Registers the actual tree viewing panel used with PaintRefresher, this
91 * method is necessary as panels cannot be registered at this interface level
92 * because there is no guarantee an implementation will be a Component.
94 * @see jalview.gui.PaintRefresher#Register(java.awt.Component, String)
95 * @param sequenceSetIdentifier
97 public void registerWithPaintRefresher(String sequenceSetIdentifier);
99 public void removeMouseListener(MouseListener listener);
101 public void repaint();
103 public abstract void setMatchingNodes(Set<Long> matchingNodes);
105 public void setMaximumSize(Dimension maximumSize);
107 public void setMinimumSize(Dimension minimumSize);
109 public void setPreferredSize(Dimension preferredSize);
115 public abstract void setTreeFile(File file);
121 public boolean showingSubTree();