uavsim.graphics.instruments.stallenunciator
Class StallEnunciator

java.lang.Object
  extended by uavsim.graphics.instruments.A_Instrument
      extended by uavsim.graphics.instruments.A_RectangularInstrument
          extended by uavsim.graphics.instruments.stallenunciator.StallEnunciator
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener

public class StallEnunciator
extends A_RectangularInstrument

Defines a simple visual stall enunciator that indicates a stall with the word "STALL". It differentiates imminent and full stalls by the frequency of flashes.

Author:
Dan Tappan [25.08.11]

Nested Class Summary
static class StallEnunciator.E_StallState
          Defines the stall states.
 
Field Summary
private  int _stallBlinkCountdown
          the countdown to flash the stall text
private  StallEnunciator.E_StallState _state
          the stall state
private static TextProperties DISTANCE_TEXT
          the text properties of the distance
private static CoordinateCartesianRelative DISTANCE_WINDOW_ANCHOR_SCALE
          the anchor position of the window relative to the center of the instrument
private static java.awt.Color DISTANCE_WINDOW_BODY_COLOR
          the color of the window body
private static java.awt.Color DISTANCE_WINDOW_OUTLINE_COLOR
          the color of the window body outline
private static Scaler DISTANCE_WINDOW_OUTLINE_SCALE
          the size scale of the distance-window outline relative to the instrument size
private static ScalerPair DISTANCE_WINDOW_SIZE_SCALE
          the size scale of the window relative to the instrument size
private static RectangularFaceplaceDescriptor FACEPLATE
          the faceplace
private static int STALL_BLINK_COUNTDOWN
          the flash rate for blinking the stall text
 
Fields inherited from class uavsim.graphics.instruments.A_RectangularInstrument
_faceplaceDescriptor, _faceSize
 
Fields inherited from class uavsim.graphics.instruments.A_Instrument
_canvasAnchor, _canvasSize, _graphics, _id
 
Constructor Summary
StallEnunciator(java.lang.String id, int canvasSize, CoordinateCartesianAbsolute canvasAnchor)
          Creates a stall enunciator.
 
Method Summary
 StallEnunciator.E_StallState getState()
          Gets the stall state.
 void render(java.awt.Graphics graphics)
          Renders the current state of the instrument.
private  void renderState()
          Renders the stall state.
 java.lang.String toString()
          
 void update(StallEnunciator.E_StallState state)
          Updates the state of the instrument without rendering it.
 
Methods inherited from class uavsim.graphics.instruments.A_RectangularInstrument
getFaceSize, renderBox
 
Methods inherited from class uavsim.graphics.instruments.A_Instrument
getAnchor, getCanvasSize, getGraphics, getID, getParentComponent, handleControlCallback, hasControls, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, refresh, registerControl, setCanvasAnchor, setCanvasSize, setParentComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_stallBlinkCountdown

private int _stallBlinkCountdown
the countdown to flash the stall text


_state

private StallEnunciator.E_StallState _state
the stall state


DISTANCE_TEXT

private static final TextProperties DISTANCE_TEXT
the text properties of the distance


DISTANCE_WINDOW_ANCHOR_SCALE

private static final CoordinateCartesianRelative DISTANCE_WINDOW_ANCHOR_SCALE
the anchor position of the window relative to the center of the instrument


DISTANCE_WINDOW_BODY_COLOR

private static final java.awt.Color DISTANCE_WINDOW_BODY_COLOR
the color of the window body


DISTANCE_WINDOW_OUTLINE_COLOR

private static final java.awt.Color DISTANCE_WINDOW_OUTLINE_COLOR
the color of the window body outline


DISTANCE_WINDOW_OUTLINE_SCALE

private static final Scaler DISTANCE_WINDOW_OUTLINE_SCALE
the size scale of the distance-window outline relative to the instrument size


DISTANCE_WINDOW_SIZE_SCALE

private static final ScalerPair DISTANCE_WINDOW_SIZE_SCALE
the size scale of the window relative to the instrument size


FACEPLATE

private static final RectangularFaceplaceDescriptor FACEPLATE
the faceplace


STALL_BLINK_COUNTDOWN

private static final int STALL_BLINK_COUNTDOWN
the flash rate for blinking the stall text

See Also:
Constant Field Values
Constructor Detail

StallEnunciator

public StallEnunciator(java.lang.String id,
                       int canvasSize,
                       CoordinateCartesianAbsolute canvasAnchor)
Creates a stall enunciator.

Parameters:
id - - the unique instrument identifier
canvasSize - - the square size of the instrument footprint in pixels
canvasAnchor - - the anchor position for the center of the canvas in pixels
Method Detail

getState

public StallEnunciator.E_StallState getState()
Gets the stall state.

Returns:
the state

render

public void render(java.awt.Graphics graphics)
Renders the current state of the instrument.

Overrides:
render in class A_RectangularInstrument
Parameters:
graphics - - the graphics context

renderState

private void renderState()
Renders the stall state.


toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

update

public void update(StallEnunciator.E_StallState state)
Updates the state of the instrument without rendering it.

Parameters:
state - - the stall state