fr.esrf.tangoatk.widget.attribute
Class SignalScalarLightViewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.AbstractButton
                  extended by javax.swing.JButton
                      extended by fr.esrf.tangoatk.widget.attribute.SignalScalarLightViewer
All Implemented Interfaces:
IAttributeStateListener, IBooleanScalarListener, IErrorListener, INumberScalarListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.SwingConstants

public class SignalScalarLightViewer
extends javax.swing.JButton
implements INumberScalarListener, IBooleanScalarListener

A light to show the value of a signal attribute (this means an attribute representing a boolean value, but of type BooleanScalar or NumberScalar)

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JButton
javax.swing.JButton.AccessibleJButton
 
Nested classes/interfaces inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static javax.swing.ImageIcon blueLED
           
static int booleanLabel
          int representing the option to see attribute's boolean value as label
static javax.swing.ImageIcon brownGrayLED
           
static javax.swing.ImageIcon bulbKO
           
static javax.swing.ImageIcon bulbOff
           
static javax.swing.ImageIcon bulbOn
           
static int completeName
          int representing the option to see attribute's complete Name as label
static int customLabel
          int representing the option to see a custom Label as label
static javax.swing.ImageIcon darkGrayLED
           
static javax.swing.ImageIcon darkOrangeLED
           
static javax.swing.ImageIcon grayLED
           
static javax.swing.ImageIcon greenLED
           
static javax.swing.ImageIcon KOLED
           
static int label
          int representing the option to see attribute's label as label
static int labelAndBoolean
          int representing the option to see attribute's label and the boolean value as label
static javax.swing.ImageIcon lightOrangeLED
           
static int name
          int representing the option to see attribute's name as label
static int nameAndBoolean
          int representing the option to see attribute's name and the boolean value as label
static javax.swing.ImageIcon pinkLED
           
static javax.swing.ImageIcon redLED
           
static javax.swing.ImageIcon whiteLED
           
static javax.swing.ImageIcon yellowLED
           
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SignalScalarLightViewer()
          Constructs a SignalScalarLightViewer with a devicePropertyModel = null and will not show devicePropertyModel's label on setModel(...)
SignalScalarLightViewer(boolean viewLabel)
          Constructs a SignalScalarLightViewer with a devicePropertyModel = null will show devicePropertyModel's label on setModel(...)
 
Method Summary
 void booleanScalarChange(BooleanScalarEvent arg0)
           
 void clearAttributeModel()
          Clears all devicePropertyModel and listener attached to the components
 void errorChange(ErrorEvent arg0)
           
 IAttribute getAttributeModel()
           
 int getChosenLabel()
           
 java.lang.String getFalseLabel()
           
 java.lang.String getTrueLabel()
           
 boolean isViewLabel()
          To know whether devicePropertyModel's label is text of this JLabel or not
static void main(java.lang.String[] args)
          Main class, so you can have an example.
 void numberScalarChange(NumberScalarEvent arg0)
           
 void setAttributeModel(IAttribute numberModel)
          Associates an attribute to this component.
 void setChosenLabel(int chosenLabel)
           
 void setFalseLabel(java.lang.String falseLabel)
           
 void setIconLightKO(javax.swing.ImageIcon icon)
          sets the icon associated with "KO" value = "could not get value" (default : SignalScalarLightViewer.KOLED)
 void setIconLightOff(javax.swing.ImageIcon icon)
          sets the icon associated with the "false" or "0" value (default : SignalScalarLightViewer.grayLED)
 void setIconLightOn(javax.swing.ImageIcon icon)
          sets the icon associated with the "true" or "1" value (default : SignalScalarLightViewer.redLED)
 void setTrueLabel(java.lang.String trueLabel)
           
 void setViewLabel(boolean b)
          To set or unset devicePropertyModel's label as text of this JLabel
 void stateChange(AttributeStateEvent arg0)
           
 
Methods inherited from class javax.swing.JButton
configurePropertiesFromAction, getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
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, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, 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, 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, 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

bulbOff

public static final javax.swing.ImageIcon bulbOff

bulbOn

public static final javax.swing.ImageIcon bulbOn

bulbKO

public static final javax.swing.ImageIcon bulbKO

blueLED

public static final javax.swing.ImageIcon blueLED

brownGrayLED

public static final javax.swing.ImageIcon brownGrayLED

darkGrayLED

public static final javax.swing.ImageIcon darkGrayLED

darkOrangeLED

public static final javax.swing.ImageIcon darkOrangeLED

grayLED

public static final javax.swing.ImageIcon grayLED

greenLED

public static final javax.swing.ImageIcon greenLED

