fr.esrf.tangoatk.widget.attribute
Class StateViewer

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 fr.esrf.tangoatk.widget.attribute.StateViewer
All Implemented Interfaces:
IAttributeStateListener, IDevStateScalarListener, IErrorListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class StateViewer
extends javax.swing.JPanel
implements IDevStateScalarListener

State State is a viewer to surveil and attribute of type DevState. Normally one connects the device with the viewer like this:
IEntity ie =attributeList.add("mydeviceName/StateAtt"); // some method to obtain the state attribute. DevStateScalar stateAtt = (DevStateScalar) stateAtt; fr.esrf.tangoatk.widget.attribute.StateViewer statev = new StateViewer(); statev.setModel(stateAtt);

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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
StateViewer()
           
 
Method Summary
 void clearModel()
           
 void devStateScalarChange(DevStateScalarEvent evt)
           
 void errorChange(ErrorEvent evt)
           
 java.lang.String getCurrentState()
          getCurrentState
 java.lang.String getLabel()
           
 IDevStateScalar getModel()
          getModel gets the model of this stateviewer.
 javax.swing.border.Border getStateBorder()
           
 java.awt.Font getStateFont()
           
 java.awt.Color getStateForeground()
           
 int getStateHorizontalAlignment()
           
 boolean getStateInTooltip()
          getStateInTooltip returns true if the device state is displayed inside the viewer's tooltip
 java.awt.Dimension getStatePreferredSize()
           
 java.lang.String getStateText()
          getStateText gets the text that is on the colored state box
 boolean getUseDeviceAlias()
          getUseDeviceAlias returns true if the device alias is displayed instead of device name
 boolean isLabelVisible()
          isLabelVisible returns the visibility of the label
 boolean isStateVisible()
          isStateVisible returns the visibility of the state value label
static void main(java.lang.String[] args)
           
 void setFont(java.awt.Font font)
           
 void setForeground(java.awt.Color color)
           
 void setLabel(java.lang.String label)
          setLabel set the text of the label.
 void setLabelVisible(boolean visible)
          setLabelVisisble makes the label visible or not.
 void setModel(IDevStateScalar stateAtt)
          setModel sets the model of this viewer.
 void setStateBorder(javax.swing.border.Border border)
           
 void setStateFont(java.awt.Font font)
           
 void setStateForeground(java.awt.Color color)
           
 void setStateHorizontalAlignment(int i)
          setStateHorizontalAlignement
 void setStateInTooltip(boolean b)
          setStateInTooltip display or not the device state inside the tooltip
 void setStatePreferredSize(java.awt.Dimension dimension)
           
 void setStateText(java.lang.String text)
          setStateText sets the text on the colored state box
 void setStateVisible(boolean visible)
          setStateVisible makes the state value lable visible or not.
 void setUseDeviceAlias(boolean b)
          setUseDeviceAlias use or not use device alias
 void stateChange(AttributeStateEvent e)
          stateChange inherited from IAttributeStateListener called when the attribute quality factor changes.
 
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, 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, 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, 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
 

Constructor Detail

StateViewer

public StateViewer()
Method Detail

clearModel

public void clearModel()

setModel

public void setModel(IDevStateScalar stateAtt)
setModel sets the model of this viewer. If the textLabel property is not set, the name of the devState attribute is shown on the textLabel.

Parameters:
stateAtt - a DevStateScalar to surveil

getModel

public IDevStateScalar getModel()
getModel gets the model of this stateviewer.

Returns:
a DevStateScalar value

setLabel

public void setLabel(java.lang.String label)
setLabel set the text of the label. The default value is to show the name of the devState attribute.

Parameters:
label - a String value

getLabel

public java.lang.String getLabel()

setLabelVisible

public void setLabelVisible(boolean visible)
setLabelVisisble makes the label visible or not.

Parameters:
visible - a boolean value

isLabelVisible

public boolean isLabelVisible()
isLabelVisible returns the visibility of the label

Returns:
a boolean value

getUseDeviceAlias

public boolean getUseDeviceAlias()
getUseDeviceAlias returns true if the device alias is displayed instead of device name

Returns:
a boolean value

setUseDeviceAlias

public void setUseDeviceAlias(boolean b)
setUseDeviceAlias use or not use device alias

Parameters:
b - True to enable the usage of device alias.

setStateVisible

public void setStateVisible(boolean visible)
setStateVisible makes the state value lable visible or not.

Parameters:
visible - a boolean value

isStateVisible

public boolean isStateVisible()
isStateVisible returns the visibility of the state value label

Returns:
a boolean value

getStateInTooltip

public boolean getStateInTooltip()
getStateInTooltip returns true if the device state is displayed inside the viewer's tooltip

Returns:
a boolean value

setStateInTooltip

public void setStateInTooltip(boolean b)
setStateInTooltip display or not the device state inside the tooltip

Parameters:
b - If True the device state will be displayed inside the tooltip.

stateChange

public void stateChange(AttributeStateEvent e)
stateChange inherited from IAttributeStateListener called when the attribute quality factor changes.

Specified by:
stateChange in interface IAttributeStateListener
Parameters:
e - A AttributeStateEvent value

devStateScalarChange

public void devStateScalarChange(DevStateScalarEvent evt)
Specified by:
devStateScalarChange in interface IDevStateScalarListener

errorChange

public void errorChange(ErrorEvent evt)
Specified by:
errorChange in interface IErrorListener

getCurrentState

public java.lang.String getCurrentState()
getCurrentState

Returns:
a String value presenting the current value of the DevStateScalar attribute

setStateText

public void setStateText(java.lang.String text)
setStateText sets the text on the colored state box

Parameters:
text - a String value

getStateText

public java.lang.String getStateText()
getStateText gets the text that is on the colored state box

Returns:
a String value

setStateFont

public void setStateFont(java.awt.Font font)

setFont

public void setFont(java.awt.Font font)
Overrides:
setFont in class javax.swing.JComponent

getStateFont

public java.awt.Font getStateFont()

setStateForeground

public void setStateForeground(java.awt.Color color)

getStateForeground

public java.awt.Color getStateForeground()

setForeground

public void setForeground(java.awt.Color color)
Overrides:
setForeground in class javax.swing.JComponent

setStateHorizontalAlignment

public void setStateHorizontalAlignment(int i)
setStateHorizontalAlignement

Parameters:
i - an int value
See Also:
SwingConstants

getStateHorizontalAlignment

public int getStateHorizontalAlignment()

setStatePreferredSize

public void setStatePreferredSize(java.awt.Dimension dimension)

getStatePreferredSize

public java.awt.Dimension getStatePreferredSize()

setStateBorder

public void setStateBorder(javax.swing.border.Border border)

getStateBorder

public javax.swing.border.Border getStateBorder()

main

public static void main(java.lang.String[] args)