ciips.animation
Class AlgAnimFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--ciips.animation.AlgAnimFrame
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class AlgAnimFrame
extends java.awt.Frame

The AlgAnimFrame class is a top-level window with a title and border. The layout used is BorderLayout. There is a menubar created at the north part of the panel. The drawing panel is at the center and a commentary panel is located at the south.

This extended frame class holds a set references to the panel/frame objects used in the algorithm animation.

See Also:
Frame, Serialized Form

Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
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
AlgAnimFrame(AlgAnimApp parentApp, java.net.URL sourceURL)
          Creates and shows the frame consists of a drawing panel, commentary panel and control panel.
 
Method Summary
 boolean action(java.awt.Event e, java.lang.Object arg)
          Action handler for the buttons and choice buttons in the control panel.
 void finishAlg()
          This method is invoked at the end of the animation or when the stop button is pressed.
 AlgThread getAlg()
          Returns the reference to the AlgThread which contains the details and execution sequences of the algorithm.
 AlgAnimApp getApplet()
          Get the applet which contains a button to start up this window.
 DrawingPanel getBeforeDp()
           
 ComPanel getComPanel()
          Get the commentary panel that displays messages of any type.
 DrawingPanel getCurrentPanel()
           
 int getDataChoice()
          Get the index of selected choice from the 'Select' pull menu.
 int getDelay()
          Get the delay for highlighting text.
 java.awt.CheckboxMenuItem getDisableAnim()
          Get the menu item which specify if the animation is disabled.
 DrawingPanel getDrawingPanel()
          Returns an instance of the drawing panel which is cast to its super class Panel.
 java.awt.CheckboxMenuItem getEnableAnim()
          Get the menu item which specify if the animation is enabled.
 DrawingPanel getPreviousPanel()
           
 java.awt.Button getRunItem()
          Get the run button from the control panel.
 java.awt.Button getSkipItem()
          Get the skip button from the control panel.
 java.awt.Button getStopItem()
          Get the stop button from the control panel.
 TextFrame getTextFrame()
          Returns an instance of the TextFrame used to set the layout constraints and highlight certain lines of the source code.
 boolean handleEvent(java.awt.Event event)
          Event handler of the frame.
 void Highlight(int n)
          Highlights the specified line of the source code on the text panel.
 boolean isNoAnim()
          Obtain the status of the preferred animation style.
 java.awt.Dimension preferredSize()
          Returns the preferred size of the frame.
 void restoreDrawingPanel()
          Restore the drawing panel at the end of the animation or during initialization.
 void setDelay(int delay)
          Set the delay for highlighting text.
 void setDimension(java.awt.Dimension size)
          Sets the size of the frame.
 void setDrawingPanel(DrawingPanel panel)
          Sets the drawing panel which is cast to its super class Panel.
 void setSkip(boolean skip)
          Sets the attribute which indicate if the skip execution mode is current.
 void setStep(boolean step)
          Sets the attribute which indicate if the step execution mode is current.
 void setText(int n, java.lang.String s)
          Sets the text string to be displayed on a specific text field on the commentary panel return from getComPanel.
 void startAlg()
          Start the animation algorithm if the run or step button is pressed.
 void waitSkip()
          This method is called when the skip execution mode is used.
 void waitStep()
          This method is called when the step execution mode is used.
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, paramString, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

AlgAnimFrame

public AlgAnimFrame(AlgAnimApp parentApp,
                    java.net.URL sourceURL)
Creates and shows the frame consists of a drawing panel, commentary panel and control panel. The text frame is now displayed on a separate window.
Parameters:
parentApp - The applet which results in the creation of this frame
sourceURL - The URL of the source code to be displayed on the text frame
See Also:
URL
Method Detail

preferredSize

public java.awt.Dimension preferredSize()
Returns the preferred size of the frame. By default, it is set to 850x700. It can be modified based on the specific application.
Overrides:
preferredSize in class java.awt.Container
Returns:
the dimension of the frame

setDimension

public void setDimension(java.awt.Dimension size)
Sets the size of the frame.
Parameters:
size - The desired sized of the frame.

handleEvent

