Package jmri.jmrit.timetable.swing
Class TimeTableFrame
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
jmri.util.JmriJFrame
jmri.jmrit.timetable.swing.TimeTableFrame
- All Implemented Interfaces:
ComponentListener
,WindowListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,RootPaneContainer
,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 java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Nested classes/interfaces inherited from interface jmri.util.swing.WindowInterface
WindowInterface.Hint
-
Field Summary
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
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
Constructors Constructor Description TimeTableFrame()
TimeTableFrame(String tt)
-
Method Summary
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) String
buildNodeText(String nodeType, Object component, int idx)
Create the localized node text display strings based on node type.(package private) JTree
buildTree()
Create the TimeTable tree structure.(package private) void
cancelPressed()
Cancel the current node edit.(package private) void
completeImport(File file)
(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
editLayout()
(package private) void
editPressed()
Set up the edit environment for the selected node Called fromtreeRowSelected(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 String
getClassName()
(package private) void
graphPressed(String graphType)
(package private) void
importCsvPressed()
(package private) void
importFromOperationsPressed()
(package private) void
importPressed()
(package private) void
makeDetailGrid(String gridType)
Build new GridBag content.(package private) void
makeEmptyGrid(GridBagConstraints c)
This grid is used when there are no edit grids required.(package private) void
makeGridLabel(int row, String label, String hint, GridBagConstraints c)
Create the label portion of a grid row.(package private) void
makeLayoutGrid(GridBagConstraints c)
This grid is used to edit Layout data.(package private) void
makeScheduleGrid(GridBagConstraints c)
This grid is used to edit the Schedule data.(package private) void
makeSegmentGrid(GridBagConstraints c)
This grid is used to edit the Segment data.(package private) void
makeStationGrid(GridBagConstraints c)
This grid is used to edit the Station data.(package private) void
makeStopGrid(GridBagConstraints c)
This grid is used to edit the Stop data.(package private) void
makeTrainGrid(GridBagConstraints c)
This grid is used to edit the Train data.(package private) void
makeTrainTypeGrid(GridBagConstraints c)
This grid is used to edit the Train Type data.(package private) void
moveTreeNode(String direction)
Move a tree node in response to a up or down request.(package private) int
parseNumber(JTextField textField, 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 jmri.util.JmriJFrame
addHelpMenu, addNotify, componentHidden, componentMoved, componentResized, componentShown, dispose, 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
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 Details
-
EMPTY_GRID
- See Also:
- Constant Field Values
-
_dataMgr
-
_isDirty
boolean _isDirty -
_showTrainTimes
boolean _showTrainTimes -
_twoPage
boolean _twoPage -
_timetableTree
-
_timetableModel
-
_timetableRoot
-
_timetableListener
-
_curTreePath
-
_layoutNode
-
_typeHead
-
_typeNode
-
_segmentHead
-
_segmentNode
-
_stationNode
-
_scheduleHead
-
_scheduleNode
-
_trainNode
-
_stopNode
-
_leafNode
-
_curNode
-
_curNodeId
int _curNodeId -
_curNodeType
-
_curNodeText
-
_curNodeRow
int _curNodeRow -
_detailGrid
-
_detailFooter
-
_gridPanel
-
_editActive
boolean _editActive -
_cancelAction
-
_updateAction
-
_editLayoutName
-
_editScale
-
_editFastClock
-
_editThrottles
-
_editMetric
-
_showScaleMK
-
_editTrainTypeName
-
_editTrainTypeColor
-
_editSegmentName
-
_editStationName
-
_editDistance
-
_editDoubleTrack
-
_editSidings
-
_editStaging
-
_editScheduleName
-
_editEffDate
-
_editStartHour
-
_editDuration
-
_editTrainName
-
_editTrainDesc
-
_editTrainType
-
_editDefaultSpeed
-
_editTrainStartTime
-
_editThrottle
-
_editTrainNotes
-
_showRouteDuration
-
_showStopSeq
-
_editStopStation
-
_editStopDuration
-
_editNextSpeed
-
_editStagingTrack
-
_editStopNotes
-
_showArriveTime
-
_showDepartTime
-
_leftButtonBar
-
_addButtonPanel
-
_deleteButtonPanel
-
_moveButtonPanel
-
_graphButtonPanel
-
_addButton
-
_deleteButton
-
_displayButton
-
_printButton
-
_saveButton
-
detailFocusEvent
Enable edit mode. Used for JTextFields and JComboBoxs. -
detailChangeEvent
Enable edit mode. Used for JCheckBoxs, JSpinners and JColorChoosers. -
stopStationItemEvent
Change the max spinner value based on the station data. The number of staging tracks varies depending on the selected station. -
layoutScaleItemEvent
If the custom scale item is selected provide a dialog to set the scale ratio -
fileChooser
-
feedbackList
-
-
Constructor Details
-
TimeTableFrame
public TimeTableFrame() -
TimeTableFrame
-
-
Method Details
-
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
Build new GridBag content. The grid panel is hidden, emptied, re-built and made visible.- Parameters:
gridType
- The type of grid to create
-
makeEmptyGrid
This grid is used when there are no edit grids required.- Parameters:
c
- The constraints object used for the grid construction
-
makeLayoutGrid
This grid is used to edit Layout data.- Parameters:
c
- The constraints object used for the grid construction
-
makeTrainTypeGrid
This grid is used to edit the Train Type data.- Parameters:
c
- The constraints object used for the grid construction
-
makeSegmentGrid
This grid is used to edit the Segment data.- Parameters:
c
- The constraints object used for the grid construction
-
makeStationGrid
This grid is used to edit the Station data.- Parameters:
c
- The constraints object used for the grid construction
-
makeScheduleGrid
This grid is used to edit the Schedule data.- Parameters:
c
- The constraints object used for the grid construction
-
makeTrainGrid
This grid is used to edit the Train data.- Parameters:
c
- The constraints object used for the grid construction
-
makeStopGrid
This grid is used to edit the Stop data.- Parameters:
c
- The constraints object used for the grid construction
-
makeGridLabel
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.
-
addPressed
void addPressed()Add new items. -
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. -
addTrain
void addTrain() -
addStop
void addStop() -
editPressed
void editPressed()Set up the edit environment for the selected node Called fromtreeRowSelected(jmri.jmrit.timetable.swing.TimeTableFrame.TimeTableTreeNode)
. This takes the place of an actual button. -
editLayout
void editLayout() -
editTrainType
void editTrainType() -
editSegment
void editSegment() -
editStation
void editStation() -
editSchedule
void editSchedule() -
editTrain
void editTrain() -
editStop
void editStop() -
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
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. -
deleteStop
void deleteStop()Delete a Stop. -
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
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
-
importPressed
void importPressed() -
importCsvPressed
void importCsvPressed() -
completeImport
-
importFromOperationsPressed
void importFromOperationsPressed() -
exportCsvPressed
void exportCsvPressed() -
savePressed
void savePressed()Save the current set of timetable data. -
donePressed
void donePressed()Check for pending updates and close if none or approved. -
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
Create the localized node text display strings based on node type.- Parameters:
nodeType
- The type of the nodecomponent
- The object or child objectidx
- Optional index value- Returns:
- nodeText containing the text to display on the node
-
treeRowSelected
Change the button row based on the currently selected node type. Invoke edit where appropriate.- Parameters:
selectedNode
- The node object
-
showNodeEditMessage
void showNodeEditMessage()Display reminder to save. -
setShowReminder
Set/clear dirty flag and save button- Parameters:
dirty
- True if changes have been made that are not saved.
-
setEditMode
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
-
getClassName
-