WIDAR Classes

ca.nrc.widar.mccc.crm
Class VariableLed

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.nrao.widar.gui.widget.BlankPanel
                      extended by ca.nrc.widar.mccc.crm.VariableLed
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class VariableLed
extends BlankPanel

WIDAR/EVLA - VariableLed Class

An LED class inspired by the LedElement Class which will pulse at a specified rate in order to allow a GUI to portray to the user that the underlying application or task assigned to the LED is alive.

Copyright: National Research Council of Canada and Associated Universities Inc., 2010, 2011, 2012

Since:
1.0
Author:
Dave Del Rizzo (Dave.DelRizzo@nrc.gc.ca)
See Also:
Serialized Form
 

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.awt.Color BLACK
           
static int BLINK
           
static java.awt.Color BLUE
           
static int DEFAULT_HEIGHT
           
static int DEFAULT_WIDTH
           
static java.awt.Color GRAY
           
static java.awt.Color GREEN
           
static java.awt.Color OFF
           
static java.awt.Color ORANGE
           
static java.awt.Color PINK
           
static int PULSE
           
static java.awt.Color RED
           
static int SOLID
           
static java.lang.Integer STEPS
           
static java.awt.Color YELLOW
           
 
Fields inherited from class edu.nrao.widar.gui.widget.BlankPanel
bigLabelFont, defaultFont, fieldFont, LABEL_POS_BOTTOM, LABEL_POS_LEFT, LABEL_POS_RIGHT, LABEL_POS_TOP
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
VariableLed(java.awt.Color c)
          Constructor for the Variable LED that places the LED in SOLID mode by default.
VariableLed(java.awt.Color c, int w, int h)
          Constructor for the Variable LED that places the LED in SOLID mode by default.
VariableLed(java.awt.Color c, int m, java.lang.Long i)
          Constructor for the Variable LED that places the LED in the mode specified by the user, at the specified interval.
VariableLed(java.awt.Color c, int m, java.lang.Long i, int w, int h)
          Constructor for the Variable LED that places the LED in the mode specified by the user, at the specified interval.
 
Method Summary
 java.awt.Color getColor()
          Return the active colour.
 java.lang.Long getInterval()
          Returns the current BLINK/PULSE interval value (ms).
 int getMode()
          Return the current active mode of the VariableLed.
 java.awt.Color getOffColor()
          Returns the current OFF colour.
 boolean isActive()
          Returns the response the the query of whether the VariableLed is active or not.
 void paint(java.awt.Graphics g)
          Override of the component paint method.
 void restart()
          A method used to restart the VariableLED in the case that a vital parameter has been changed.
 void setBlink(java.lang.Long newInt)
          Set the VariableLed to BLINK mode with the specified interval (ms) and restart.
 void setBlink(java.lang.Long newInt, java.awt.Color c)
          Set the VariableLed to BLINK mode with the specified interval (ms) and and a new colour.
 void setColor(java.awt.Color c)
          Set the active colour for the VariableLed and restart.
 void setInterval(java.lang.Long newInt)
          Set the BLINK/PULSE interval to the supplied value and restart the VariableLed
 void setMode(int newMode)
          Set the active mode for the VariableLed and restart.
 void setOffColor(java.awt.Color c)
          Set the colour to display when the VariableLed is OFF.
 void setPulse(java.lang.Long newInt)
          Set the VariableLed to PULSE mode with the specified interval (ms) and restart.
 void setPulse(java.lang.Long newInt, java.awt.Color c)
          Set the VariableLed to PULSE mode with the specified interval (ms) and and a new colour.
 void setSolid()
          Set the VariableLed to SOLID mode and restart.
 void setSolid(java.awt.Color c)
          Set the VariableLed to SOLID mode with the specified colour and restart.
 void start()
          Start the VariableLED.
 void stop()
          Stop the VariableLED from running.
 
Methods inherited from class edu.nrao.widar.gui.widget.BlankPanel
add, add, add, add, add, add, add, add, add, add, add, add, add, add, addButton, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addLabel, addPanel, drawGrid, drawGrid, fixMarginsAndGetDimension, getComponent, getField, getFieldText, getValue, setAndAlarm, setField
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RED

public static final java.awt.Color RED

GREEN

public static final java.awt.Color GREEN

YELLOW

public static final java.awt.Color YELLOW

BLUE

public static final java.awt.Color BLUE

PINK

public static final java.awt.Color PINK

ORANGE

public static final java.awt.Color ORANGE

BLACK

public static final java.awt.Color BLACK

GRAY

public static final java.awt.Color GRAY

OFF

public static final java.awt.Color OFF

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
See Also:
Constant Field Values

SOLID

public static final int SOLID
See Also:
Constant Field Values

BLINK

public static final int BLINK
See Also:
Constant Field Values

PULSE

public static final int PULSE
See Also:
Constant Field Values