public boolean handleEvent(java.awt.Event event)
Event handler of the frame. The main purpose of this method is to cleanup upon receival of the WINDOW_DESTROY event message.
Overrides:
handleEvent in class java.awt.Component

action

public boolean action(java.awt.Event e,
                      java.lang.Object arg)
Action handler for the buttons and choice buttons in the control panel.
Overrides:
action in class java.awt.Component
Parameters:
e - Event invoked
arg - Object that invokes the event

setText

public void setText(int n,
                    java.lang.String s)
Sets the text string to be displayed on a specific text field on the commentary panel return from getComPanel.
Parameters:
n - The text field to display the string. First is 0.
s - The string to be displayed.
See Also:
getComPanel()

Highlight

public void Highlight(int n)
Highlights the specified line of the source code on the text panel. If the line is beyond the scroll pane, it will be scrolled to the center of the window.
Parameters:
n - The line to be highlighted.

restoreDrawingPanel

public void restoreDrawingPanel()
Restore the drawing panel at the end of the animation or during initialization.

startAlg

public void startAlg()
Start the animation algorithm if the run or step button is pressed.

finishAlg

public void finishAlg()
This method is invoked at the end of the animation or when the stop button is pressed. It restores the buttons status on the control panel.

waitStep

public void waitStep()
This method is called when the step execution mode is used. It is normally added to the line where the execution will wait for the step button to be pressed.

waitSkip

public void waitSkip()
This method is called when the skip execution mode is used. It is normally added to the line where the execution will wait after the skip button to be pressed.

setSkip

public void setSkip(boolean skip)
Sets the attribute which indicate if the skip execution mode is current.

setStep

public void setStep(boolean step)
Sets the attribute which indicate if the step execution mode is current.

getAlg

public AlgThread getAlg()
Returns the reference to the AlgThread which contains the details and execution sequences of the algorithm.
See Also:
AlgThread

setDelay

public void setDelay(int delay)
Set the delay for highlighting text.

getDelay

public int getDelay()
Get the delay for highlighting text.

getApplet

public AlgAnimApp getApplet()
Get the applet which contains a button to start up this window.
Returns:
Returns the applet which contains the button to start up this window.

getDrawingPanel

public DrawingPanel getDrawingPanel()
Returns an instance of the drawing panel which is cast to its super class Panel.

getBeforeDp

public DrawingPanel getBeforeDp()

setDrawingPanel

public void setDrawingPanel(DrawingPanel panel)
Sets the drawing panel which is cast to its super class Panel. This instance is used to set the GridBagConstraint of the layout manager.
See Also:
DrawingPanel

getTextFrame

public TextFrame getTextFrame()
Returns an instance of the TextFrame used to set the layout constraints and highlight certain lines of the source code.
See Also:
TextFrame

getComPanel

public ComPanel getComPanel()
Get the commentary panel that displays messages of any type.
Returns:
Commentary panel, in which each text field within can be set to display text string from this class.
See Also:
ComPanel

getDataChoice

public int getDataChoice()
Get the index of selected choice from the 'Select' pull menu.
Returns:
The choice of the data selected.

getSkipItem

public java.awt.Button getSkipItem()
Get the skip button from the control panel.
Returns:
The skip button.

getRunItem

public java.awt.Button getRunItem()
Get the run button from the control panel.
Returns:
The run button.

getStopItem

public java.awt.Button getStopItem()
Get the stop button from the control panel.
Returns:
The stop button.

isNoAnim

public boolean isNoAnim()
Obtain the status of the preferred animation style.
Returns:
True is the animation is kept to a minimum for the animated algorithm; false otherwise.

getEnableAnim

public java.awt.CheckboxMenuItem getEnableAnim()
Get the menu item which specify if the animation is enabled.
Returns:
The checkbox menu item to enable the Animation of the alg.

getDisableAnim

public java.awt.CheckboxMenuItem getDisableAnim()
Get the menu item which specify if the animation is disabled.
Returns:
The checkbox menu item to disable the Animation of the alg.

getCurrentPanel

public DrawingPanel getCurrentPanel()

getPreviousPanel

public DrawingPanel getPreviousPanel()