public class StateViewer extends javax.swing.JPanel implements IStateListener
State
State is a viewer to surveil the state of a
Device
. Normally one connects the
device with the viewer like this:
Device device = getDevice(); // some method to obtain the device.
State = new State();
state.setModel(device);
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
StateViewer() |
Modifier and Type | Method and Description |
---|---|
void |
clearModel()
clearModel clear the model of this viewer. |
void |
errorChange(ErrorEvent evt) |
IDeviceApplication |
getApplication() |
java.lang.String |
getLabel() |
IDevice |
getModel()
getModel gets the model of this stateviewer. |
IDevicePopUp |
getPopUp()
Get the value of popUp.
|
java.lang.String |
getState()
getState |
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 |
javax.swing.JLabel |
getTextLabel() |
javax.swing.JLabel |
getValueLabel() |
boolean |
isLabelVisible()
isLabelVisible returns the visibility of the label |
boolean |
isStateClickable()
isStateClickable returns if the state is clickable or not. |
boolean |
isStateVisible()
isStateVisible returns the visibility of the
state |
void |
setApplication(IDeviceApplication runnable) |
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(IDevice devModel)
setModel sets the model of this viewer. |
void |
setPopUp(IDevicePopUp v)
Set the value of popUp.
|
void |
setStateBorder(javax.swing.border.Border border) |
void |
setStateClickable(boolean clickable)
setStateClickable will the state be clickable? |
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 visible or not. |
void |
stateChange(StateEvent evt)
stateChange inherited from IStateListener |
protected void |
valueLabelMouseClicked(java.awt.event.MouseEvent evt) |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, 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, 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, transferFocusBackward, transferFocusUpCycle
protected void valueLabelMouseClicked(java.awt.event.MouseEvent evt)
public IDevicePopUp getPopUp()
public void setPopUp(IDevicePopUp v)
v
- Value to assign to popUp.public void setModel(IDevice devModel)
setModel
sets the model of this viewer.
If the textLabel property is not set, the name of the device is
shown on the textLabel.device
- a Device
to surveilpublic void clearModel()
clearModel
clear the model of this viewer.public javax.swing.JLabel getTextLabel()
public javax.swing.JLabel getValueLabel()
public IDevice getModel()
getModel
gets the model of this stateviewer.Device
valuepublic java.lang.String getState()
getState
String
value presenting the state of the devicepublic void setLabel(java.lang.String label)
setLabel
set the text of the label. The
default value is to show the name of the device.label
- a String
valuepublic java.lang.String getLabel()
public void setLabelVisible(boolean visible)
setLabelVisisble
makes the label visible or not.visible
- a boolean
valuepublic boolean isLabelVisible()
isLabelVisible
returns the visibility of the labelboolean
valuepublic void setStateVisible(boolean visible)
setStateVisible
makes the state visible or not.visible
- a boolean
valuepublic boolean isStateVisible()
isStateVisible
returns the visibility of the
stateboolean
valuepublic void stateChange(StateEvent evt)
stateChange
inherited from IStateListenerstateChange
in interface IStateListener
evt
- a StateEvent
valuepublic void errorChange(ErrorEvent evt)
errorChange
in interface IErrorListener
public void setStateText(java.lang.String text)
setStateText
sets the text on the colored state boxtext
- a String
valuepublic java.lang.String getStateText()
getStateText
gets the text that is on the
colored state boxString
valuepublic void setStateFont(java.awt.Font font)
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
public java.awt.Font getStateFont()
public void setStateForeground(java.awt.Color color)
public java.awt.Color getStateForeground()
public void setForeground(java.awt.Color color)
setForeground
in class javax.swing.JComponent
public void setStateHorizontalAlignment(int i)
setStateHorizontalAlignement
i
- an int
valueSwingConstants
public int getStateHorizontalAlignment()
public void setStatePreferredSize(java.awt.Dimension dimension)
public java.awt.Dimension getStatePreferredSize()
public void setStateBorder(javax.swing.border.Border border)
public javax.swing.border.Border getStateBorder()
public boolean getStateInTooltip()
getStateInTooltip
returns true if the device state is displayed inside the viewer's tooltipboolean
valuepublic void setStateInTooltip(boolean b)
setStateInTooltip
display or not the device state inside the tooltipb
- If True the device state will be displayed inside the tooltip.public void setStateClickable(boolean clickable)
setStateClickable
will the state be clickable?clickable
- a boolean
valuepublic boolean isStateClickable()
isStateClickable
returns if the state is clickable or not.boolean
valuepublic void setApplication(IDeviceApplication runnable)
public IDeviceApplication getApplication()