package jalview.ext.treeviewer;
+import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.MenuContainer;
import java.awt.Rectangle;
import javax.accessibility.Accessible;
+/**
+ * Interface for a panel that supports viewing a phylogenetic tree, should
+ * probably be part of a {@link TreeFrameI}. Does not necessarily have to be a
+ * Swing JPanel.
+ *
+ * Implementations must always contain a {@link TreeI}.
+ *
+ * @author kjvanderheide
+ *
+ */
public interface TreePanelI extends Accessible, MenuContainer
{
+ public void addMouseListener(MouseListener listener);
+ /**
+ * Look for a tree node at the specified coordinates inside the panel.
+ *
+ * @param x
+ * X coordinate on the panel to look at.
+ * @param y
+ * Y coordinate on the panel to look at.
+ * @return The tree node if one was found, otherwise null.
+ */
+ public abstract TreeNodeI findNode(int x, int y);
- public abstract void setTreeFile(File file);
-
- public abstract File getTreeFile();
-
- public abstract TreeI getTree();
+ public int getHeight();
- public abstract TreeNodeI findNode(int x, int y);
+ /**
+ * Method for adding a tree node to the Set of nodes that are associated with
+ * some operation outside of the tree, such as nodes belonging to currently
+ * selected Jalview alignment sequences.
+ *
+ * @param matchedNode
+ */
+ public void addToMatchingNodes(TreeNodeI matchedNode);
- public abstract void setMatchingNodes(Set<Long> matchingNodes);
+ public abstract Set<Long> getMatchingNodesIds();
- public abstract Set<Long> getMatchingNodes();
+ public MouseListener[] getMouseListeners();
- public void addMouseListener(MouseListener listener);
+ /**
+ * Gets the current partitioning threshold which is the ratio of the
+ * partitioning x coordinate to the total panel width.
+ *
+ * @return The partition threshold.
+ */
+ public float getPartitionThreshold();
- public void removeMouseListener(MouseListener listener);
+ public abstract TreeI getTree();
- public MouseListener[] getMouseListeners();
+ /**
+ * Gets the File from where the Tree originates.
+ *
+ * @return
+ */
+ public abstract File getTreeFile();
- public void repaint();
+ public abstract Rectangle getVisibleArea();
- public void registerWithPaintRefresher(String sequenceSetIdentifier);
+ public int getWidth();
+ /**
+ * Method for triggering PaintRefresher refreshes with the actual tree panel
+ * using the sequence set id the panel was registered with.
+ *
+ * @see jalview.gui.PaintRefresher#Refresh(java.awt.Component, String,
+ * boolean, boolean)
+ * @param alignmentChanged
+ * @param validateSequences
+ */
public void notifyPaintRefresher(boolean alignmentChanged,
boolean validateSequences);
+ /**
+ * Method for triggering PaintRefresher refreshes with the actual tree panel
+ * using a new sequence set id.
+ *
+ * @see jalview.gui.PaintRefresher#Refresh(java.awt.Component, String,
+ * boolean, boolean)
+ * @param newSeqSetIdentifier
+ * @param alignmentChanged
+ * @param validateSequences
+ */
public void notifyPaintRefresher(String newSeqSetIdentifier,
boolean alignmentChanged, boolean validateSequences);
- public int getWidth();
+ public abstract void paintToFile(Graphics2D pg, int width, int height);
- public int getHeight();
+ /**
+ * Registers the actual tree viewing panel used with PaintRefresher, this
+ * method is necessary as panels cannot be registered at this interface level
+ * because there is no guarantee an implementation will be a Component.
+ *
+ * @see jalview.gui.PaintRefresher#Register(java.awt.Component, String)
+ * @param sequenceSetIdentifier
+ */
+ public void registerWithPaintRefresher(String sequenceSetIdentifier);
- public abstract void paintToFile(Graphics2D pg, int width, int height);
+ public void removeMouseListener(MouseListener listener);
- public boolean showingSubTree();
+ public void repaint();
- public float getPartitionThreshold();
+ public abstract void setMatchingNodes(Set<Long> matchingNodes);
- public abstract Rectangle getVisibleArea();
+ public void setMaximumSize(Dimension maximumSize);
+
+ public void setMinimumSize(Dimension minimumSize);
+
+ public void setPreferredSize(Dimension preferredSize);
+
+ public abstract void setTreeFile(File file);
+
+ /**
+ * Checks if the tree has been cut to display just a sub tree.
+ *
+ * @return True if the panel is currently showing only a subtree, otherwise
+ * false.
+ */
+ public boolean showingSubTree();
}