Package com.sun.speech.engine

# Class EngineMonitor

java.lang.Object
com.sun.speech.engine.EngineMonitor

Direct Known Subclasses:
  `SynthesizerMonitor`

public class EngineMonitor extends Object
Simple GUI for monitoring events and state changes of an `Engine`. Used for debugging and testing purposes.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected class`
`EngineMonitor.EngineMonitorEngineListener`
Handles engine events from the engine.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected JLabel`
`allocatedLabel`
The label containing the string "allocated".
`protected JLabel`
`allocatingResourcesLabel`
The label containing the string "allocating resources".
`protected JLabel`
`deallocatedLabel`
The label containing the string "deallocated".
`protected JLabel`
`deallocatingResourcesLabel`
The label containing the string "deallocating resources".
`protected Engine`
`engine`
The `Engine` to monitor.
`protected EngineListener`
`engineListener`
The `EngineListener` registered with the engine.
`protected EngineEventPanel`
`eventPanel`
The panel used to post engine events.
`protected JLabel`
`pausedLabel`
The label containing the string "paused".
`protected JLabel`
`resumedLabel`
The label containing the string "resumed".
`protected JPanel`
`statePanel`
The panel containing the current engine states.

## Constructor Summary

Constructors
Constructor
Description
`EngineMonitor(Engine eng)`
Class constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`appendBuffer(StringBuffer b, String s)`
Adds a `String` to a buffer, with each `String` being separated by a ":".
`protected String`
`engineStateString(long state)`
Returns a `String` representing the `state`.
`protected EngineListener`
`getEngineListener()`
Creates the engine listener if necessary, and then returns it.
`Component`
`getEventPanel()`
Gets the panel containing the area to post engine events in.
`Component`
`getStatePanel()`
Gets the panel containing the labels for representing the current engine state.
`protected void`
`handleEvent(EngineEvent e)`
Handles an event from the engine.
`protected void`
`updateEngineStateComponents()`
Checks the current state of the engine and makes sure the GUI components reflect this state accurately.
`protected void`
`updateGUIComponents()`
Checks the current state of the engine and makes sure the GUI components reflect this state accurately.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### engine

protected Engine engine
The `Engine` to monitor.

### engineListener

protected EngineListener engineListener
The `EngineListener` registered with the engine.

### eventPanel

protected EngineEventPanel eventPanel
The panel used to post engine events.

### statePanel

protected JPanel statePanel
The panel containing the current engine states.

### deallocatedLabel

protected JLabel deallocatedLabel
The label containing the string "deallocated".

### allocatingResourcesLabel

protected JLabel allocatingResourcesLabel
The label containing the string "allocating resources".

### allocatedLabel

protected JLabel allocatedLabel
The label containing the string "allocated".

### deallocatingResourcesLabel

protected JLabel deallocatingResourcesLabel
The label containing the string "deallocating resources".

### pausedLabel

protected JLabel pausedLabel
The label containing the string "paused".

### resumedLabel

protected JLabel resumedLabel
The label containing the string "resumed".

## Constructor Details

### EngineMonitor

public EngineMonitor(Engine eng)
Class constructor.

Parameters:
  `eng` - the `Engine` to watch

## Method Details

### getEngineListener

protected EngineListener getEngineListener()
Creates the engine listener if necessary, and then returns it. There should be only one.

Returns:
  the engine listener

### getEventPanel

public Component getEventPanel()
Gets the panel containing the area to post engine events in.

Returns:
  the panel containing the area to post engine events in

### getStatePanel

public Component getStatePanel()
Gets the panel containing the labels for representing the current engine state.

Returns:
  the panel containing the labels for representing the current engine state.

### handleEvent

protected void handleEvent(EngineEvent e)
Handles an event from the engine.

Parameters:
  `e` - the event from the engine

### updateGUIComponents

protected void updateGUIComponents()
Checks the current state of the engine and makes sure the GUI components reflect this state accurately.

### updateEngineStateComponents

protected void updateEngineStateComponents()
Checks the current state of the engine and makes sure the GUI components reflect this state accurately.

### engineStateString

protected String engineStateString(long state)
Returns a `String` representing the `state`.

Parameters:
  `state` - the state to turn into a `String`
Returns:
  a `String` representing the `state`

### appendBuffer

protected void appendBuffer(StringBuffer b, String s)
Adds a `String` to a buffer, with each `String` being separated by a ":".

Parameters:
  `b` - the buffer to which to append `sinvalid input: '<'/code to`
  `s` - the `String` to append to `b`