|
||||||||||
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 | +--javax.swing.JPanel | +--DrawingJPanel | +--TreeJPanel | +--BSTTreeJPanel
This class provides the panel for a BSTTree
. It keeps the graphics for drawing
the tree and the image for redrawing. It also keeps a timer for the animation and all changes
to the tree proceed through the panel.
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
protected NodeAndLinkAnimatingJPanel |
animatingPanel
The animatingPanel for this JPanel. |
protected java.lang.String |
backgroundColor
The String for the currently selected backgroundColor. |
static java.lang.String |
CHRISTMAS
Christmas color scheme. |
protected ColorOptionsJPanel |
colorOptionsPanel
The colorOptionsPanel held currently within this panel. |
protected javax.swing.JComboBox |
colorPresetOptionsJComboBox
JComboBox that holds all of the schemes available for this current settings. |
protected javax.swing.JComboBox |
colorSchemesJComboBox
JComboBox that holds all of the schemes available for this current settings. |
protected java.lang.String |
colorSettings
The variable holding the colorSettings. |
protected javax.swing.JComboBox |
colorSettingsJComboBox
JComboBox that holds all of the settings available for this current function. |
static java.lang.String |
DEFAULT
Default color scheme. |
protected java.lang.String |
deleteLeftLinePaintSettings
The protected String for the currently selected left line paint. |
protected java.lang.String |
deleteRightLinePaintSettings
The protected String for the currently selected right line paint. |
protected java.lang.String |
drawingKeySettings
The protected String for the currently selected drawing Key Settings. |
protected java.lang.String |
drawingNodeSettings
The protected String for the currently selected drawing Node Settings. |
protected NodeAndLinkDrawingJPanel |
drawingPanel
The drawingPanel for this JPanel. |
protected javax.swing.JComboBox |
functionJComboBox
JComboBox that holds all of the functions available for this panel. |
static java.lang.String |
HALLOWEEN
Halloween color scheme. |
protected java.lang.String |
insertAnimatorKeySettings
The protected String for the currently selected insertion Animator Key Settings. |
protected java.lang.String |
insertAnimatorNodeSettings
The protected String for the currently selected insertion Animator Node Settings. |
protected java.lang.String |
insertNodeLeftSettings
The protected String for the currently selected insertion Left Node Settings. |
protected java.lang.String |
insertNodeRightSettings
The protected String for the currently selected insertion Right Node Settings. |
static java.lang.String |
PRIMARY
Default color scheme. |
static java.lang.String |
PRINCETON
Princeton color scheme. |
protected java.lang.String |
rotateAnimatorKeySettings
The protected String for the currently selected rotated Animator Key Settings. |
protected java.lang.String |
rotateChildNodeSettings
The protected String for the currently selected rotated Child Node Settings. |
protected java.lang.String |
rotateDescendantNodeSettings
The protected String for the currently selected rotated Descendant Node Settings. |
protected java.lang.String |
rotateOriginalKeySettings
The protected String for the currently selected rotated Original Key Settings. |
protected java.lang.String |
rotateOriginalNodeSettings
The protected String for the currently selected rotated Original Node Settings. |
protected java.lang.String |
rotateRootNodeSettings
The protected String for the currently selected rotated Root Node Settings. |
protected java.lang.String |
searchAnimatorKeySettings
The protected String for the currently selected searching Animator Key Settings. |
protected java.lang.String |
searchAnimatorNodeSettings
The protected String for the currently selected searching Animator Node Settings. |
protected java.lang.String |
searchNodeLeftSettings
The protected String for the currently selected searching Left Node Settings. |
protected java.lang.String |
searchNodeRightSettings
The protected String for the currently selected searching Right Node Settings. |
protected java.lang.String |
selectAnimatorKeySettings
The protected String for the currently selected select Animator Key Settings. |
protected java.lang.String |
selectAnimatorNodeSettings
The protected String for the currently selected select Animator Node Settings. |
protected java.lang.String |
selectNodeLeftSettings
The protected String for the currently selected select Left Node Settings. |
protected java.lang.String |
selectNodeRightSettings
The protected String for the currently selected select Right Node Settings. |
protected java.lang.String |
traverseAnimatorKeySettings
The protected String for the currently selected traversal animator Key Settings. |
protected java.lang.String |
traverseAnimatorNodeSettings
The protected String for the currently selected traversal animator Node Settings. |
Fields inherited from class TreeJPanel |
BACKGROUND, CHARACTER, DEFAULT_DELAY, DELETE, DOUBLE, DRAWING, INSERT, INTEGER, KEY, KEY_ANIMATOR_SETTINGS, KEY_ORIGINAL_SETTINGS, LEFT_PAINT, NODE, NODE_ANIMATOR_SETTINGS, NODE_CHILD_SETTINGS, NODE_DESCENDANT_SETTINGS, NODE_LEFT_SETTINGS, NODE_ORIGINAL_SETTINGS, NODE_RIGHT_SETTINGS, NODE_ROOT_SETTINGS, NOKEY, PAINT, RIGHT_PAINT, ROTATE, SEARCH, SELECT, TRAVERSE, TYPEERR |
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 | |
BSTTreeJPanel()
Sole Constructor. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Listens to action events. |
void |
balanceCommand(Tree node)
Balance command. |
protected void |
balanceNode(BSTTree node)
Balances the given node. |
protected void |
balanceTree()
Balances the entire tree. |
protected void |
changeDisplay()
Changes the display. |
void |
constructColorOptions(ColorOptionsJPanel colorOptionsPanel)
Constructs the color options combo box and sets the box for the given colorOptionsPanel. |
void |
constructPresetColorOptions(ColorOptionsJPanel colorOptionsPanel)
Constructs the color settings combo box and sets the box for the given colorOptionsPanel. |
void |
displayChangeCommand()
Change Display Command. |
void |
drawAnimatingNode()
Draws the animating node using the currently selected animating settings. |
void |
drawDrawingNode()
Draws the drawing node using the currently selected drawing settings. |
java.lang.String[] |
getColorSchemeOptions()
Gets the color scheme aniamtion options for the current tree. |
java.lang.String |
getColorSchemeSetting(java.lang.String function,
java.lang.String setting)
Gets the Color Scheme setting for the given function and setting. |
java.lang.String[] |
getColorSchemesList(java.lang.String settings)
Gets the color scheme settings for each type of settings. |
java.lang.String[] |
getColorSettings()
Gets the color settings options for the current tree. |
java.lang.String |
getColorSettingsString()
Gets the color settings string of the current panel to the colorSettings param. |
java.lang.String[] |
getOptionColorSchemeOptions(java.lang.String option)
Gets the color scheme options for each type of animation. |
java.lang.String |
getTitle()
Gets the title for the tree. |
javax.swing.JPopupMenu |
makeJPopupMenu(java.awt.event.ActionListener actionlistener)
Constructs a popupmenu, using the actionlistener passed. |
void |
optionEventPerformed(OptionEvent e)
Recieved an event from an OptionJPanel with one of the given commands. |
void |
resetSettingStrings()
Resets the string settings currently selected. |
void |
rotateToTopCommand(Tree node)
RotateToTop command. |
protected void |
rotateToTopNode(BSTTree node)
Rotates up the given node to the top. |
void |
rotateUpCommand(Tree node)
RotateUp command. |
void |
rotateUpDoubleCommand(Tree node)
RotateUpDouble command. |
protected void |
rotateUpDoubleNode(BSTTree node)
Doubly Rotates up the given node. |
protected void |
rotateUpNode(BSTTree node)
Rotates up the given node. |
void |
setAnimating(boolean animating)
Sets whether the tree is animating or not. |
void |
setColorSchemeSetting(java.lang.String presetScheme)
Sets the color scheme using the given preset scheme string. |
void |
setColorSchemeSetting(java.lang.String function,
java.lang.String setting,
java.lang.String scheme)
Sets the color scheme using the given function and setting. |
void |
setColorSettingsString(java.lang.String colorSettings)
Sets the color settings string of the current panel to the colorSettings param. |
void |
setComponentShown(boolean componentShown)
Sets whether the tree is shown or not. |
void |
setSettings()
Sets the settings for the panel using the currently selected String options. |
void |
setSettings(TreeJPanel panel)
Sets the settings for the panel using the currently selected String options. |
void |
splayCommand(Tree node)
Splay command. |
protected void |
splayNode(BSTTree node)
Splays up the given node. |
void |
traverseCommand(int traverseType)
Traverse command. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
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, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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 |
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 |
Field Detail |
public static final java.lang.String DEFAULT
public static final java.lang.String PRIMARY
public static final java.lang.String PRINCETON
public static final java.lang.String CHRISTMAS
public static final java.lang.String HALLOWEEN
protected java.lang.String backgroundColor
protected java.lang.String drawingNodeSettings
protected java.lang.String drawingKeySettings
protected java.lang.String insertNodeLeftSettings
protected java.lang.String insertNodeRightSettings
protected java.lang.String insertAnimatorNodeSettings
protected java.lang.String insertAnimatorKeySettings
protected java.lang.String searchNodeLeftSettings
protected java.lang.String searchNodeRightSettings
protected java.lang.String searchAnimatorNodeSettings
protected java.lang.String searchAnimatorKeySettings
protected java.lang.String selectNodeLeftSettings
protected java.lang.String selectNodeRightSettings
protected java.lang.String selectAnimatorNodeSettings
protected java.lang.String selectAnimatorKeySettings
protected java.lang.String rotateChildNodeSettings
protected java.lang.String rotateRootNodeSettings
protected java.lang.String rotateDescendantNodeSettings
protected java.lang.String rotateOriginalNodeSettings
protected java.lang.String rotateAnimatorKeySettings
protected java.lang.String rotateOriginalKeySettings
protected java.lang.String deleteLeftLinePaintSettings
protected java.lang.String deleteRightLinePaintSettings
protected java.lang.String traverseAnimatorNodeSettings
protected java.lang.String traverseAnimatorKeySettings
protected NodeAndLinkAnimatingJPanel animatingPanel
protected NodeAndLinkDrawingJPanel drawingPanel
protected java.lang.String colorSettings
protected javax.swing.JComboBox functionJComboBox
protected javax.swing.JComboBox colorSettingsJComboBox
protected javax.swing.JComboBox colorSchemesJComboBox
protected javax.swing.JComboBox colorPresetOptionsJComboBox
protected ColorOptionsJPanel colorOptionsPanel
Constructor Detail |
public BSTTreeJPanel()
Method Detail |
public java.lang.String getTitle()
getTitle
in class TreeJPanel
public void resetSettingStrings()
public void setSettings()
The Panel used is the current panel.
public void setSettings(TreeJPanel panel)
The Panel used is the passed panel.
setSettings
in class TreeJPanel
panel
- panel to which the settings are changed according to the currently
selected settings.public void setColorSettingsString(java.lang.String colorSettings)
colorSettings
- the String defining the colorSettings for the current panel.public java.lang.String getColorSettingsString()
public void drawDrawingNode()
public void drawAnimatingNode()
public java.lang.String getColorSchemeSetting(java.lang.String function, java.lang.String setting)
function
- String function like DRAWING or BACKGROUND.setting
- String setting choice for which the color setting is requested like NODE.
public void setColorSchemeSetting(java.lang.String function, java.lang.String setting, java.lang.String scheme)
function
- for which the setting is given.setting
- the setting for which the scheme is set.scheme
- the color setting used for the given function and setting.public void setColorSchemeSetting(java.lang.String presetScheme)
presetScheme
- the preset sceme defined.public java.lang.String[] getColorSchemeOptions()
public java.lang.String[] getColorSettings()
public java.lang.String[] getOptionColorSchemeOptions(java.lang.String option)
public java.lang.String[] getColorSchemesList(java.lang.String settings)
public void constructColorOptions(ColorOptionsJPanel colorOptionsPanel)
constructColorOptions
in class TreeJPanel
colorOptionsPanel
- the colorToolsJPanel for which the JComboBox is set.public void constructPresetColorOptions(ColorOptionsJPanel colorOptionsPanel)
constructPresetColorOptions
in class TreeJPanel
colorOptionsPanel
- the colorOptionsPanel for which the JComboBox is set.public javax.swing.JPopupMenu makeJPopupMenu(java.awt.event.ActionListener actionlistener)
makeJPopupMenu
in class TreeJPanel
actionlistener
- the listener add to the actions of all the items made in the menu.
public void setAnimating(boolean animating)
setAnimating
in class TreeJPanel
animating
- boolean flag as to whether the tree is animating.public void setComponentShown(boolean componentShown)
setComponentShown
in class DrawingJPanel
componentShown
- boolean flag as to whether the tree is shown.protected void rotateUpNode(BSTTree node)
node
- the node to rotate up.protected void rotateToTopNode(BSTTree node)
node
- the node to rotate up.protected void rotateUpDoubleNode(BSTTree node)
node
- the node to rotate up.protected void splayNode(BSTTree node)
node
- the node to rotate up.protected void balanceTree()
protected void balanceNode(BSTTree node)
node
- the node to balance.protected void changeDisplay()
public void rotateUpCommand(Tree node)
rotateUpCommand
in class TreeJPanel
node
- Tree to rotateUp.public void rotateToTopCommand(Tree node)
rotateToTopCommand
in class TreeJPanel
node
- Tree to rotateToTop.public void rotateUpDoubleCommand(Tree node)
rotateUpDoubleCommand
in class TreeJPanel
node
- Tree to rotateUpDouble.public void splayCommand(Tree node)
splayCommand
in class TreeJPanel
node
- Tree to splay.public void traverseCommand(int traverseType)
traverseCommand
in class TreeJPanel
traverseType
- int that defines the traverseType.public void balanceCommand(Tree node)
balanceCommand
in class TreeJPanel
node
- Tree to balance.public void displayChangeCommand()
public void optionEventPerformed(OptionEvent e)
optionEventPerformed
in interface OptionListener
optionEventPerformed
in class TreeJPanel
e
- OptionEvent recieved from the event performed.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class TreeJPanel
e
- ActionEvent that contains information about the tree.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |