public class SimpleScalarViewer extends JAutoScrolledText implements INumberScalarListener, IStringScalarListener, IBooleanScalarListener, java.beans.PropertyChangeListener, IErrorListener, JDrawable
fr.esrf.tangoatk.core.AttributeList attributeList = new fr.esrf.tangoatk.core.AttributeList(); SimpleScalarViewer snv = new SimpleScalarViewer(); INumberScalar model = (INumberScalar) attributeList.add("jlp/test/1/att_quatre"); snv.setModel(model); attributeList.startRefresher();
javax.swing.JTextField.AccessibleJTextField
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
javax.swing.JComponent.AccessibleJComponent
CENTER_ALIGNMENT, CLASSIC_BEHAVIOR, LEFT_ALIGNMENT, MATRIX_BEHAVIOR, RIGHT_ALIGNMENT, SCROLL_LOOP, SCROLL_TO_SEE_END
accessibleContext, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
SimpleScalarViewer()
Contructs a SimpleScalar viewer.
|
Modifier and Type | Method and Description |
---|---|
void |
booleanScalarChange(BooleanScalarEvent evt) |
void |
clearModel()
Clears all model and listener attached to the components
|
void |
errorChange(ErrorEvent evt) |
java.awt.Color |
getBackgroundColor()
Returns the current background color of this viewer.
|
IBooleanScalar |
getBooleanModel() |
javax.swing.JComponent |
getComponent()
Returns the JComponent that implements this interface.
|
java.lang.String |
getDescription(java.lang.String name)
Get a description of this extensions.
|
java.lang.String |
getExtendedParam(java.lang.String name)
Returns the specified parameter value.
|
java.lang.String[] |
getExtensionList()
Returns list of extension name for this objects (Empty array for none).
|
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.
|
INumberScalar |
getNumberModel() |
boolean |
getQualityInTooltip()
getQualityInTooltip returns true if the attribute quality factor is displayed inside the viewer's tooltip |
IStringScalar |
getStringModel() |
boolean |
getUnitVisible()
Detemines wether the unit is visible
|
java.lang.String |
getUserFormat()
Returns the user format.
|
void |
initForEditing()
Call after a component of a JDSwingObject is created, this give a default look
and feel for editing.
|
boolean |
isAlarmEnabled()
Determines whether the background color is overrided by the quality factor.
|
static void |
main(java.lang.String[] args)
Test function
|
void |
numberScalarChange(NumberScalarEvent evt) |
void |
propertyChange(java.beans.PropertyChangeEvent evt) |
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.
|
boolean |
setExtendedParam(java.lang.String name,
java.lang.String value,
boolean popupErr)
Sets the specified param.
|
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(IBooleanScalar scalar)
Sets the model for this viewer.
|
void |
setModel(INumberScalar scalar)
Sets the model for this viewer.
|
void |
setModel(IStringScalar scalar)
Sets the model for this viewer.
|
void |
setQualityInTooltip(boolean b)
setQualityInTooltip display or not the attribute quality factor inside the tooltip |
void |
setUnitVisible(boolean b)
Displays or hides the unit.
|
void |
setUserFormat(ATKFormat format)
Sets the ATK user format of this viewer.
|
void |
setUserFormat(java.lang.String format)
Overrides the format property of the attribute.
|
void |
stateChange(AttributeStateEvent evt) |
void |
stringScalarChange(StringScalarEvent evt) |
addTextListener, getHorizontalOffset, getMargin, getMinimumSize, getPreferredSize, getScrollingMode, getSizingBehavior, getSleepTime, getText, getVerticalOffset, getWaitTime, paint, removeTextListener, setAutoScroll, setHorizontalAlignment, setHorizontalOffset, setMargin, setScrollingMode, setSizingBehavior, setSleepTime, setText, setValueOffsets, setVerticalOffset, setWaitTime
actionPropertyChanged, 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
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public SimpleScalarViewer()
public java.awt.Color getBackgroundColor()
public void setBackgroundColor(java.awt.Color bg)
bg
- Background color.setAlarmEnabled(boolean)
public void initForEditing()
JDrawable
initForEditing
in interface JDrawable
public javax.swing.JComponent getComponent()
JDrawable
getComponent
in interface JDrawable
public java.lang.String getDescription(java.lang.String name)
JDrawable
getDescription
in interface JDrawable
name
- Extension namepublic java.lang.String[] getExtensionList()
JDrawable
getExtensionList
in interface JDrawable
public boolean setExtendedParam(java.lang.String name, java.lang.String value, boolean popupErr)
JDrawable
setExtendedParam
in interface JDrawable
name
- Parameter name (Case unsensitive).value
- Parameter value.popupErr
- true when the JDrawable should display a popup if
the parameter value is incorrect, false otherwise. Note that the JDrawable
must not display an error message if the parameter does not exists even
if popupAllowed is true.public java.lang.String getExtendedParam(java.lang.String name)
JDrawable
getExtendedParam
in interface JDrawable
name
- Param name (Case unsensitive).public void stringScalarChange(StringScalarEvent evt)
stringScalarChange
in interface IStringScalarListener
public void numberScalarChange(NumberScalarEvent evt)
numberScalarChange
in interface INumberScalarListener
public void booleanScalarChange(BooleanScalarEvent evt)
booleanScalarChange
in interface IBooleanScalarListener
public void setUserFormat(java.lang.String format)
format
- C like Format (ex: %5.2f) , null or "" to disable.public void setUserFormat(ATKFormat format)
Ex of use: time_format = new ATKFormat() { public String format(Number n) { int d = n.intValue() / 60; Object[] o = {new Integer(d / 60), new Integer(d % 60)}; return Format.sprintf("%02dh %02dmn", o); } }; myViewer.setUserFormat(time_format);
format
- ATKFormat object or null to disable.public java.lang.String getUserFormat()
setUserFormat(java.lang.String)
public void setUnitVisible(boolean b)
b
- true to display the unit, false otherwisepublic boolean getUnitVisible()
public void setAlarmEnabled(boolean b)
b
- True to enable alarm.setBackgroundColor(java.awt.Color)
public boolean isAlarmEnabled()
public void stateChange(AttributeStateEvent evt)
stateChange
in interface IAttributeStateListener
public void errorChange(ErrorEvent evt)
errorChange
in interface IErrorListener
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
public void setModel(INumberScalar scalar)
scalar
- scalar modelpublic void setModel(IStringScalar scalar)
scalar
- modelpublic void setModel(IBooleanScalar scalar)
scalar
- modelpublic void clearModel()
public void setInvalidText(java.lang.String s)
s
- Text to be displayed.public java.lang.String getInvalidText()
setInvalidText(java.lang.String)
public INumberScalar getNumberModel()
public IStringScalar getStringModel()
public IBooleanScalar getBooleanModel()
public boolean getHasToolTip()
getHasToolTip
returns true if the viewer has a tooltip (attribute full name)boolean
valuepublic void setHasToolTip(boolean b)
setHasToolTip
display or not a tooltip for this viewerb
- If True the attribute full name will be displayed as tooltip for the viewerpublic boolean getQualityInTooltip()
getQualityInTooltip
returns true if the attribute quality factor is displayed inside the viewer's tooltipboolean
valuepublic void setQualityInTooltip(boolean b)
setQualityInTooltip
display or not the attribute quality factor inside the tooltipb
- If True the attribute quality factor will be displayed inside the tooltip.public static void main(java.lang.String[] args) throws java.lang.Exception
args
- Not usedjava.lang.Exception