Class TimeTableFrame

  • All Implemented Interfaces:
    java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, BeanInterface, ModifiedFlag, WindowInterface

    public class TimeTableFrame
    extends JmriJFrame
    Create and maintain timetables.

    A timetable describes the layout and trains along with the times that each train should be at specified locations. Logical Schema Layout Train Types Segments Stations Schedules Trains Stops

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  TimeTableFrame.TimeTableTreeNode
      Timetable Tree Node Definition.
      • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void addLayout()
      Create a new Layout object with default values.
      (package private) void addPressed()
      Add new items.
      (package private) void addSchedule()
      Create a new Schedule object with default values.
      (package private) void addSegment()
      Create a new Segment object with default values.
      (package private) void addStation()
      Create a new Station object with default values.
      (package private) void addStop()  
      (package private) void addTrain()  
      (package private) void addTrainType()
      Create a new Train Type object.
      (package private) void buildComponents()
      Initialize components.
      (package private) java.lang.String buildNodeText​(java.lang.String nodeType, java.lang.Object component, int idx)
      Create the localized node text display strings based on node type.
      (package private) javax.swing.JTree buildTree()
      Create the TimeTable tree structure.
      (package private) void cancelPressed()
      Cancel the current node edit.
      (package private) void completeImport​(java.io.File file)  
      (package private) void copyPressed()
      Copy the stops from an existing train.
      (package private) Train copyTrainSelection()
      Select the train whose stops will be added to the new train.
      (package private) void createMenu()
      Create a Options/Tools menu
      (package private) void createTimeTableContent()
      Create the tree content.
      (package private) void deleteLayout()
      After confirmation, perform a cascade delete of the layout and its components.
      (package private) void deletePressed()
      Process the node delete request.
      (package private) void deleteSchedule()
      Delete a Schedule.
      (package private) void deleteSegment()
      Delete a Segment.
      (package private) void deleteStation()
      Delete a Station after checking for usage.
      (package private) void deleteStop()
      Delete a Stop.
      (package private) void deleteTrain()
      Delete a Train.
      (package private) void deleteTrainType()
      Delete a train type after checking for usage.
      (package private) void donePressed()
      Check for pending updates and close if none or approved.
      (package private) void downPressed()
      Move a Stop row down 1 row.
      (package private) void duplicateLayout​(int layoutId)
      Create a copy of a layout.
      (package private) void duplicatePressed()
      Duplicate selected item.
      (package private) void duplicateSchedule​(int layoutId, int scheduleId, TimeTableFrame.TimeTableTreeNode schedulesNode)
      Create a copy of a schedule.
      (package private) void duplicateSegment​(int layoutId, int segmentId, TimeTableFrame.TimeTableTreeNode segmentsNode)
      Create a copy of a segment.
      (package private) void duplicateStation​(int segmentId, int stationId, TimeTableFrame.TimeTableTreeNode segmentNode)
      Create a copy of a station.
      (package private) void duplicateStop​(int trainId, int stopId, int stationId, int seq, TimeTableFrame.TimeTableTreeNode trainNode)
      Create a copy of a stop.
      (package private) void duplicateTrain​(int schedId, int trainId, int typeId, TimeTableFrame.TimeTableTreeNode schedNode)
      Create a copy of a train.
      (package private) void duplicateTrainType​(int layoutId, int typeId, TimeTableFrame.TimeTableTreeNode typesNode)
      Create a copy of a train type.
      (package private) void editLayout()  
      (package private) void editPressed()
      Set up the edit environment for the selected node Called from treeRowSelected(jmri.jmrit.timetable.swing.TimeTableFrame.TimeTableTreeNode).
      (package private) void editSchedule()  
      (package private) void editSegment()  
      (package private) void editStation()  
      (package private) void editStop()  
      (package private) void editTrain()  
      (package private) void editTrainType()  
      (package private) void exportCsvPressed()  
      protected java.lang.String getClassName()  
      (package private) void graphPressed​(java.lang.String graphType)  
      (package private) void importCsvPressed()  
      (package private) void importFromOperationsPressed()  
      (package private) void importPressed()  
      (package private) void makeDetailGrid​(java.lang.String gridType)
      Build new GridBag content.
      (package private) void makeEmptyGrid​(java.awt.GridBagConstraints c)
      This grid is used when there are no edit grids required.
      (package private) void makeGridLabel​(int row, java.lang.String label, java.lang.String hint, java.awt.GridBagConstraints c)
      Create the label portion of a grid row.
      (package private) void makeLayoutGrid​(java.awt.GridBagConstraints c)
      This grid is used to edit Layout data.
      (package private) void makeScheduleGrid​(java.awt.GridBagConstraints c)
      This grid is used to edit the Schedule data.
      (package private) void makeSegmentGrid​(java.awt.GridBagConstraints c)
      This grid is used to edit the Segment data.
      (package private) void makeStationGrid​(java.awt.GridBagConstraints c)
      This grid is used to edit the Station data.
      (package private) void makeStopGrid​(java.awt.GridBagConstraints c)
      This grid is used to edit the Stop data.
      (package private) void makeTrainGrid​(java.awt.GridBagConstraints c)
      This grid is used to edit the Train data.
      (package private) void makeTrainTypeGrid​(java.awt.GridBagConstraints c)
      This grid is used to edit the Train Type data.
      (package private) void moveTreeNode​(java.lang.String direction)
      Move a tree node in response to a up or down request.
      (package private) int parseNumber​(javax.swing.JTextField textField, java.lang.String fieldName)
      Convert text input to an integer.
      (package private) void savePressed()
      Save the current set of timetable data.
      (package private) void setEditMode​(boolean active)
      Enable/disable buttons based on edit state.
      (package private) void setMoveButtons()
      Enable/Disable the Up and Down buttons based on the postion in the list.
      void setShowReminder​(boolean dirty)
      Set/clear dirty flag and save button
      (package private) void showNodeEditMessage()
      Display reminder to save.
      (package private) void treeRowSelected​(TimeTableFrame.TimeTableTreeNode selectedNode)
      Change the button row based on the currently selected node type.
      (package private) void updateLayout()
      Update the layout information.
      (package private) void updatePressed()
      Apply the updates to the current node.
      (package private) void updateSchedule()
      Update the schedule information.
      (package private) void updateSegment()
      Update the segment information.
      (package private) void updateStation()
      Update the station information.
      (package private) void updateStop()
      Update the stop information.
      (package private) void updateTrain()
      Update the train information.
      (package private) void updateTrainType()
      Update the train type information.
      (package private) void upPressed()
      Move a Stop row up 1 row.
      • 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
    • Method Detail

      • createMenu

        void createMenu()
        Create a Options/Tools menu. - Option: Show train times on the graph. - Option: Enable two page graph printing. - Tool: Import a SchedGen data file. - Tool: Import a CSV data file. - Tool: Export a CSV data file. Include the standard Windows and Help menu bar items.
      • buildComponents

        void buildComponents()
        Initialize components. Add Focus and Change listeners to activate edit mode. Create the color selector for train types.
      • makeDetailGrid

        void makeDetailGrid​(java.lang.String gridType)
        Build new GridBag content. The grid panel is hidden, emptied, re-built and made visible.
        Parameters:
        gridType - The type of grid to create
      • makeEmptyGrid

        void makeEmptyGrid​(java.awt.GridBagConstraints c)
        This grid is used when there are no edit grids required.
        Parameters:
        c - The constraints object used for the grid construction
      • makeLayoutGrid

        void makeLayoutGrid​(java.awt.GridBagConstraints c)
        This grid is used to edit Layout data.
        Parameters:
        c - The constraints object used for the grid construction
      • makeTrainTypeGrid

        void makeTrainTypeGrid​(java.awt.GridBagConstraints c)
        This grid is used to edit the Train Type data.
        Parameters:
        c - The constraints object used for the grid construction
      • makeSegmentGrid

        void makeSegmentGrid​(java.awt.GridBagConstraints c)
        This grid is used to edit the Segment data.
        Parameters:
        c - The constraints object used for the grid construction
      • makeStationGrid

        void makeStationGrid​(java.awt.GridBagConstraints c)
        This grid is used to edit the Station data.
        Parameters:
        c - The constraints object used for the grid construction
      • makeScheduleGrid

        void makeScheduleGrid​(java.awt.GridBagConstraints c)
        This grid is used to edit the Schedule data.
        Parameters:
        c - The constraints object used for the grid construction
      • makeTrainGrid

        void makeTrainGrid​(java.awt.GridBagConstraints c)
        This grid is used to edit the Train data.
        Parameters:
        c - The constraints object used for the grid construction
      • makeStopGrid

        void makeStopGrid​(java.awt.GridBagConstraints c)
        This grid is used to edit the Stop data.
        Parameters:
        c - The constraints object used for the grid construction
      • makeGridLabel

        void makeGridLabel​(int row,
                           java.lang.String label,
                           java.lang.String hint,
                           java.awt.GridBagConstraints c)
        Create the label portion of a grid row.
        Parameters:
        row - The grid row number.
        label - The bundle key for the label text.
        hint - The bundle key for the label tool tip.
        c - The grid bag contraints object.
      • addLayout

        void addLayout()
        Create a new Layout object with default values. Add the layout node and the TrainTypes, Segments and Schedules collection nodes.
      • addTrainType

        void addTrainType()
        Create a new Train Type object. The default color is black.
      • addSegment

        void addSegment()
        Create a new Segment object with default values.
      • addStation

        void addStation()
        Create a new Station object with default values.
      • addSchedule

        void addSchedule()
        Create a new Schedule object with default values.
      • duplicateLayout

        void duplicateLayout​(int layoutId)
        Create a copy of a layout.
        Parameters:
        layoutId - The id of the layout to be duplicated.
      • duplicateTrainType

        void duplicateTrainType​(int layoutId,
                                int typeId,
                                TimeTableFrame.TimeTableTreeNode typesNode)
        Create a copy of a train type.
        Parameters:
        layoutId - The id for the parent layout. Zero if within the same layout.
        typeId - The id of the train type to be duplicated.
        typesNode - The types node which will be parent for the new train type.
      • duplicateSegment

        void duplicateSegment​(int layoutId,
                              int segmentId,
                              TimeTableFrame.TimeTableTreeNode segmentsNode)
        Create a copy of a segment.
        Parameters:
        layoutId - The id for the parent layout. Zero if within the same layout.
        segmentId - The id of the segment to be duplicated.
        segmentsNode - The segments node which will be parent for the new segment.
      • duplicateStation

        void duplicateStation​(int segmentId,
                              int stationId,
                              TimeTableFrame.TimeTableTreeNode segmentNode)
        Create a copy of a station.
        Parameters:
        segmentId - The id for the parent segment. Zero if within the same segment.
        stationId - The id of the station to be duplicated.
        segmentNode - The segment node which will be parent for the new station.
      • duplicateSchedule

        void duplicateSchedule​(int layoutId,
                               int scheduleId,
                               TimeTableFrame.TimeTableTreeNode schedulesNode)
        Create a copy of a schedule.
        Parameters:
        layoutId - The id for the parent layout. Zero if within the same layout.
        scheduleId - The id of the schedule to be duplicated.
        schedulesNode - The schedules node which will be parent for the new schedule.
      • duplicateTrain

        void duplicateTrain​(int schedId,
                            int trainId,
                            int typeId,
                            TimeTableFrame.TimeTableTreeNode schedNode)
        Create a copy of a train.
        Parameters:
        schedId - The id for the parent schedule. Zero if within the same schedule.
        trainId - The id of the train to be duplicated.
        typeId - The id of the train type. If zero use the source train type.
        schedNode - The schedule node which will be parent for the new train.
      • duplicateStop

        void duplicateStop​(int trainId,
                           int stopId,
                           int stationId,
                           int seq,
                           TimeTableFrame.TimeTableTreeNode trainNode)
        Create a copy of a stop.
        Parameters:
        trainId - The id for the parent train. Zero if within the same train.
        stopId - The id of the stop to be duplicated.
        stationId - The id of the station. If zero use the source station.
        seq - The sequence for the new stop. If zero calculate the next sequence number.
        trainNode - The train node which will be parent for the new stop.
      • copyPressed

        void copyPressed()
        Copy the stops from an existing train.
      • copyTrainSelection

        Train copyTrainSelection()
        Select the train whose stops will be added to the new train.
        Returns:
        the selected train or null if there is no selection made.
      • updatePressed

        void updatePressed()
        Apply the updates to the current node.
      • updateLayout

        void updateLayout()
        Update the layout information. If the fast clock or metric values change, a recalc will be required. The throttles value cannot be less than the highest throttle assigned to a train.
      • updateTrainType

        void updateTrainType()
        Update the train type information.
      • updateSegment

        void updateSegment()
        Update the segment information.
      • updateStation

        void updateStation()
        Update the station information. The staging track value cannot be less than any train references.
      • updateSchedule

        void updateSchedule()
        Update the schedule information. Changes to the schedule times cannot make a train start time or a stop's arrival or departure times invalid.
      • updateTrain

        void updateTrain()
        Update the train information. The train start time has to have a h:mm format and cannot fall outside of the schedules times.
      • updateStop

        void updateStop()
        Update the stop information.
      • parseNumber

        int parseNumber​(javax.swing.JTextField textField,
                        java.lang.String fieldName)
        Convert text input to an integer.
        Parameters:
        textField - JTextField containing the probable integer.
        fieldName - The name of the field for the dialog.
        Returns:
        the valid number or -1 for an invalid input.
      • deletePressed

        void deletePressed()
        Process the node delete request.
      • deleteLayout

        void deleteLayout()
        After confirmation, perform a cascade delete of the layout and its components.
      • deleteTrainType

        void deleteTrainType()
        Delete a train type after checking for usage.
      • deleteSegment

        void deleteSegment()
        Delete a Segment. If the segment contains inactive stations, provide the option to perform a cascade delete.
      • deleteStation

        void deleteStation()
        Delete a Station after checking for usage.
      • deleteSchedule

        void deleteSchedule()
        Delete a Schedule. If the schedule contains trains, provide the option to perform a cascade delete of trains and their stops.
      • deleteTrain

        void deleteTrain()
        Delete a Train. If the train contains stops, provide the option to perform a cascade delete of the stops.
      • cancelPressed

        void cancelPressed()
        Cancel the current node edit.
      • upPressed

        void upPressed()
        Move a Stop row up 1 row.
      • downPressed

        void downPressed()
        Move a Stop row down 1 row.
      • moveTreeNode

        void moveTreeNode​(java.lang.String direction)
        Move a tree node in response to a up or down request.
        Parameters:
        direction - The direction of movement, Up or Down
      • setMoveButtons

        void setMoveButtons()
        Enable/Disable the Up and Down buttons based on the postion in the list.
      • graphPressed

        void graphPressed​(java.lang.String graphType)
      • savePressed

        void savePressed()
        Save the current set of timetable data.
      • donePressed

        void donePressed()
        Check for pending updates and close if none or approved.
      • buildTree

        javax.swing.JTree buildTree()
        Create the TimeTable tree structure.
        Returns:
        _timetableTree The tree ddefinition with its content
      • createTimeTableContent

        void createTimeTableContent()
        Create the tree content. Level 1 -- Layouts Level 2 -- Train Type, Segment and Schedule Containers Level 3 -- Train Types, Segments, Schedules Level 4 -- Stations, Trains Level 5 -- Stops
      • buildNodeText

        java.lang.String buildNodeText​(java.lang.String nodeType,
                                       java.lang.Object component,
                                       int idx)
        Create the localized node text display strings based on node type.
        Parameters:
        nodeType - The type of the node
        component - The object or child object
        idx - Optional index value
        Returns:
        nodeText containing the text to display on the node
      • setShowReminder

        public void setShowReminder​(boolean dirty)
        Set/clear dirty flag and save button
        Parameters:
        dirty - True if changes have been made that are not saved.
      • setEditMode

        void setEditMode​(boolean active)
        Enable/disable buttons based on edit state. The edit state controls the ability to select tree nodes.
        Parameters:
        active - True to make edit active, false to make edit inactive