Package jmri.jmrit.logix
Class WarrantRoute
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- jmri.util.JmriJFrame
-
- jmri.jmrit.logix.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 jmri.util.JmriJFrame
JmriJFrame.ScreenDimensions
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
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
-
Nested classes/interfaces inherited from interface jmri.util.swing.WindowInterface
WindowInterface.Hint
-
-
Field Summary
Fields Modifier and Type Field Description protected WarrantRoute.RouteLocation
_avoid
protected WarrantRoute.RouteLocation
_destination
protected WarrantRoute.Display
_displayPref
protected WarrantRoute.RouteLocation
_focusedField
protected java.util.ArrayList<BlockOrder>
_orders
protected WarrantRoute.RouteLocation
_origin
protected float
_scale
protected SpeedUtil
_speedUtil
protected WarrantRoute.Display
_units
protected WarrantRoute.RouteLocation
_via
(package private) static java.lang.String
PAD
(package private) static int
STRUT_SIZE
-
Fields inherited from class jmri.util.JmriJFrame
allowInFrameServlet, properties, reuseFrameSavedPosition, reuseFrameSavedSized, windowInterface
-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
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 panelsprotected 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 foundvoid
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 rightprotected static javax.swing.JPanel
makeTextBoxPanel(boolean vertical, javax.swing.JComponent comp, java.lang.String text, java.lang.String tooltip)
Puts label message to the Leftprotected static javax.swing.JPanel
makeTextBoxPanel(javax.swing.JComponent comp, java.lang.String label, java.lang.String tooltip)
Puts label message to the Rightprotected 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 NXFrameprotected 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 foundabstract 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 warrantprotected 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 jmri.util.JmriJFrame
addHelpMenu, componentHidden, componentMoved, componentResized, componentShown, generateWindowRef, getAllowInFrameServlet, getEscapeKeyAction, getEscapeKeyClosesWindow, getFrame, getFrame, getFrameList, getFrameList, getIndexedProperty, getMaximumSize, getModifiedFlag, getPreferredSize, getProperty, getPropertyNames, getSavePosition, getSaveSize, getScreenDimensions, getWindowFrameRef, getWindowInterface, handleModified, hasIndexedProperty, hasProperty, initComponents, makePrivateWindow, markWindowModified, multipleInstances, pack, setAllowInFrameServlet, setEscapeKeyAction, setEscapeKeyClosesWindow, setFrameLocation, setIndexedProperty, setModifiedFlag, setProperty, setSavePosition, setSaveSize, setShutDownTask, setWindowInterface, show, show, storeValues, undecorate, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
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
-
-
-
-
Field Detail
-
_origin
protected WarrantRoute.RouteLocation _origin
-
_destination
protected WarrantRoute.RouteLocation _destination
-
_via
protected WarrantRoute.RouteLocation _via
-
_avoid
protected WarrantRoute.RouteLocation _avoid
-
_focusedField
protected WarrantRoute.RouteLocation _focusedField
-
_speedUtil
protected SpeedUtil _speedUtil
-
_displayPref
protected WarrantRoute.Display _displayPref
-
_units
protected WarrantRoute.Display _units
-
_scale
protected float _scale
-
STRUT_SIZE
static int STRUT_SIZE
-
PAD
static java.lang.String PAD
-
_orders
protected java.util.ArrayList<BlockOrder> _orders
-
-
Constructor Detail
-
WarrantRoute
protected WarrantRoute()
Only subclasses can create this
-
-
Method Detail
-
selectedRoute
protected abstract void selectedRoute(java.util.ArrayList<BlockOrder> orders)
-
maxThrottleEventAction
protected abstract void maxThrottleEventAction()
-
propertyChange
public abstract void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
setSpeedUtil
protected void setSpeedUtil(SpeedUtil sp)
-
searchDepthPanel
protected javax.swing.JPanel searchDepthPanel(boolean vertical)
-
calculatePanel
protected javax.swing.JPanel calculatePanel(boolean vertical)
-
makePickListPanel
public javax.swing.JPanel makePickListPanel()
-
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
-
closeProfileTable
protected void closeProfileTable()
-
setTrainInfo
protected java.lang.String setTrainInfo(java.lang.String name)
-
setTrainName
protected void setTrainName(java.lang.String name)
-
getTrainName
protected java.lang.String getTrainName()
-
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()
-
checkLocoAddress
protected java.lang.String checkLocoAddress()
-
calculate
protected void calculate()
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Does the action on each of the 4 RouteLocation panels- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Parameters:
e
- the action event
-
doAction
void doAction(java.lang.Object obj)
-
makeBlockPanels
protected javax.swing.JPanel makeBlockPanels(boolean add)
-
mouseClickedOnBlock
protected void mouseClickedOnBlock(OBlock block)
-
pathsAreValid
boolean pathsAreValid(@Nonnull OBlock block)
-
stopRouteFinder
protected void stopRouteFinder()
-
getOrders
protected java.util.List<BlockOrder> getOrders()
-
getViaBlockOrder
protected BlockOrder getViaBlockOrder()
-
getAvoidBlockOrder
protected BlockOrder getAvoidBlockOrder()
-
clearTempWarrant
protected void clearTempWarrant()
-
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 blocksrouteTree
- the routes
-
showWarning
protected void showWarning(java.lang.String msg)
-
makeRouteTablePanel
protected javax.swing.JPanel makeRouteTablePanel()
-
debugRoute
protected void debugRoute(javax.swing.tree.DefaultTreeModel tree, BlockOrder origin, BlockOrder dest)
Callback from RouteFinder - no routes found- Parameters:
tree
- routesorigin
- starting blockdest
- ending block
-
clearRoute
protected void clearRoute()
-
routeIsValid
protected java.lang.String routeIsValid()
-
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 interfaceWindowInterface
- Overrides:
dispose
in classJmriJFrame
-
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 = leftcomp
- Component to put into JPaneltext
- Bundle keyword for label messagetooltip
- 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 databutton
- 2nd Component for panel, usually a buttonlabel
- Bundle keyword for label messagetooltip
- 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 JPanellabel
- Bundle keyword for label messagetooltip
- Bundle keyword for tooltip message- Returns:
- Panel containing Component
-
-