lightOrangeLED

public static final javax.swing.ImageIcon lightOrangeLED

pinkLED

public static final javax.swing.ImageIcon pinkLED

redLED

public static final javax.swing.ImageIcon redLED

whiteLED

public static final javax.swing.ImageIcon whiteLED

yellowLED

public static final javax.swing.ImageIcon yellowLED

KOLED

public static final javax.swing.ImageIcon KOLED

booleanLabel

public static final int booleanLabel
int representing the option to see attribute's boolean value as label

See Also:
Constant Field Values

label

public static final int label
int representing the option to see attribute's label as label

See Also:
Constant Field Values

name

public static final int name
int representing the option to see attribute's name as label

See Also:
Constant Field Values

completeName

public static final int completeName
int representing the option to see attribute's complete Name as label

See Also:
Constant Field Values

customLabel

public static final int customLabel
int representing the option to see a custom Label as label

See Also:
Constant Field Values

labelAndBoolean

public static final int labelAndBoolean
int representing the option to see attribute's label and the boolean value as label

See Also:
Constant Field Values

nameAndBoolean

public static final int nameAndBoolean
int representing the option to see attribute's name and the boolean value as label

See Also:
Constant Field Values
Constructor Detail

SignalScalarLightViewer

public SignalScalarLightViewer()
Constructs a SignalScalarLightViewer with a devicePropertyModel = null and will not show devicePropertyModel's label on setModel(...)


SignalScalarLightViewer

public SignalScalarLightViewer(boolean viewLabel)
Constructs a SignalScalarLightViewer with a devicePropertyModel = null will show devicePropertyModel's label on setModel(...)

Method Detail

numberScalarChange

public void numberScalarChange(NumberScalarEvent arg0)
Specified by:
numberScalarChange in interface INumberScalarListener
See Also:
INumberScalarListener.numberScalarChange(fr.esrf.tangoatk.core.NumberScalarEvent)

setViewLabel

public void setViewLabel(boolean b)
To set or unset devicePropertyModel's label as text of this JLabel

Parameters:
b - a boolean to set or unset devicePropertyModel's label as text of this JLabel. if true and devicePropertyModel is not null, it will set devicePropertyModel's label as text. otherwise it will erase text

isViewLabel

public boolean isViewLabel()
To know whether devicePropertyModel's label is text of this JLabel or not


stateChange

public void stateChange(AttributeStateEvent arg0)
Specified by:
stateChange in interface IAttributeStateListener
See Also:
IAttributeStateListener.stateChange(fr.esrf.tangoatk.core.AttributeStateEvent)

errorChange

public void errorChange(ErrorEvent arg0)
Specified by:
errorChange in interface IErrorListener
See Also:
IErrorListener.errorChange(fr.esrf.tangoatk.core.ErrorEvent)

getAttributeModel

public IAttribute getAttributeModel()
Returns:
Returns the numberModel.

setAttributeModel

public void setAttributeModel(IAttribute numberModel)
Associates an attribute to this component. This attribute should be of type INumberScalar or IBooleanScalar. Otherwise nothing is done.

Parameters:
numberModel - The numberModel to set.

clearAttributeModel

public void clearAttributeModel()
Clears all devicePropertyModel and listener attached to the components


getChosenLabel

public int getChosenLabel()

setChosenLabel

public void setChosenLabel(int chosenLabel)

getFalseLabel

public java.lang.String getFalseLabel()

setFalseLabel

public void setFalseLabel(java.lang.String falseLabel)

getTrueLabel

public java.lang.String getTrueLabel()

setTrueLabel

public void setTrueLabel(java.lang.String trueLabel)

setIconLightOn

public void setIconLightOn(javax.swing.ImageIcon icon)
sets the icon associated with the "true" or "1" value (default : SignalScalarLightViewer.redLED)


setIconLightOff

public void setIconLightOff(javax.swing.ImageIcon icon)
sets the icon associated with the "false" or "0" value (default : SignalScalarLightViewer.grayLED)


setIconLightKO

public void setIconLightKO(javax.swing.ImageIcon icon)
sets the icon associated with "KO" value = "could not get value" (default : SignalScalarLightViewer.KOLED)


booleanScalarChange

public void booleanScalarChange(BooleanScalarEvent arg0)
Specified by:
booleanScalarChange in interface IBooleanScalarListener
See Also:
IBooleanScalarListener.booleanScalarChange(fr.esrf.tangoatk.core.BooleanScalarEvent)

main

public static void main(java.lang.String[] args)
Main class, so you can have an example. You can monitor your own attribute by giving its full path name in argument