All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class test.jcsp.MenuItemTest

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----jcsp.awt.ActiveApplet
                                           |
                                           +----test.jcsp.MenuItemTest

public class MenuItemTest
extends ActiveApplet
implements ItemListener

Applet

Process Diagram

External View

  ______________
 |              |
 | MenuItemTest |
 |______________|
 

Internal View

  _________________________________________________
 |  ___________________                            |
 | |                   |                           |
 | | Java Event Thread |                           |
 | |___________________|                           |
 |   | | |                                         |
 |   | | | configureNew                            |
 |   | | v  ________________                       |
 |   | | | |                | eventNew             |
 |   | | +-| ActiveMenuItem |----->---------+      |
 |   | v   |________________|               |      |
 |   | |                                    v      |
 |   | | configureSave                      |      |
 |   v |    ________________             ___|____  |
 |   | |   |                | eventSave |        | |
 |   | +---| ActiveMenuItem |----->-----|        | |
 |   |     |________________|           |________| |
 |   |                                      |      |
 |   | configureOn                          ^      |
 |   |  ________________________            |      |
 |   | |                        |  eventOn  |      |
 |   +-| ActiveCheckboxMenuItem |---->------+      |
 |     |________________________|                  |
 |                                                 |
 |                                    MenuItemTest |
 |_________________________________________________|
 

Description

The MenuItemTest Applet has four processes two instances of ActiveMenuItem, one instance of ActiveCheckboxMenuItem and an anonymous process running in Parallel.

The anonymous process has an infinite loop which ALTs on the eventNew, eventSave and eventOn Channels. If the eventNew Channel is selected the object is read and then the Object will be displayed on the screen. If the eventSave Channel is selected the object is read and then the Object will be displayed on the screen. If the eventOn Channel is selected two objects will be read from the Channel the first indicating the state (selected) and the second the lable on the MenuItem, both of these will be displayed on the label.

NOTE: The Java Event thread is a process which is created by the Java runtime environment and calls the itemStateChanged method when one of the components the Applet is listening to generates an ItemEvent.

The purpose of this test is to check to see if the events are notified correctly and that the configuration functions correctly.

NOTE: The code for this Applet is not a good example of developing programs using the library, it has been designed to allow the component to be tested without depending on more classes from the library than is necessary.

Author:
P.D.Austin

Constructor Index

 o MenuItemTest()

Method Index

 o getAppletInfo()
returns the name and author of the Applet.
 o init()
Initialise the applet.
 o itemStateChanged(ItemEvent)
Handles ItemEvents generated by components this class is listening to.
 o start()
start the applet running.
 o stop()
Stop the applet running.

Constructors

 o MenuItemTest
 public MenuItemTest()

Methods

 o init
 public void init()
Initialise the applet.

Overrides:
init in class Applet
 o itemStateChanged
 public void itemStateChanged(ItemEvent e)
Handles ItemEvents generated by components this class is listening to.

Parameters:
e - The ItemEvent to be processed
 o start
 public void start()
start the applet running.

Overrides:
start in class ActiveApplet
 o stop
 public void stop()
Stop the applet running.

Overrides:
stop in class ActiveApplet
 o getAppletInfo
 public String getAppletInfo()
returns the name and author of the Applet.

Overrides:
getAppletInfo in class Applet

All Packages  Class Hierarchy  This Package  Previous  Next  Index