Class WarrantRoute

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, BeanInterface, ModifiedFlag, WindowInterface
    Direct Known Subclasses:
    NXFrame, WarrantFrame

    abstract class WarrantRoute
    extends JmriJFrame
    implements java.awt.event.ActionListener, java.beans.PropertyChangeListener
    Make panels for WarrantFrame and NXFrame windows that create and edit Warrants.

    Input panels for defining a train's route from an eNtry OBlock to an eXit OBlock. Routes are defined by choosing the originating block, the path on which the train start and the exit Portal through which it will leave the block. Also it is required that a Destination block is chosen and the path and Portal through which the train will arrive. The Portal selections establish the direction information. Optionally, additional blocks can be specified requiring the train to pass through or avoid entering.

    Input panels to describe the train. accesses the roster for some info.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  WarrantRoute.AddressTextField  
      (package private) static class  WarrantRoute.Display  
      (package private) static class  WarrantRoute.DisplayButton  
      (package private) static class  WarrantRoute.Location  
      protected class  WarrantRoute.RouteLocation  
      • Nested classes/interfaces inherited from class javax.swing.JFrame

        javax.swing.JFrame.AccessibleJFrame
      • Nested classes/interfaces inherited from class java.awt.Frame

        java.awt.Frame.AccessibleAWTFrame
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • 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
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected WarrantRoute()
      Only subclasses can create this
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)
      Does the action on each of the 4 RouteLocation panels
      protected void calculate()  
      protected javax.swing.JPanel calculatePanel​(boolean vertical)  
      protected java.lang.String checkLocoAddress()  
      protected void clearRoute()  
      protected void clearTempWarrant()  
      protected void closeProfileTable()  
      protected void debugRoute​(javax.swing.tree.DefaultTreeModel tree, BlockOrder origin, BlockOrder dest)
      Callback from RouteFinder - no routes found
      void dispose()
      When window is finally destroyed, remove it from the list of windows.
      (package private) void doAction​(java.lang.Object obj)  
      protected java.lang.String getAddress()  
      protected BlockOrder getAvoidBlockOrder()  
      protected java.util.List<BlockOrder> getOrders()  
      protected java.lang.String getTrainName()  
      protected BlockOrder getViaBlockOrder()  
      protected javax.swing.JPanel makeBlockPanels​(boolean add)  
      javax.swing.JPanel makePickListPanel()  
      protected javax.swing.JPanel makeRouteTablePanel()  
      protected static javax.swing.JPanel makeTextAndButtonPanel​(javax.swing.JComponent comp, javax.swing.JComponent button, javax.swing.JLabel label, java.lang.String tooltip)
      Make a horizontal panel for the input of data Puts label message to the Left, 2nd component (button) to the right
      protected static javax.swing.JPanel makeTextBoxPanel​(boolean vertical, javax.swing.JComponent comp, java.lang.String text, java.lang.String tooltip)
      Puts label message to the Left
      protected static javax.swing.JPanel makeTextBoxPanel​(javax.swing.JComponent comp, java.lang.String label, java.lang.String tooltip)
      Puts label message to the Right
      protected javax.swing.JPanel makeTrainIdPanel​(javax.swing.JPanel comp)
      Make panel containing TextFields for Train name and address and ComboBox for Roster entries. called from: WarrantFrame.makeBorderedTrainPanel() at init of WarrantFrame NXFrame.makeAutoRunPanel() at init of NXFrame
      protected abstract void maxThrottleEventAction()  
      protected void mouseClickedOnBlock​(OBlock block)  
      protected static java.lang.String pathIsValid​(OBlock block, java.lang.String pathName)  
      (package private) boolean pathsAreValid​(OBlock block)  
      protected void pickRoute​(java.util.List<javax.swing.tree.DefaultMutableTreeNode> destNodes, javax.swing.tree.DefaultTreeModel routeTree)
      Callback from RouteFinder - several routes found
      abstract void propertyChange​(java.beans.PropertyChangeEvent e)  
      protected java.lang.String routeIsValid()  
      protected javax.swing.JPanel searchDepthPanel​(boolean vertical)  
      protected abstract void selectedRoute​(java.util.ArrayList<BlockOrder> orders)  
      protected java.lang.String setAddress()
      Called to make final consistency check on loco address before running warrant
      protected void setSpeedUtil​(SpeedUtil sp)  
      protected java.lang.String setTrainInfo​(java.lang.String name)  
      protected void setTrainName​(java.lang.String name)  
      protected void showWarning​(java.lang.String msg)  
      protected void stopRouteFinder()  
      • Methods inherited from class javax.swing.JFrame

        addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Frame

        addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • Methods inherited from class java.awt.Window

        addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.awt.MenuContainer

        getFont, postEvent
    • Constructor Detail

      • WarrantRoute

        protected WarrantRoute()
        Only subclasses can create this
    • Method Detail

      • propertyChange

        public abstract void propertyChange​(java.beans.PropertyChangeEvent e)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • searchDepthPanel

        protected javax.swing.JPanel searchDepthPanel​(boolean vertical)
      • calculatePanel

        protected javax.swing.JPanel calculatePanel​(boolean vertical)
      • makeTrainIdPanel

        protected javax.swing.JPanel makeTrainIdPanel​(javax.swing.JPanel comp)
        Make panel containing TextFields for Train name and address and ComboBox for Roster entries. called from: WarrantFrame.makeBorderedTrainPanel() at init of WarrantFrame NXFrame.makeAutoRunPanel() at init of NXFrame
        Parameters:
        comp - optional panel to add
        Returns:
        panel
      • setTrainInfo

        protected java.lang.String setTrainInfo​(java.lang.String name)
      • setTrainName

        protected void setTrainName​(java.lang.String name)
      • setAddress

        protected java.lang.String setAddress()
        Called to make final consistency check on loco address before running warrant
        Returns:
        error message
      • getAddress

        protected java.lang.String getAddress()
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Does the action on each of the 4 RouteLocation panels
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        e - the action event
      • doAction

        void doAction​(java.lang.Object obj)
      • makeBlockPanels

        protected javax.swing.JPanel makeBlockPanels​(boolean add)
      • pickRoute

        protected void pickRoute​(@Nonnull
                                 java.util.List<javax.swing.tree.DefaultMutableTreeNode> destNodes,
                                 javax.swing.tree.DefaultTreeModel routeTree)
        Callback from RouteFinder - several routes found
        Parameters:
        destNodes - the destination blocks
        routeTree - the routes
      • showWarning

        protected void showWarning​(java.lang.String msg)
      • debugRoute

        protected void debugRoute​(javax.swing.tree.DefaultTreeModel tree,
                                  BlockOrder origin,
                                  BlockOrder dest)
        Callback from RouteFinder - no routes found
        Parameters:
        tree - routes
        origin - starting block
        dest - ending block
      • pathIsValid

        protected static java.lang.String pathIsValid​(OBlock block,
                                                      java.lang.String pathName)
      • dispose

        public void dispose()
        Description copied from class: JmriJFrame
        When window is finally destroyed, remove it from the list of windows.

        Subclasses that over-ride this method must invoke this implementation with super.dispose() right before returning.

        Specified by:
        dispose in interface WindowInterface
        Overrides:
        dispose in class JmriJFrame
      • makeTextBoxPanel

        protected static javax.swing.JPanel makeTextBoxPanel​(boolean vertical,
                                                             @Nonnull
                                                             javax.swing.JComponent comp,
                                                             java.lang.String text,
                                                             java.lang.String tooltip)
        Puts label message to the Left
        Parameters:
        vertical - Label orientation true = above, false = left
        comp - Component to put into JPanel
        text - Bundle keyword for label message
        tooltip - Bundle keyword for tooltip message
        Returns:
        Panel containing Component
      • makeTextAndButtonPanel

        protected static javax.swing.JPanel makeTextAndButtonPanel​(javax.swing.JComponent comp,
                                                                   javax.swing.JComponent button,
                                                                   javax.swing.JLabel label,
                                                                   java.lang.String tooltip)
        Make a horizontal panel for the input of data Puts label message to the Left, 2nd component (button) to the right
        Parameters:
        comp - Component for input of data
        button - 2nd Component for panel, usually a button
        label - Bundle keyword for label message
        tooltip - Bundle keyword for tooltip message
        Returns:
        Panel containing Components
      • makeTextBoxPanel

        protected static javax.swing.JPanel makeTextBoxPanel​(javax.swing.JComponent comp,
                                                             java.lang.String label,
                                                             java.lang.String tooltip)
        Puts label message to the Right
        Parameters:
        comp - Component to put into JPanel
        label - Bundle keyword for label message
        tooltip - Bundle keyword for tooltip message
        Returns:
        Panel containing Component