Module Design - CPMenu Object

 

Designed by: Kunal Mittal
Version: 1.1 29th. April 1998.

 

Overview: This object interfaces the menus described in the User Interface document with the rest of the program.
Private Data:
boolean enabled[]: Stores a true or false value for every menu option. The options are numbered from top to bottom and left to right, as they appear in the menus. True means that the menu item is enabled.
Methods:
public boolean IsEnabled(int item)
Overview: Checks to see whether a particular menu item is enabled or disabled.
Parameters: The index number for the menu item.
Pre-conditions: None.
Post-conditions: None.
Algorithm: Manipulation of internal data.
Interaction with other Objects: None.
Error conditions: None.
Return Value: Returns "true" if item in the enabled Array is enabled and false otherwise.
public void FlipEnabled(int item)
Overview: Swaps the state of a menu item. If enabled, it disables it and vice versa.
Parameters: The index number for the menu item.
Pre-conditions: None.
Post-conditions: Changes the state of the menu item.
Algorithm: Manipulation of internal data.
Interaction with other Objects: None.
Error conditions: None.
Return Value: None.
public void InvokeForLoop(void)
Overview: Calls the Loop object.
Parameters: None.
Pre-conditions: The menu item must be enabled.
Post-conditions: Loop Object is invoked.
Algorithm: First we do a Loop.SetLoopType("For") and then call Loop.DrawMe().
Interaction with other Objects: None.
Error conditions: If the menu item is disabled this will not do anything.
Return Value: None.
public void InvokeWhileLoop(void)
Overview: Calls the Loop Object.
Parameters: None.
Pre-conditions: The menu item must be enabled.
Post-conditions: Loop Object is invoked.
Algorithm: First we do a Loop.SetLoopType("While") and then call Loop.DrawMe().
Interaction with other Objects: None.
Error conditions: If the menu item is disabled this will not do anything.
Return Value: None.
public void LoadLesson(void)
Overview: Calls the Lesson object that loads a lesson into the memory.
Parameters: None.
Pre-conditions: The menu item must be enabled.
Post-conditions: Lesson object is invoked.
Algorithm: Ask the user to select/type in an URL and call Lesson.LoadLesson(url) with the url. Note: The url must end with ".les" as that is the default for saving lessons.
Interaction with other Objects: None.
Error conditions: If the menu item is disabled this will not do anything.. Also if an invalid URL is entered, the URL object throws one of two exceptions - either it says "invalid URL format" or "URL not found".
Return Value: None.
public void RestartLesson(void)
Overview: Calls the Lesson Object to reload the current lesson.
Parameters: None.
Pre-conditions: The menu item must be enabled.
Post-conditions: Lesson Object is invoked.
Algorithm: Calls LoadLesson(url) by passing in a NULL url.
Interaction with other Objects: Lesson Object.
Error conditions: If the menu item is disabled this will not do anything.
Return Value: None.
public void SaveLesson(void)
Overview: Calls the Lesson Object to save the current lesson.
Parameters: None.
Pre-conditions: The menu item must be enabled.
Post-conditions: Lesson Object is invoked.
Algorithm: Call SaveLesson() in the Lesson Object.
Interaction with other Objects: None.
Error conditions: If the menu item is disabled this will not do anything.
Return Value: None.
public void Undo(void)
Overview: Calls the Undo Object to undo the last typed command.
Parameters: None.
Pre-conditions: The menu item must be enabled.
Post-condition: Undo Object is invoked.
Algorithm: Calls Undo() in the Undo Object.
Interaction with other Objects: None.
Error conditions: If the menu item is disabled this will not do anything.
Return Value: None.
private void ShowHelp(URL helpFileName)
Overview: Displays the help text on the screen.
Parameters: A url of an html file to load as the help text.
Pre-conditions: None.
Post-conditions: Displays the help text in a html window.
Algorithm: Load the appropriate help screen.
Interaction with other Objects: None.
Error conditions: None.
Return Value: None.
public void UserManualScreen( void )
Overview: Calls a private method to display the help screen.
Parameters: None.
Pre-conditions: None (Since this menu item is enabled at all times we do not need to check this).
Post-conditions: A private method is called that displays the help text on the screen.
Algorithm: Call the CPMenu.ShowHelp() method with the URL to this help screen.
Interaction with other Objects: None.
Error conditions: None.
Return Value: None.
public void AboutScreen( void )
Overview: Calls a private method to display the help screen.
Parameters: None.
Pre-conditions: None (Since this menu item is enabled at all times we do not need to check this).
Post-conditions: A private method is called that displays the help text on the screen.
Algorithm: Call the CPMenu.ShowHelp() method with the URL to this help screen. Look at User Documentation for name of the URL.
Interaction with other Objects: None.
Error conditions: None.
Return Value: None.
public void HelpKeyScreen( void )
Overview: Calls a private method to display the help screen.
Parameters: None.
Pre-conditions: None (Since this menu item is enabled at all times we do not need to check this).
Post-conditions: A private method is called that displays the help text on the screen.
Algorithm: Call the CPMenu.ShowHelp() method with the URL to this help screen. Look at User Documentation for name of the URL.
Interaction with other Objects: None.
Error conditions: None.
Return Value: None.
public void CheckDone(void)
Overview: The Lesson Object is called to check whether the lesson has been completed successfully.
Parameters: None.
Pre-conditions: The menu item must be enabled.
Post-conditions: Lesson Object is invoked.
Algorithm: Calls CheckLesson() in the Lesson Object.
Interaction with other Objects: None.
Error conditions: If the menu item is disabled this will not do anything.
Return Value: None.

Search engine sitemap created by AutoSitemap.com