Package jmri.jmrit.display
Class SensorIcon
- All Implemented Interfaces:
ImageObserver,MenuContainer,PropertyChangeListener,Serializable,Cloneable,EventListener,Accessible,SwingConstants,Positionable,InlineLogixNG
An icon to display a status of a Sensor.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class jmri.jmrit.display.PositionableLabel
PositionableLabel.PaletteFrameCloserNested classes/interfaces inherited from class javax.swing.JLabel
JLabel.AccessibleJLabelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyNested classes/interfaces inherited from interface jmri.jmrit.display.Positionable
Positionable.DuplicateIdException -
Field Summary
FieldsModifier and TypeFieldDescription(package private) TableItemPanel<Sensor>static final intstatic final int(package private) Color(package private) Color(package private) Color(package private) Colorstatic final intstatic final intstatic final intstatic final int(package private) boolean(package private) JCheckBoxMenuItem(package private) String(package private) Color(package private) Color(package private) Color(package private) Colorstatic final intstatic final intFields inherited from class jmri.jmrit.display.PositionableIcon
_iconFamily, _iconMap, _rotate, _scaleFields inherited from class jmri.jmrit.display.PositionableLabel
_control, _controlling, _displayLevel, _editable, _editor, _emptyHidden, _hidden, _icon, _iconEditor, _iconEditorFrame, _iconItemPanel, _namedIcon, _paletteFrame, _popupUtil, _positionable, _rotateText, _showTooltip, _text, _tooltip, _unRotatedText, _valueEditDisabled, _viewCoordinates, active, disableItemFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields 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 -
Constructor Summary
ConstructorsConstructorDescriptionSensorIcon(String s, Editor editor) SensorIcon(NamedIcon s, Editor editor) SensorIcon(Editor editor) -
Method Summary
Modifier and TypeMethodDescriptionboolean(package private) voidcloneMap(HashMap<Integer, NamedIcon> map, SensorIcon pos) Make a deep copy of Positional object.voiddisplayState(int state) Drive the current state of the display from the state of the sensor.voiddispose()Clean up when this object is no longer needed.voidvoidvoidprotected voidedit()protected voideditItem()protected PositionablefinishClone(SensorIcon pos) voidflashSensor(int tps, int state1, int state2) getIcon(int state) Get icon by its localized bean state name.booleanProvide a generic method to return the bean associated with the Positionable.Get the name of the positional as a String.Get the type of the positional as a String.(package private) voidvoid(package private) intGet current state of attached sensorvoidsensorTextEdit(String name) voidvoidsetBackgroundActive(Color color) voidsetBackgroundInActive(Color color) voidsetBackgroundInconsistent(Color color) voidsetBackgroundUnknown(Color color) booleansetEditIconMenu(JPopupMenu popup) Add additional menu items to the menu.booleansetEditItemMenu(JPopupMenu popup) Add additional menu items to the menu.voidvoidPlace icon by its bean state name key found in the properties file jmri.NamedBeanBundle.properties by its localized bean state name.voidvoidvoidsetMomentary(boolean m) voidvoidAttached a named sensor to this display itemvoidAttached a named sensor to this display itemvoidvoidsetTextActive(Color color) booleansetTextEditMenu(JPopupMenu popup) Add additional menu items to the menu.voidsetTextInActive(Color color) voidsetTextInconsistent(Color color) voidsetTextUnknown(Color color) voidbooleanshowPopUp(JPopupMenu popup) Pop-up just displays the sensor name.(package private) JMenuvoid(package private) void(package private) voidMethods inherited from class jmri.jmrit.display.PositionableIcon
cloneMap, finishClone, getIconMap, getIconStateNames, getScale, maxHeight, maxWidth, rotate, rotateOrthogonal, setScaleMethods inherited from class jmri.jmrit.display.PositionableLabel
addClass, cloneIcon, doMouseDragged, doMouseEntered, doMouseExited, doMouseMoved, doViemMenu, editIcon, editIconItem, editTextItem, finishClone, finishItemUpdate, getClasses, getDegrees, getDisplayLevel, getEditor, getHeight, getId, getLogixNG, getPopupUtility, getSize, getTextComponent, getToolTip, getUnRotatedText, getViewCoordinates, getWidth, initPaletteFrame, isActive, isBackground, isControl, isControlling, isEditable, isEmptyHidden, isHidden, isIcon, isPositionable, isRotated, isText, isValueEditDisabled, makeIconEditorFrame, makePaletteFrame, makeTextOverlaidIcon, maxHeightTrue, maxWidthTrue, paintComponent, remove, removeAllClasses, removeClass, setControlling, setDegrees, setDisableControlMenu, setDisplayLevel, setEditable, setEditor, setEditTextItemMenu, setEmptyHidden, setHidden, setIcon, setId, setLevel, setLogixNG, setLogixNG_SystemName, setPopupUtility, setPositionable, setRotateMenu, setRotateOrthogonalMenu, setScaleMenu, setShowToolTip, setSuperText, setToolTip, setUnRotatedText, setupLogixNG, setValueEditDisabled, setViewCoordinates, showEmptyHidden, showHidden, showToolTip, storeItem, updateIcon, updateSize, updateTextItemMethods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setUI, setVerticalAlignment, setVerticalTextPosition, updateUIMethods inherited from class javax.swing.JComponent
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, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods 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, transferFocusDownCycle, validate, validateTreeMethods 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, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.jmrit.display.Positionable
contains, getBackground, getBounds, getEditorName, getFont, getForeground, getLocation, getParent, getPreferredSize, getTypeName, getX, getY, invalidate, isOpaque, repaint, requestFocusInWindow, setBackground, setBorder, setForeground, setLocation, setLocation, setOpaque, setSize, setVisible
-
Field Details
-
UNKOWN_FONT_COLOR
- See Also:
-
UNKOWN_BACKGROUND_COLOR
- See Also:
-
ACTIVE_FONT_COLOR
- See Also:
-
ACTIVE_BACKGROUND_COLOR
- See Also:
-
INACTIVE_FONT_COLOR
- See Also:
-
INACTIVE_BACKGROUND_COLOR
- See Also:
-
INCONSISTENT_FONT_COLOR
- See Also:
-
INCONSISTENT_BACKGROUND_COLOR
- See Also:
-
_name2stateMap
-
_state2nameMap
-
momentaryItem
-
_itemPanel
-
originalText
-
momentary
boolean momentary -
textColorActive
-
textColorInActive
-
textColorUnknown
-
textColorInconsistent
-
backgroundColorActive
-
backgroundColorInActive
-
backgroundColorUnknown
-
backgroundColorInconsistent
-
-
Constructor Details
-
SensorIcon
-
SensorIcon
-
SensorIcon
-
-
Method Details
-
deepClone
Description copied from interface:PositionableMake a deep copy of Positional object. Implementation should create a new object and immediately pass the object to finishClone() returning the result of finishClone(). i.e. implementation must be:public Positionable deepClone() { Subtype t = new Subtype(); return finishClone(t); }Then finishClone() finishes the deep Copy of a Positional object. Implementation should make deep copies of the additional members of this sub class and then pass Positionable p to super.finishClone(). i.e. implementation must terminate with statement return super.finishClone(p); See IndicatorTurnoutIcon extends TurnoutIcon extends PositionableLabel for an example of how to continue deep cloning a chain of subclasses.
- Specified by:
deepClonein interfacePositionable- Overrides:
deepClonein classPositionableIcon- Returns:
- the copy
-
finishClone
-
setSensor
Attached a named sensor to this display item- Parameters:
pName- System/user name to lookup the sensor object
-
setSensor
Attached a named sensor to this display item- Parameters:
s- the Sensor
-
getSensor
-
getNamedBean
Description copied from class:PositionableLabelProvide a generic method to return the bean associated with the Positionable.- Specified by:
getNamedBeanin interfacePositionable- Overrides:
getNamedBeanin classPositionableLabel
-
getNamedSensor
-
makeIconMap
void makeIconMap() -
getStateNameCollection
- Overrides:
getStateNameCollectionin classPositionableIcon
-
setIcon
Place icon by its bean state name key found in the properties file jmri.NamedBeanBundle.properties by its localized bean state name.- Parameters:
name- the icon state nameicon- the icon to place
-
getIcon
Get icon by its localized bean state name.- Overrides:
getIconin classPositionableIcon- Parameters:
state- the state to get the icon for- Returns:
- the icon or null if state not found
-
getIcon
-
getFamily
- Overrides:
getFamilyin classPositionableIcon
-
setFamily
- Overrides:
setFamilyin classPositionableIcon
-
sensorState
int sensorState()Get current state of attached sensor- Returns:
- A state variable from a Sensor, e.g. Sensor.ACTIVE
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
getTypeString
Description copied from interface:PositionableGet the type of the positional as a String.- Specified by:
getTypeStringin interfacePositionable- Overrides:
getTypeStringin classPositionableLabel- Returns:
- the type to display
-
getNameString
Description copied from interface:PositionableGet the name of the positional as a String. This is often the display name of the NamedBean being positioned.- Specified by:
getNameStringin interfaceInlineLogixNG- Specified by:
getNameStringin interfacePositionable- Overrides:
getNameStringin classPositionableLabel- Returns:
- the name to display
-
showPopUp
Pop-up just displays the sensor name.- Specified by:
showPopUpin interfacePositionable- Overrides:
showPopUpin classPositionableLabel- Parameters:
popup- the menu to display- Returns:
- always true
-
setTextEditMenu
Description copied from interface:PositionableAdd additional menu items to the menu.- Specified by:
setTextEditMenuin interfacePositionable- Overrides:
setTextEditMenuin classPositionableLabel- Parameters:
popup- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
sensorTextEdit
-
displayState
Drive the current state of the display from the state of the sensor.- Overrides:
displayStatein classPositionableIcon- Parameters:
state- the sensor state
-
setEditItemMenu
Description copied from interface:PositionableAdd additional menu items to the menu.- Specified by:
setEditItemMenuin interfacePositionable- Overrides:
setEditItemMenuin classPositionableLabel- Parameters:
popup- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
editItem
-
updateItem
void updateItem() -
setEditIconMenu
Description copied from interface:PositionableAdd additional menu items to the menu.- Specified by:
setEditIconMenuin interfacePositionable- Overrides:
setEditIconMenuin classPositionableLabel- Parameters:
popup- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
edit
- Overrides:
editin classPositionableLabel
-
updateSensor
void updateSensor() -
setOriginalText
-
getOriginalText
-
setText
- Overrides:
setTextin classPositionableLabel
-
getMomentary
-
setMomentary
-
buttonLive
-
doMousePressed
- Specified by:
doMousePressedin interfacePositionable- Overrides:
doMousePressedin classPositionableLabel
-
doMouseReleased
- Specified by:
doMouseReleasedin interfacePositionable- Overrides:
doMouseReleasedin classPositionableLabel
-
doMouseClicked
- Specified by:
doMouseClickedin interfacePositionable- Overrides:
doMouseClickedin classPositionableLabel
-
dispose
Description copied from class:PositionableLabelClean up when this object is no longer needed. Should not be called while the object is still displayed; see remove()- Overrides:
disposein classPositionableLabel
-
cloneMap
-
setTextActive
-
getTextActive
-
setTextInActive
-
getTextInActive
-
setTextUnknown
-
getTextUnknown
-
setTextInconsistent
-
getTextInconsistent
-
setBackgroundActive
-
getBackgroundActive
-
setBackgroundInActive
-
getBackgroundInActive
-
setBackgroundUnknown
-
getBackgroundUnknown
-
setBackgroundInconsistent
-
getBackgroundInconsistent
-
getActiveText
-
setActiveText
-
getInactiveText
-
setInactiveText
-
getInconsistentText
-
setInconsistentText
-
getUnknownText
-
setUnknownText
-
stateMenu
-
changeLayoutSensorType
void changeLayoutSensorType() -
flashSensor
-
stopFlash
-