fr.esrf.tangoatk.widget.attribute
Class SimpleEnumScalarViewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextField
                      extended by fr.esrf.tangoatk.widget.util.JAutoScrolledText
                          extended by fr.esrf.tangoatk.widget.attribute.SimpleEnumScalarViewer
All Implemented Interfaces:
IAttributeStateListener, IEnumScalarListener, IErrorListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable, javax.swing.SwingConstants

public class SimpleEnumScalarViewer
extends JAutoScrolledText
implements IEnumScalarListener, IErrorListener

A light weigth viewer which display an enumerated scalar attribute (EnumScalar). Here is an example of use:

 fr.esrf.tangoatk.core.AttributeList attributeList = new fr.esrf.tangoatk.core.AttributeList();
 SimpleEnumScalarViewer  = new SimpleEnumScalarViewer();
 IEnumScalar model = (IEnumScalar) attributeList.add("jlp/test/1/Att_six");
 senv.setModel(model);
 attributeList.startRefresher();
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTextField
javax.swing.JTextField.AccessibleJTextField
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
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 fr.esrf.tangoatk.widget.util.JAutoScrolledText
CENTER_ALIGNMENT, CLASSIC_BEHAVIOR, LEFT_ALIGNMENT, MATRIX_BEHAVIOR, RIGHT_ALIGNMENT, SCROLL_LOOP, SCROLL_TO_SEE_END
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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, 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
SimpleEnumScalarViewer()
          Contructs a SimpleEnumScalar viewer.
 
Method Summary
 void clearModel()
          Clears all model and listener attached to the component
 void enumScalarChange(EnumScalarEvent evt)
           
 void errorChange(ErrorEvent evt)
           
 java.awt.Color getBackgroundColor()
          Returns the current background color of this viewer.
 boolean getHasToolTip()
          getHasToolTip returns true if the viewer has a tooltip (attribute full name)
 java.lang.String getInvalidText()
          Returns the current text which is displayed in case of error.
 IEnumScalar getModel()
           
 boolean getQualityInTooltip()
          getQualityInTooltip returns true if the attribute quality factor is displayed inside the viewer's tooltip
 boolean isAlarmEnabled()
          Determines whether the background color is overrided by the quality factor.
static void main(java.lang.String[] args)
          Test function
 void setAlarmEnabled(boolean b)
          Enables or disables alarm background (represents the attribute quality factor).
 void setBackgroundColor(java.awt.Color bg)
          Sets the 'VALID' background color of this viewer.
 void setHasToolTip(boolean b)
          setHasToolTip display or not a tooltip for this viewer
 void setInvalidText(java.lang.String s)
          Set the text which will be displayed in case of error or INVALID quality.
 void setModel(IEnumScalar enumeration)
          Sets the model for this viewer.
 void setQualityInTooltip(boolean b)
          setQualityInTooltip display or not the attribute quality factor inside the tooltip
 void stateChange(AttributeStateEvent evt)
           
 
Methods inherited from class fr.esrf.tangoatk.widget.util.JAutoScrolledText
addTextListener, getHorizontalOffset, getMargin, getMinimumSize, getPreferredSize, getScrollingMode, getSizingBehavior, getSleepTime, getText, getVerticalOffset, getWaitTime, paint, removeTextListener, setAutoScroll, setHorizontalAlignment, setHorizontalOffset, setMargin, setScrollingMode, setSizingBehavior, setSleepTime, setText, setValueOffsets, setVerticalOffset, setWaitTime
 
Methods inherited from class javax.swing.JTextField
addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, paintBorder, 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, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, 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, 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, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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

SimpleEnumScalarViewer

public SimpleEnumScalarViewer()
Contructs a SimpleEnumScalar viewer.

Method Detail

setInvalidText

public void setInvalidText(java.lang.String s)
Set the text which will be displayed in case of error or INVALID quality.

Parameters:
s - Text to be displayed.

getInvalidText

public java.lang.String getInvalidText()
Returns the current text which is displayed in case of error.

See Also:
setInvalidText(java.lang.String)

getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns the current background color of this viewer. Color used for the VALID attribute quality state


setBackgroundColor

public void setBackgroundColor(java.awt.Color bg)
Sets the 'VALID' background color of this viewer. Color used for the VALID attribute quality state.

Parameters:
bg - Background color.
See Also:
setAlarmEnabled(boolean)

setAlarmEnabled

public void setAlarmEnabled(boolean b)
Enables or disables alarm background (represents the attribute quality factor).

Parameters:
b - True to enable alarm.
See Also:
setBackgroundColor(java.awt.Color)

isAlarmEnabled

public boolean isAlarmEnabled()
Determines whether the background color is overrided by the quality factor.

See Also:
setAlarmEnabled(boolean), setBackgroundColor(java.awt.Color)

getModel

public IEnumScalar getModel()

setModel

public void setModel(IEnumScalar enumeration)
Sets the model for this viewer.

Parameters:
IEnumScalar - model

clearModel

public void clearModel()
Clears all model and listener attached to the component


enumScalarChange

public void enumScalarChange(EnumScalarEvent evt)
Specified by:
enumScalarChange in interface IEnumScalarListener

stateChange

public void stateChange(AttributeStateEvent evt)
Specified by:
stateChange in interface IAttributeStateListener

errorChange

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

getHasToolTip

public boolean getHasToolTip()
getHasToolTip returns true if the viewer has a tooltip (attribute full name)

Returns:
a boolean value

setHasToolTip

public void setHasToolTip(boolean b)
setHasToolTip display or not a tooltip for this viewer

Parameters:
b - If True the attribute full name will be displayed as tooltip for the viewer

getQualityInTooltip

public boolean getQualityInTooltip()
getQualityInTooltip returns true if the attribute quality factor is displayed inside the viewer's tooltip

Returns:
a boolean value

setQualityInTooltip

public void setQualityInTooltip(boolean b)
setQualityInTooltip display or not the attribute quality factor inside the tooltip

Parameters:
b - If True the attribute quality factor will be displayed inside the tooltip.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test function

Parameters:
args - Not used
Throws:
java.lang.Exception