STEPS

public static final java.lang.Integer STEPS
Constructor Detail

VariableLed

public VariableLed(java.awt.Color c)
Constructor for the Variable LED that places the LED in SOLID mode by default. User supplies the active colour.

Parameters:
c - The active colour for the VariableLed.

VariableLed

public VariableLed(java.awt.Color c,
                   int m,
                   java.lang.Long i)
Constructor for the Variable LED that places the LED in the mode specified by the user, at the specified interval. User also supplies the active colour.

Parameters:
c - The active colour for the VariableLed.
m - The active mode for the VariableLed.
i - The interval (ms) for the VariableLed.

VariableLed

public VariableLed(java.awt.Color c,
                   int w,
                   int h)
Constructor for the Variable LED that places the LED in SOLID mode by default. User supplies the active colour, and the desired dimensions for the panel.

Parameters:
c - The active colour for the VariableLed.
w - The desired width (pixels) of the VariableLed.
h - The desired height (pixels) of the VariableLed.

VariableLed

public VariableLed(java.awt.Color c,
                   int m,
                   java.lang.Long i,
                   int w,
                   int h)
Constructor for the Variable LED that places the LED in the mode specified by the user, at the specified interval. User also supplies the active colour, and the desired dimensions for the panel.

Parameters:
c - The active colour for the VariableLed.
m - The active mode for the VariableLed.
i - The interval (ms) for the VariableLed.
w - The desired width (pixels) of the VariableLed.
h - The desired height (pixels) of the VariableLed.
Method Detail

start

public void start()
Start the VariableLED. The action of this method is dependent upon the currently configured active mode. In the case of SOLID mode, the LED colour is simply changed to the active colour. In the case of either PULSE or BLINK mode, the appropriate timer is engaged at the configured interval. Each time the start method is invoked, the statusTimer is re-instantiated.


restart

public void restart()
A method used to restart the VariableLED in the case that a vital parameter has been changed.


stop

public void stop()
Stop the VariableLED from running. Handles the case that the LED may be in any mode. Essentially kills the statusTimer, sets it to null and changes the LED to the designated OFF colour.


isActive

public boolean isActive()
Returns the response the the query of whether the VariableLed is active or not. This is only useful in the case that the VariableLed is in a PULSE or BLINK mode, as it returns a boolean that indicates whether the statusTimer is null or not.

Returns:
True if the VariableLed in PULSE or BLINK mode is active, False otherwise.

setInterval

public void setInterval(java.lang.Long newInt)
Set the BLINK/PULSE interval to the supplied value and restart the VariableLed

Parameters:
newInt - The new time interval (ms).

getInterval

public java.lang.Long getInterval()
Returns the current BLINK/PULSE interval value (ms).

Returns:
The current interval value (ms).

setSolid

public void setSolid()
Set the VariableLed to SOLID mode and restart.


setSolid

public void setSolid(java.awt.Color c)
Set the VariableLed to SOLID mode with the specified colour and restart.

Parameters:
c - The new colour.

setPulse

public void setPulse(java.lang.Long newInt)
Set the VariableLed to PULSE mode with the specified interval (ms) and restart.

Parameters:
newInt - The PULSE interval (ms).

setPulse

public void setPulse(java.lang.Long newInt,
                     java.awt.Color c)
Set the VariableLed to PULSE mode with the specified interval (ms) and and a new colour. Restart.

Parameters:
newInt - The PULSE interval (ms).
c - The new active colour.

setBlink

public void setBlink(java.lang.Long newInt)
Set the VariableLed to BLINK mode with the specified interval (ms) and restart.

Parameters:
newInt - The BLINK interval (ms).

setBlink

public void setBlink(java.lang.Long newInt,
                     java.awt.Color c)
Set the VariableLed to BLINK mode with the specified interval (ms) and and a new colour. Restart.

Parameters:
newInt - The BLINK interval (ms).
c - The new active colour.

setMode

public void setMode(int newMode)
Set the active mode for the VariableLed and restart.

Parameters:
newMode - The new active mode.

getMode

public int getMode()
Return the current active mode of the VariableLed.

Returns:
The current active mode.

setColor

public void setColor(java.awt.Color c)
Set the active colour for the VariableLed and restart.

Parameters:
c - The new active colour.

getColor

public java.awt.Color getColor()
Return the active colour.

Returns:
The current active colour.

setOffColor

public void setOffColor(java.awt.Color c)
Set the colour to display when the VariableLed is OFF.

Parameters:
c - The colour to display when the LED is OFF.

getOffColor

public java.awt.Color getOffColor()
Returns the current OFF colour.

Returns:
The current OFF colour.

paint

public void paint(java.awt.Graphics g)
Override of the component paint method.

Overrides:
paint in class javax.swing.JComponent
Parameters:
g - The graphics context.

NRAO/DRAO

National Radio Astronomy Observatory