jebl.gui.trees.treeviewer
Class TreePane
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
jebl.gui.trees.treeviewer.TreePane
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Printable, Serializable, PainterListener, ControlsProvider
public class TreePane
- extends JComponent
- implements ControlsProvider, PainterListener, Printable
- Author:
- Andrew Rambaut
- See Also:
- Serialized Form
Method Summary |
void |
addSelectedClade(Node selectedNode)
|
void |
addSelectedNode(Node selectedNode)
|
void |
addSelectedTaxa(Node selectedNode)
|
void |
addSelectedTaxon(Taxon selectedTaxon)
|
void |
addTreeSelectionListener(TreeSelectionListener treeSelectionListener)
|
void |
annotateSelectedNodes(String name,
Object value)
|
void |
annotateSelectedTaxa(String name,
Object value)
|
void |
clearSelection()
|
protected void |
drawTree(Graphics2D g2,
double width,
double height)
|
Painter<Node> |
getBranchLabelPainter()
|
List<Controls> |
getControls(boolean detachPrimaryCheckbox)
Get a list of Controls handled by this provider. |
Rectangle2D |
getDragRectangle()
|
double |
getHeightAt(Graphics2D graphics2D,
Point2D point)
|
Node |
getNodeAt(Graphics2D g2,
Point point)
|
Painter<Node> |
getNodeLabelPainter()
|
Set<Node> |
getNodesAt(Graphics2D g2,
Rectangle rect)
|
Painter<TreePane> |
getScaleBarPainter()
|
Set<Node> |
getSelectedNodes()
|
Set<Taxon> |
getSelectedTaxa()
|
void |
getSettings(ControlsSettings settings)
Get the settings for a given Controls object. |
Painter<Node> |
getTaxonLabelPainter()
|
RootedTree |
getTree()
|
Rectangle2D |
getTreeBounds()
|
double |
getTreeScale()
This returns the scaling factor between the graphical image and the branch
lengths of the tree |
boolean |
isShowingRootBranch()
|
boolean |
isShowingTaxonCallouts()
|
boolean |
maintainAspectRatio()
Return whether the two axis scales should be maintained
relative to each other |
void |
paint(Graphics graphics)
|
void |
painterChanged()
|
int |
print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
|
void |
removeTreeSelectionListener(TreeSelectionListener treeSelectionListener)
|
void |
scrollPointToVisible(Point point)
|
void |
setBounds(int x,
int y,
int width,
int height)
|
void |
setBounds(Rectangle rectangle)
|
void |
setBranchDecorator(BranchDecorator branchDecorator)
|
void |
setBranchLabelPainter(Painter<Node> branchLabelPainter)
|
void |
setBranchLineWeight(float weight)
|
void |
setBranchOrdering(boolean orderBranches,
SortedRootedTree.BranchOrdering branchOrdering)
|
void |
setBranchTransform(boolean transformBranches,
TransformedRootedTree.Transform branchTransform)
|
void |
setControlPalette(ControlPalette controlPalette)
Give the controls provider with a handle for the controlPalette object. |
void |
setDragRectangle(Rectangle2D dragRectangle)
|
void |
setNodeLabelPainter(Painter<Node> nodeLabelPainter)
|
void |
setPreferredSize(Dimension dimension)
|
void |
setRuler(double rulerHeight)
|
void |
setScaleBarPainter(Painter<TreePane> scaleBarPainter)
|
void |
setSelectedClade(Node selectedNode)
|
void |
setSelectedNode(Node selectedNode)
|
void |
setSelectedTaxa(Node selectedNode)
|
void |
setSelectedTaxon(Taxon selectedTaxon)
|
void |
setSettings(ControlsSettings settings)
Give the provider some settings. |
void |
setShowingRootBranch(boolean showingRootBranch)
|
void |
setShowingTaxonCallouts(boolean showingTaxonCallouts)
|
void |
setSize(Dimension dimension)
|
void |
setSize(int width,
int height)
|
void |
setTaxonLabelPainter(Painter<Node> taxonLabelPainter)
|
void |
setTree(RootedTree tree)
|
void |
setTreeLayout(TreeLayout treeLayout)
|
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, show, show, size, toString, transferFocus, transferFocusUpCycle |
TreePane
public TreePane()
getTree
public RootedTree getTree()
setTree
public void setTree(RootedTree tree)
setTreeLayout
public void setTreeLayout(TreeLayout treeLayout)
getTreeBounds
public Rectangle2D getTreeBounds()
getTreeScale
public double getTreeScale()
- This returns the scaling factor between the graphical image and the branch
lengths of the tree
- Returns:
- the tree scale
painterChanged
public void painterChanged()
- Specified by:
painterChanged
in interface PainterListener
setBranchOrdering
public void setBranchOrdering(boolean orderBranches,
SortedRootedTree.BranchOrdering branchOrdering)
setBranchTransform
public void setBranchTransform(boolean transformBranches,
TransformedRootedTree.Transform branchTransform)
isShowingRootBranch
public boolean isShowingRootBranch()
setShowingRootBranch
public void setShowingRootBranch(boolean showingRootBranch)
isShowingTaxonCallouts
public boolean isShowingTaxonCallouts()
setShowingTaxonCallouts
public void setShowingTaxonCallouts(boolean showingTaxonCallouts)
setSelectedNode
public void setSelectedNode(Node selectedNode)
setSelectedTaxon
public void setSelectedTaxon(Taxon selectedTaxon)
setSelectedClade
public void setSelectedClade(Node selectedNode)
setSelectedTaxa
public void setSelectedTaxa(Node selectedNode)
addSelectedNode
public void addSelectedNode(Node selectedNode)
addSelectedTaxon
public void addSelectedTaxon(Taxon selectedTaxon)
addSelectedClade
public void addSelectedClade(Node selectedNode)
addSelectedTaxa
public void addSelectedTaxa(Node selectedNode)
clearSelection
public void clearSelection()
annotateSelectedNodes
public void annotateSelectedNodes(String name,
Object value)
annotateSelectedTaxa
public void annotateSelectedTaxa(String name,
Object value)
maintainAspectRatio
public boolean maintainAspectRatio()
- Return whether the two axis scales should be maintained
relative to each other
- Returns:
- a boolean
setTaxonLabelPainter
public void setTaxonLabelPainter(Painter<Node> taxonLabelPainter)
getTaxonLabelPainter
public Painter<Node> getTaxonLabelPainter()
setNodeLabelPainter
public void setNodeLabelPainter(Painter<Node> nodeLabelPainter)
getNodeLabelPainter
public Painter<Node> getNodeLabelPainter()
setBranchLabelPainter
public void setBranchLabelPainter(Painter<Node> branchLabelPainter)
getBranchLabelPainter
public Painter<Node> getBranchLabelPainter()
setScaleBarPainter
public void setScaleBarPainter(Painter<TreePane> scaleBarPainter)
getScaleBarPainter
public Painter<TreePane> getScaleBarPainter()
setBranchDecorator
public void setBranchDecorator(BranchDecorator branchDecorator)
setBranchLineWeight
public void setBranchLineWeight(float weight)
setPreferredSize
public void setPreferredSize(Dimension dimension)
- Overrides:
setPreferredSize
in class JComponent
getHeightAt
public double getHeightAt(Graphics2D graphics2D,
Point2D point)
getNodeAt
public Node getNodeAt(Graphics2D g2,
Point point)
getNodesAt
public Set<Node> getNodesAt(Graphics2D g2,
Rectangle rect)
getSelectedNodes
public Set<Node> getSelectedNodes()
getSelectedTaxa
public Set<Taxon> getSelectedTaxa()
getDragRectangle
public Rectangle2D getDragRectangle()
setDragRectangle
public void setDragRectangle(Rectangle2D dragRectangle)
setRuler
public void setRuler(double rulerHeight)
scrollPointToVisible
public void scrollPointToVisible(Point point)
setControlPalette
public void setControlPalette(ControlPalette controlPalette)
- Description copied from interface:
ControlsProvider
- Give the controls provider with a handle for the controlPalette object.
- Specified by:
setControlPalette
in interface ControlsProvider
getControls
public List<Controls> getControls(boolean detachPrimaryCheckbox)
- Description copied from interface:
ControlsProvider
- Get a list of Controls handled by this provider.
- Specified by:
getControls
in interface ControlsProvider
- Parameters:
detachPrimaryCheckbox
- When false, do nothing. When true, if controls have a "main" on/off switch
(implemented as a JCheckBox), that checkbox should not be included in the controls panel but returned in
- Returns:
- A list of Controls
- See Also:
Controls.getPrimaryCheckbox()
setSettings
public void setSettings(ControlsSettings settings)
- Description copied from interface:
ControlsProvider
- Give the provider some settings.
- Specified by:
setSettings
in interface ControlsProvider
getSettings
public void getSettings(ControlsSettings settings)
- Description copied from interface:
ControlsProvider
- Get the settings for a given Controls object.
- Specified by:
getSettings
in interface ControlsProvider
addTreeSelectionListener
public void addTreeSelectionListener(TreeSelectionListener treeSelectionListener)
removeTreeSelectionListener
public void removeTreeSelectionListener(TreeSelectionListener treeSelectionListener)
paint
public void paint(Graphics graphics)
- Overrides:
paint
in class JComponent
print
public int print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
throws PrinterException
- Specified by:
print
in interface Printable
- Throws:
PrinterException
drawTree
protected void drawTree(Graphics2D g2,
double width,
double height)
setBounds
public void setBounds(int x,
int y,
int width,
int height)
- Overrides:
setBounds
in class Component
setBounds
public void setBounds(Rectangle rectangle)
- Overrides:
setBounds
in class Component
setSize
public void setSize(Dimension dimension)
- Overrides:
setSize
in class Component
setSize
public void setSize(int width,
int height)
- Overrides:
setSize
in class Component