|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--TreeDisplay
This class is responsible for drawing different kinds of trees in different windows.
Field Summary |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
TreeDisplay()
Constructs a defalut tree display object. |
|
TreeDisplay(boolean inBegin)
Constructs a tree display object with the value indicating whether the drawing begins. |
Method Summary | |
void |
compute()
Defines how to compute the positions of all the nodes. |
int |
compute(Node node,
int x,
int y,
int unit_x,
int unit_y)
Defines how to compute the positions of a node. |
void |
computeMaxSeqWidth(java.awt.FontMetrics fm,
Node node)
Defines how to compute the pixels needed to draw the longest sequence. |
int |
computeNJRight(Node node,
int x,
int y,
int unit_x,
int unit_y)
Defines how to compute the positions of a node in the last step of the NJ and the FM algorithms. |
int |
draw(java.awt.Graphics g,
Node node,
int type)
Defines how to draw a tree. |
void |
drawMPRight(java.awt.Graphics g,
Node node)
Defines how to draw the right tree in the last step of the MP algorithm. |
void |
drawNJRight(java.awt.Graphics g,
Node node,
int type)
Defines how to draw the right tree in the last step of the NJ and the FM algorithms. |
java.util.Vector |
getRoots()
Gets the roots of a tree. |
void |
initialize_init_x(java.awt.Graphics g)
Defines how to compute the initial x position to draw a tree. |
void |
initialize_init_y(java.awt.Graphics g)
Defines how to compute the initial y position to draw a tree. |
void |
initialize_unit_x()
Defines how to initialize the x axis scaling factor. |
void |
initialize_unit_y()
Defines how to initialize the y axis scaling factor. |
void |
paintComponent(java.awt.Graphics g)
Defines how a tree is redrawn every time. |
void |
reCalculate(Node root,
int dif_x,
int dif_y)
Defines how to adjust the values to all nodes in the x axis and the y axis for a specified root. |
void |
reCalculateX(Node root,
int diff)
Defines how to adjust the values to all nodes in the x axis for a specified root. |
void |
reset()
Defines how to clean a tree in the display areas. |
void |
scaleTree(int begin_x,
int end_x,
int begin_y,
int end_y,
Node node)
Defines how to scale a node in the tree. |
void |
scaleTreeRight(int begin_x,
int end_x,
int begin_y,
int end_y,
Node node)
Defines how to scale a node in the right part of a final tree in the NJ and the FM algorithms. |
void |
setAlgorithm(Algorithm inAlgorithm)
Sets the algorithm with the drawing object. |
void |
setDisplay(boolean inDisplay)
Sets the display status. |
void |
setFlagString(java.lang.String inFlagString)
Sets the flag string used in the FM algorithm. |
void |
setMaxName(java.lang.String inMaxName)
Sets the longest name of the species. |
void |
setParameters(int inRadius,
int inRect_width,
int inSize)
Sets the parameters used in drawing. |
void |
setRatio(double ratio)
Sets the zoom in or the zoom out ratio of a tree. |
void |
setType(int inType)
Sets the window drawing type, either a big one in the main phylogenetic tree or a small one in other windows. |
void |
start()
Defines how to begin to draw a tree. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TreeDisplay()
public TreeDisplay(boolean inBegin)
inBegin
- the value indicating whether the drawing beginsMethod Detail |
public java.util.Vector getRoots()
public void setParameters(int inRadius, int inRect_width, int inSize)
inRadius
- the radius of the circle representing an interior nodeinRect_width
- the width of the rectangle representing a leaf nodeinSize
- the size of the fontpublic void setType(int inType)
inType
- the window typepublic void setAlgorithm(Algorithm inAlgorithm)
inAlgorithm
- the algorithm to be drawnpublic void setDisplay(boolean inDisplay)
inDisplay
- the display statuspublic void setMaxName(java.lang.String inMaxName)
inMaxName
- the longest name of the speciespublic void setFlagString(java.lang.String inFlagString)
inFlagString
- the flag stringpublic void setRatio(double ratio)
ratio
- the zoom in or the zoom out ratiopublic void start()
public void reset()
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- the Graphics object used to draw graphicspublic void initialize_unit_x()
public void initialize_unit_y()
public void initialize_init_x(java.awt.Graphics g)
g
- the Graphics object used to draw graphicspublic void initialize_init_y(java.awt.Graphics g)
g
- the Graphics object used to draw graphicspublic void computeMaxSeqWidth(java.awt.FontMetrics fm, Node node)
fm
- the FontMetrics object for a specified fontnode
- the Node objectpublic void compute()
public int compute(Node node, int x, int y, int unit_x, int unit_y)
node
- the Node objectx
- the initial x axis positiony
- the initial x axis positionunit_x
- the x axis scaling factorunit_y
- the y axis scaling factor
public int computeNJRight(Node node, int x, int y, int unit_x, int unit_y)
node
- the Node objectx
- the initial x axis positiony
- the initial y axis positionunit_x
- the x axis scaling factorunit_y
- the y axis scaling factor
public void scaleTree(int begin_x, int end_x, int begin_y, int end_y, Node node)
begin_x
- the begin x axis valueend_x
- the end x axis valuebegin_y
- the begin y axis valueend_y
- the end y axis valuenode
- the Node objectpublic void scaleTreeRight(int begin_x, int end_x, int begin_y, int end_y, Node node)
begin_x
- the begin x axis valueend_x
- the end x axis valuebegin_y
- the begin y axis valueend_y
- the end y axis valuenode
- the Node objectpublic int draw(java.awt.Graphics g, Node node, int type)
g
- the Graphics object used to draw graphicsnode
- the Node objecttype
- the type of the node (either a left node or a right node)
public void drawNJRight(java.awt.Graphics g, Node node, int type)
g
- the Graphics object used to draw graphicsnode
- the Node objecttype
- the type of the node (either a left node or a right node)public void drawMPRight(java.awt.Graphics g, Node node)
g
- the Graphics object used to draw graphicsnode
- the Node objectpublic void reCalculateX(Node root, int diff)
root
- the root nodediff
- the value adjusted to all nodes in x axispublic void reCalculate(Node root, int dif_x, int dif_y)
root
- the root nodedif_x
- the value adjusted to all nodes in x axisdif_y
- the value adjusted to all nodes in y axis
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |