Class SlipTurnoutIcon

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.SwingConstants, Positionable, InlineLogixNG

    public class SlipTurnoutIcon
    extends PositionableLabel
    implements java.beans.PropertyChangeListener
    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:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  SlipTurnoutIcon.SetSlipThread  
      • Nested classes/interfaces inherited from class javax.swing.JLabel

        javax.swing.JLabel.AccessibleJLabel
      • 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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void addTristateEntry​(javax.swing.JPopupMenu popup)  
      (package private) void displayState​(int state)
      Drive the current state of the display from the state of the turnout.
      void dispose()
      Clean up when this object is no longer needed.
      void doMouseClicked​(JmriMouseEvent e)
      Throw the turnout when the icon is clicked.
      protected void edit()  
      NamedIcon getInconsistentIcon()  
      NamedIcon getLowerWestToLowerEastIcon()  
      NamedIcon getLowerWestToUpperEastIcon()  
      java.lang.String getLWLEText()
      Get the text used in the pop-up for setting the route from Lower West to Lower East.
      java.lang.String getLWUEText()
      Get the text used in the pop-up for setting the route from Lower West to Upper East.
      NamedBeanHandle<Turnout> getNamedTurnout​(int turn)
      Returns the turnout located at the position specified.
      java.lang.String getNameString()
      Get the name of the positional as a String.
      boolean 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.
      boolean getTristate()  
      Turnout getTurnout​(int turn)
      Returns the turnout located at the position specified.
      protected java.util.HashMap<Turnout,​java.lang.Integer> getTurnoutSettings()  
      int getTurnoutType()  
      NamedIcon getUnknownIcon()  
      NamedIcon getUpperWestToLowerEastIcon()  
      NamedIcon getUpperWestToUpperEastIcon()  
      java.lang.String getUWLEText()
      Get the text used in the pop-up for setting the route from Upper West to Lower East.
      java.lang.String getUWUEText()
      Get the text used in the pop-up for setting the route from Upper West to Upper East.
      protected boolean isSlipBusy()
      Check if Slip is busy.
      int maxHeight()  
      int maxWidth()  
      void propertyChange​(java.beans.PropertyChangeEvent e)
      Update icon as state of turnout changes.
      protected void reset()  
      void rotate​(int deg)  
      protected void rotateOrthogonal()
      ****** popup AbstractAction.actionPerformed method overrides ********
      void setInconsistentIcon​(NamedIcon i)  
      void setLowerWestToLowerEastIcon​(NamedIcon i)  
      void setLowerWestToUpperEastIcon​(NamedIcon i)  
      void setLWLEText​(java.lang.String txt)  
      void setLWUEText​(java.lang.String txt)  
      void setScale​(double s)  
      void setSingleSlipRoute​(boolean route)  
      protected void setSlipBusy()
      Set Slip busy when commands are being issued to Slip turnouts.
      protected void setSlipNotBusy()
      Set Slip not busy when all commands have been issued to Slip turnouts.
      boolean setTextEditMenu​(javax.swing.JPopupMenu popup)
      Add additional menu items to the menu.
      void setTristate​(boolean set)  
      void setTurnout​(java.lang.String pName, int turn)
      Attach a named turnout to this display item.
      void setTurnout​(NamedBeanHandle<Turnout> to, int turn)
      Attach a namedBean Handle turnout to this display item.
      void setTurnoutType​(int slip)
      Sets the type of turnout configuration which is being used
      void setUnknownIcon​(NamedIcon i)  
      void setUpperWestToLowerEastIcon​(NamedIcon i)  
      void setUpperWestToUpperEastIcon​(NamedIcon i)  
      void setUWLEText​(java.lang.String txt)  
      void setUWUEText​(java.lang.String txt)  
      boolean showPopUp​(javax.swing.JPopupMenu popup)
      Display a popup menu to select a given state, rather than cycling through each state.
      void slipTurnoutTextEdit​(java.lang.String name)  
      (package private) int turnoutState()
      Get current state of attached turnouts.
      (package private) void updateTurnout()  
      • Methods 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, updateUI
      • 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, 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, 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, transferFocusDownCycle, validate, validateTree
      • Methods 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, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait