|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
jmri.util.JmriJFrame
jmri.jmrit.dispatcher.DispatcherFrame
public class DispatcherFrame
Dispatcher functionality, working with Sections, Transits and ActiveTrain.
Dispatcher serves as the manager for ActiveTrains. All allocation of Sections to ActiveTrains is performed here.
Programming Note: public methods may be addressed externally via jmri.jmrit.dispatcher.DispatcherFrame.instance(). ...
Dispatcher listens to fast clock minutes to handle all ActiveTrain items tied to fast clock time.
Delayed start of manual and automatic trains is enforced by not allocating Sections for trains until the fast clock reaches the departure time.
This file is part of JMRI.
JMRI is open source software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
| Nested Class Summary | |
|---|---|
class |
DispatcherFrame.ActiveTrainsTableModel
Table model for Active Trains Table in Dispatcher window |
class |
DispatcherFrame.AllocatedSectionTableModel
Table model for Allocated Section Table |
class |
DispatcherFrame.AllocationRequestTableModel
Table model for Allocation Request Table in Dispatcher window |
| Nested classes/interfaces inherited from class javax.swing.JFrame |
|---|
JFrame.AccessibleJFrame |
| Nested classes/interfaces inherited from class java.awt.Frame |
|---|
Frame.AccessibleAWTFrame |
| Nested classes/interfaces inherited from class java.awt.Window |
|---|
Window.AccessibleAWTWindow |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected JmriJFrame |
dispatcherFrame
|
| Fields inherited from class jmri.util.JmriJFrame |
|---|
reuseFrameSavedPosition, reuseFrameSavedSized |
| Fields inherited from class javax.swing.JFrame |
|---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
| 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 javax.swing.WindowConstants |
|---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Method Summary | |
|---|---|
void |
allocateNewActiveTrain(ActiveTrain at)
|
AllocatedSection |
allocateSection(AllocationRequest ar,
Section ns)
Allocates a Section to an Active Train according to the information in an AllocationRequest If successful, returns an AllocatedSection and removes the AllocationRequest from the queue. |
ActiveTrain |
createActiveTrain(String transitID,
String trainID,
int tSource,
String startBlockName,
int startBlockSectionSequenceNumber,
String endBlockName,
int endBlockSectionSequenceNumber,
boolean autoRun,
String dccAddress,
int priority,
boolean resetWhenDone,
boolean reverseAtEnd,
boolean showErrorMessages,
JmriJFrame frame)
Creates a new ActiveTrain, and registers it with Dispatcher Required input entries: transitID - system or user name of a Transit in the Transit Table trainID - any text that identifies the train tSource - either ROSTER, OPERATIONS, or USER (see ActiveTrain.java) startBlockName - system or user name of Block where train currently resides startBlockSectionSequenceNumber - sequence number in the Transit of the Section containing the startBlock (if the startBlock is within the Transit) , or of the Section the train will enter from the startBlock (if the startBlock is outside the Transit). |
protected AllocationRequest |
findAllocationRequestInQueue(Section s,
int seq,
int dir,
ActiveTrain at)
|
protected ArrayList<ActiveTrain> |
getActiveTrainsList()
|
protected ArrayList<AllocatedSection> |
getAllocatedSectionsList()
|
protected boolean |
getAutoAllocate()
|
protected AutoTrainsFrame |
getAutoTrainsFrame()
|
protected boolean |
getAutoTurnouts()
|
protected boolean |
getExtraColorForAllocated()
|
protected boolean |
getHasOccupancyDetection()
|
protected LayoutEditor |
getLayoutEditor()
|
protected boolean |
getNameInAllocatedBlock()
|
protected int |
getScale()
|
String |
getSectionName(Section sec)
|
protected boolean |
getShortActiveTrainNames()
|
protected boolean |
getShortNameInBlock()
|
protected boolean |
getTrainsFromRoster()
|
protected boolean |
getTrainsFromTrains()
|
protected boolean |
getTrainsFromUser()
|
protected boolean |
getUseConnectivity()
|
protected boolean |
getUseScaleMeters()
|
static DispatcherFrame |
instance()
|
protected boolean |
isFastClockTimeGE(int hr,
int min)
This method tests time assuming both times are on the same day (ignoring midnight) It also sets nowMinutes and nowHours to the latest fast clock values |
protected void |
newFastClockMinute()
Handle activity that is triggered by the fast clock |
protected void |
newTrainDone(ActiveTrain at)
|
void |
releaseAllocatedSection(AllocatedSection as,
boolean terminatingTrain)
Releases an allocated Section, and removes it from the Dispatcher Input consists of the AllocatedSection object (returned by "allocateSection") and whether this release is from a Terminate Train. |
protected boolean |
requestAllocation(ActiveTrain activeTrain,
Section section,
int direction,
int seqNumber,
boolean showErrorMessages,
JmriJFrame frame)
Creates an Allocation Request, and registers it with Dispatcher Required input entries: activeTrain - ActiveTrain requesting the allocation section - Section to be allocated direction - direction of travel in the allocated Section seqNumber - sequence number of the Section in the Transit of the ActiveTrain. |
void |
sectionOccupancyChanged()
Updates display when occupancy of an allocated section changes Also drives auto release if it is selected |
protected void |
setAutoAllocate(boolean set)
|
protected void |
setAutoTurnouts(boolean set)
|
protected void |
setExtraColorForAllocated(boolean set)
|
protected void |
setHasOccupancyDetection(boolean set)
|
protected void |
setLayoutEditor(LayoutEditor editor)
|
protected void |
setNameInAllocatedBlock(boolean set)
|
protected void |
setScale(int sc)
|
protected void |
setShortActiveTrainNames(boolean set)
|
protected void |
setShortNameInBlock(boolean set)
|
protected void |
setTrainsFromRoster(boolean set)
|
protected void |
setTrainsFromTrains(boolean set)
|
protected void |
setTrainsFromUser(boolean set)
|
protected void |
setUseConnectivity(boolean set)
|
protected void |
setUseScaleMeters(boolean set)
|
void |
terminateActiveTrain(ActiveTrain at)
Terminates an Active Train and removes it from the Dispatcher The ActiveTrain object should not be used again after this method is called |
| Methods inherited from class java.awt.Frame |
|---|
getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
| 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 |
| Field Detail |
|---|
protected JmriJFrame dispatcherFrame
| Method Detail |
|---|
public String getSectionName(Section sec)
public ActiveTrain createActiveTrain(String transitID,
String trainID,
int tSource,
String startBlockName,
int startBlockSectionSequenceNumber,
String endBlockName,
int endBlockSectionSequenceNumber,
boolean autoRun,
String dccAddress,
int priority,
boolean resetWhenDone,
boolean reverseAtEnd,
boolean showErrorMessages,
JmriJFrame frame)
Required input entries: transitID - system or user name of a Transit in the Transit Table trainID - any text that identifies the train tSource - either ROSTER, OPERATIONS, or USER (see ActiveTrain.java) startBlockName - system or user name of Block where train currently resides startBlockSectionSequenceNumber - sequence number in the Transit of the Section containing the startBlock (if the startBlock is within the Transit) , or of the Section the train will enter from the startBlock (if the startBlock is outside the Transit). endBlockName - system or user name of Block where train will end up after its transit endBlockSectionSequenceNumber - sequence number in the Transit of the Section containing the endBlock. autoRun - set to "true" if computer is to run the train automatically, otherwise "false" dccAddress - required if "autoRun" is "true", set to null otherwise priority - any integer, higher number is higher priority. Used to arbitrate allocation request conflicts resetWhenDone - set to "true" if the Active Train is capable of continuous running and the user has requested that it be automatically reset for another run thru its Transit each time it completes running through its Transit. showErrorMessages - "true" if error message dialogs are to be displayed for detected errors Set to "false" to suppress error message dialogs from this method. frame - window request is from, or "null" if not from a window
Returns an ActiveTrain object if successful, returns "null" otherwise
public void allocateNewActiveTrain(ActiveTrain at)
public void terminateActiveTrain(ActiveTrain at)
protected boolean requestAllocation(ActiveTrain activeTrain,
Section section,
int direction,
int seqNumber,
boolean showErrorMessages,
JmriJFrame frame)
Required input entries: activeTrain - ActiveTrain requesting the allocation section - Section to be allocated direction - direction of travel in the allocated Section seqNumber - sequence number of the Section in the Transit of the ActiveTrain. If the requested Section is not in the Transit, a sequence number of -99 should be entered. showErrorMessages - "true" if error message dialogs are to be displayed for detected errors Set to "false" to suppress error message dialogs from this method. frame - window request is from, or "null" if not from a window
protected AllocationRequest findAllocationRequestInQueue(Section s,
int seq,
int dir,
ActiveTrain at)
public AllocatedSection allocateSection(AllocationRequest ar,
Section ns)
public void releaseAllocatedSection(AllocatedSection as,
boolean terminatingTrain)
public void sectionOccupancyChanged()
protected void newFastClockMinute()
protected boolean isFastClockTimeGE(int hr,
int min)
protected LayoutEditor getLayoutEditor()
protected void setLayoutEditor(LayoutEditor editor)
protected boolean getUseConnectivity()
protected void setUseConnectivity(boolean set)
protected boolean getTrainsFromRoster()
protected void setTrainsFromRoster(boolean set)
protected boolean getTrainsFromTrains()
protected void setTrainsFromTrains(boolean set)
protected boolean getTrainsFromUser()
protected void setTrainsFromUser(boolean set)
protected boolean getAutoAllocate()
protected void setAutoAllocate(boolean set)
protected boolean getAutoTurnouts()
protected void setAutoTurnouts(boolean set)
protected boolean getHasOccupancyDetection()
protected void setHasOccupancyDetection(boolean set)
protected boolean getUseScaleMeters()
protected void setUseScaleMeters(boolean set)
protected boolean getShortActiveTrainNames()
protected void setShortActiveTrainNames(boolean set)
protected boolean getShortNameInBlock()
protected void setShortNameInBlock(boolean set)
protected boolean getExtraColorForAllocated()
protected void setExtraColorForAllocated(boolean set)
protected boolean getNameInAllocatedBlock()
protected void setNameInAllocatedBlock(boolean set)
protected int getScale()
protected void setScale(int sc)
protected ArrayList<ActiveTrain> getActiveTrainsList()
protected ArrayList<AllocatedSection> getAllocatedSectionsList()
protected void newTrainDone(ActiveTrain at)
protected AutoTrainsFrame getAutoTrainsFrame()
public static DispatcherFrame instance()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||