Package jmri.jmrit.display
Class SlipTurnoutIcon
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
jmri.jmrit.display.PositionableLabel
jmri.jmrit.display.SlipTurnoutIcon
- All Implemented Interfaces:
ImageObserver,MenuContainer,PropertyChangeListener,Serializable,Cloneable,EventListener,Accessible,SwingConstants,Positionable,InlineLogixNG
An icon to display a status of a Slip, either Single or Double.
This responds to only KnownState, leaving CommandedState to some other graphic representation later.
A click on the icon will command a state change. Specifically, it will set the CommandedState to the opposite (THROWN vs CLOSED) of the current KnownState.
Note: lower west to lower east icon is used for storing the slip icon, in a single slip, even if the slip is set for upper west to upper east.
With a 3-Way point we use the following translations
- lower west to upper east - to upper exit
- upper west to lower east - to middle exit
- lower west to lower east - to lower exit
- west Turnout - First Turnout
- east Turnout - Second Turnout
- singleSlipRoute - translates to which exit the first turnout goes to
- true if upper, or false if lower
Based upon the TurnoutIcon by Bob Jacobsen
- See Also:
-
Nested Class Summary
Nested 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) SlipIconAdder(package private) booleanstatic final intConstant used to refer to a Double Slip Configuration.static final intConstant used to refer to the Turnout address configured to operate the east (or second for a three way) of the Turnout.(package private) NamedIcon(package private) Stringstatic final intConstant used for a scissor crossing using 4 turnout address, and refers to the turnout located at the lower east.static final intConstant used for a scissor crossing using 4 turnout address, and refers to the turnout located at the lower west.(package private) NamedIcon(package private) String(package private) String(package private) NamedIcon(package private) String(package private) Stringstatic final intConstant used to refer to a Scissor (Double Crossover) Configuration.static final intConstant used to refer to a Single Slip Configuration.static final intConstant used to refer to a Three Way Turnout Configuration.(package private) JCheckBoxMenuItem(package private) NamedIcon(package private) String(package private) NamedIcon(package private) String(package private) String(package private) NamedIcon(package private) String(package private) Stringstatic final intConstant used to refer to the Turnout address configured to operate the west (or first for a three way) of the Turnout.Fields inherited from class jmri.jmrit.display.PositionableLabel
_control, _controlling, _displayLevel, _editable, _editor, _emptyHidden, _hidden, _icon, _iconEditorFrame, _iconItemPanel, _itemPanel, _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, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddTristateEntry(JPopupMenu popup) voiddispose()Clean up when this object is no longer needed.voidThrow the turnout when the icon is clicked.protected voidedit()Get the text used in the pop-up for setting the route from Lower West to Lower East.Get the text used in the pop-up for setting the route from Lower West to Upper East.getNamedTurnout(int turn) Returns the turnout located at the position specified.Get the name of the positional as a String.booleanSingle Slip Route, determines if the slip route is from upper west to upper east (true) or lower west to lower east (false) This also doubles up for the three way and determines if the first turnout routes to the upper (true) or lower (false) exit point.booleangetTurnout(int turn) Returns the turnout located at the position specified.intGet the type of the positional as a String.Get the text used in the pop-up for setting the route from Upper West to Lower East.Get the text used in the pop-up for setting the route from Upper West to Upper East.protected booleanCheck if Slip is busy.intintmaxWidth()voidUpdate icon as state of turnout changes.protected voidreset()voidrotate(int deg) protected void****** popup AbstractAction.actionPerformed method overrides ********voidvoidvoidvoidsetLWLEText(String txt) voidsetLWUEText(String txt) voidsetScale(double s) voidsetSingleSlipRoute(boolean route) protected voidSet Slip busy when commands are being issued to Slip turnouts.protected voidSet Slip not busy when all commands have been issued to Slip turnouts.booleansetTextEditMenu(JPopupMenu popup) Add additional menu items to the menu.voidsetTristate(boolean set) voidsetTurnout(String pName, int turn) Attach a named turnout to this display item.voidsetTurnout(NamedBeanHandle<Turnout> to, int turn) Attach a namedBean Handle turnout to this display item.voidsetTurnoutType(int slip) Sets the type of turnout configuration which is being usedvoidvoidvoidvoidsetUWLEText(String txt) voidsetUWUEText(String txt) booleanshowPopUp(JPopupMenu popup) Display a popup menu to select a given state, rather than cycling through each state.voidslipTurnoutTextEdit(String name) (package private) voidMethods inherited from class jmri.jmrit.display.PositionableLabel
addClass, cloneIcon, deepClone, doMouseDragged, doMouseEntered, doMouseExited, doMouseMoved, doMousePressed, doMouseReleased, doViemMenu, editIcon, editIconItem, editTextItem, finishClone, finishItemUpdate, getClasses, getDegrees, getDisplayLevel, getEditor, getHeight, getId, getLogixNG, getNamedBean, getPopupUtility, getScale, 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, setEditIconMenu, setEditItemMenu, setEditor, setEditTextItemMenu, setEmptyHidden, setHidden, setIcon, setId, setLevel, setLogixNG, setLogixNG_SystemName, setPopupUtility, setPositionable, setRotateMenu, setRotateOrthogonalMenu, setScaleMenu, setShowToolTip, setSuperText, setText, 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
-
WEST
Constant used to refer to the Turnout address configured to operate the west (or first for a three way) of the Turnout.- See Also:
-
EAST
Constant used to refer to the Turnout address configured to operate the east (or second for a three way) of the Turnout.- See Also:
-
LOWERWEST
Constant used for a scissor crossing using 4 turnout address, and refers to the turnout located at the lower west.- See Also:
-
LOWEREAST
Constant used for a scissor crossing using 4 turnout address, and refers to the turnout located at the lower east.- See Also:
-
DOUBLESLIP
Constant used to refer to a Double Slip Configuration.- See Also:
-
SINGLESLIP
Constant used to refer to a Single Slip Configuration.- See Also:
-
THREEWAY
Constant used to refer to a Three Way Turnout Configuration.- See Also:
-
SCISSOR
Constant used to refer to a Scissor (Double Crossover) Configuration.- See Also:
-
lowerWestToUpperEastLName
-
lowerWestToUpperEast
-
upperWestToLowerEastLName
-
upperWestToLowerEast
-
lowerWestToLowerEastLName
-
lowerWestToLowerEast
-
upperWestToUpperEastLName
-
upperWestToUpperEast
-
inconsistentLName
-
inconsistent
-
unknownLName
-
unknown
-
tristateItem
-
lowerWestToUpperEastText
-
upperWestToLowerEastText
-
lowerWestToLowerEastText
-
upperWestToUpperEastText
-
_iconEditor
-
busy
boolean busy
-
-
Constructor Details
-
SlipTurnoutIcon
-
-
Method Details
-
setTurnout
Attach a named turnout to this display item.- Parameters:
pName- Used as a system/user name to lookup the turnout objectturn- is used to determine which turnout position this is for. 0x01 - West 0x02 - East 0x04 - Lower West 0x06 - Upper East
-
setTurnout
Attach a namedBean Handle turnout to this display item.- Parameters:
to- Used as the NamedBeanHandle to lookup the turnout objectturn- is used to determine which turnout position this is for.- 0x01 - West
- 0x02 - East
- 0x04 - Lower West
- 0x06 - Upper East
-
setTurnoutType
Sets the type of turnout configuration which is being used- Parameters:
slip- valid values are- 0x00 - Double Slip
- 0x02 - Single Slip
- 0x04 - Three Way Turnout
- 0x08 - Scissor Crossing
-
getTurnoutType
-
getSingleSlipRoute
Single Slip Route, determines if the slip route is from upper west to upper east (true) or lower west to lower east (false) This also doubles up for the three way and determines if the first turnout routes to the upper (true) or lower (false) exit point.In a Scissor crossing this returns true if only two turnout address are required to set the crossing or false if four turnout address are required.
- Returns:
- true if route is through the turnout on a slip; false otherwise
-
setSingleSlipRoute
-
getTurnout
Returns the turnout located at the position specified. -
getNamedTurnout
Returns the turnout located at the position specified. -
getLowerWestToUpperEastIcon
-
setLowerWestToUpperEastIcon
-
getUpperWestToLowerEastIcon
-
setUpperWestToLowerEastIcon
-
getLowerWestToLowerEastIcon
-
setLowerWestToLowerEastIcon
-
getUpperWestToUpperEastIcon
-
setUpperWestToUpperEastIcon
-
getInconsistentIcon
-
setInconsistentIcon
-
getUnknownIcon
-
setUnknownIcon
-
maxHeight
- Specified by:
maxHeightin interfacePositionable- Overrides:
maxHeightin classPositionableLabel
-
maxWidth
- Specified by:
maxWidthin interfacePositionable- Overrides:
maxWidthin classPositionableLabel
-
propertyChange
Update icon as state of turnout changes.- 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
-
setTristate
-
getTristate
-
addTristateEntry
-
rotateOrthogonal
****** popup AbstractAction.actionPerformed method overrides ********- Overrides:
rotateOrthogonalin classPositionableLabel
-
setScale
- Specified by:
setScalein interfacePositionable- Overrides:
setScalein classPositionableLabel
-
rotate
- Specified by:
rotatein interfacePositionable- Overrides:
rotatein classPositionableLabel
-
getLWUEText
Get the text used in the pop-up for setting the route from Lower West to Upper East. For a scissor crossing this is the Left-hand crossing. For a 3 Way turnout this is the Upper Exit.- Returns:
- localized description of route
-
getUWLEText
Get the text used in the pop-up for setting the route from Upper West to Lower East. For a scissor crossing this is the Right-hand crossing. For a 3 Way turnout this is the Middle Exit.- Returns:
- localized description of route
-
getLWLEText
Get the text used in the pop-up for setting the route from Lower West to Lower East. For a scissor crossing this is the Straight (Normal) Route. For a 3 Way turnout this is the Lower Exit.- Returns:
- localized description of route
-
getUWUEText
Get the text used in the pop-up for setting the route from Upper West to Upper East. For a scissor crossing this is not used. For a 3 Way turnout this is not used.- Returns:
- localized description of route
-
setLWUEText
-
setUWLEText
-
setLWLEText
-
setUWUEText
-
edit
- Overrides:
editin classPositionableLabel
-
updateTurnout
void updateTurnout() -
doMouseClicked
Throw the turnout when the icon is clicked.- Specified by:
doMouseClickedin interfacePositionable- Overrides:
doMouseClickedin classPositionableLabel- Parameters:
e- the click event
-
getTurnoutSettings
-
reset
-
showPopUp
Display a popup menu to select a given state, rather than cycling through each state.- Specified by:
showPopUpin interfacePositionable- Overrides:
showPopUpin classPositionableLabel- Parameters:
popup- the menu to add the state menu to- Returns:
- true if anything added to menu
-
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
-
slipTurnoutTextEdit
-
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
-
setSlipBusy
Set Slip busy when commands are being issued to Slip turnouts. -
setSlipNotBusy
Set Slip not busy when all commands have been issued to Slip turnouts. -
isSlipBusy
Check if Slip is busy.- Returns:
- true if commands are being issued to Slip turnouts.
-