jmri.jmrix.bachrus
Class SpeedoConsoleFrame

Show UML class diagram
java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by jmri.util.JmriJFrame
                          extended by jmri.jmrix.bachrus.SpeedoConsoleFrame
All Implemented Interfaces:
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, SpeedoListener, ModifiedFlag, ProgListener, ThrottleListener, WindowInterface

public class SpeedoConsoleFrame
extends JmriJFrame
implements SpeedoListener, ThrottleListener, ProgListener, java.beans.PropertyChangeListener

Frame for Speedo Console for Bachrus running stand reader interface

See Also:
Serialized Form

Nested Class Summary
protected static class SpeedoConsoleFrame.DisplayType
           
protected static class SpeedoConsoleFrame.ProfileDirection
           
protected static class SpeedoConsoleFrame.ProfileState
           
protected static class SpeedoConsoleFrame.ProgState
           
 
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
 
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
protected  float acc
           
protected  float avSpeed
           
protected static int BASIC
           
protected  float circ
           
protected static int COMMAND
           
protected  CommandStation commandStation
           
protected  float count
           
protected  float currentSpeed
           
protected  int dccServices
           
protected static int defaultScale
           
protected  javax.swing.JRadioButton dialButton
           
protected  javax.swing.JRadioButton dirFwdButton
           
protected  javax.swing.JRadioButton dirRevButton
           
protected  SpeedoConsoleFrame.DisplayType display
           
protected static int DISPLAY_UPDATE
           
protected  javax.swing.ButtonGroup displayGroup
           
(package private)  javax.swing.Timer displayTimer
           
protected  javax.swing.JButton exportProfileButton
           
protected static int FAST_DISPLAY_RATIO
           
(package private)  javax.swing.Timer fastDisplayTimer
           
(package private) static int[] filterLength
           
protected  float freq
           
protected  float incSpeed
           
protected  javax.swing.JRadioButton kphButton
           
(package private) static org.slf4j.Logger log
           
protected  javax.swing.JRadioButton mainButton
           
protected  javax.swing.ButtonGroup modeGroup
           
protected  javax.swing.JRadioButton mphButton
           
protected  javax.swing.JRadioButton numButton
           
protected  float oldSpeed
           
protected  javax.swing.JButton printProfileButton
           
protected  javax.swing.JTextField printTitleText
           
protected  SpeedoConsoleFrame.ProfileDirection profileDir
           
(package private)  GraphPane profileGraphPane
           
protected  float profileIncrement
           
protected  float profileSpeed
           
protected  int profileStep
           
(package private)  javax.swing.Timer profileTimer
           
protected  Programmer prog
           
protected static int PROG
           
protected  javax.swing.JRadioButton progButton
           
protected  int range
           
protected static int RANGE1HI
           
protected static int RANGE1LO
           
protected static int RANGE2HI
           
protected static int RANGE2LO
           
protected static int RANGE3HI
           
protected static int RANGE3LO
           
protected static int RANGE4HI
           
protected static int RANGE4LO
           
(package private) static java.util.ResourceBundle rb
          TODO: Complete the help file Allow selection of arbitrary scale
protected  int readAddress
           
protected  javax.swing.JButton readAddressButton
           
protected  javax.swing.JLabel readerLabel
           
protected  SpeedoConsoleFrame.ProgState readState
           
(package private)  java.lang.String replyString
           
(package private)  javax.swing.Timer replyTimer
           
protected  RosterEntry rosterEntry
           
protected  float sampleSpeed
           
protected  javax.swing.JLabel scaleLabel
           
(package private)  javax.swing.JComboBox scaleList
           
protected  float[] scales
           
protected  java.lang.String[] scaleStrings
           
protected  float selectedScale
           
protected  int series
           
protected  javax.swing.ButtonGroup speedGroup
           
protected  SpeedoDial speedoDialDisplay
           
protected  javax.swing.JTextField speedTextField
           
protected  DccSpeedProfile spFwd
           
protected  DccSpeedProfile spRev
           
protected  javax.swing.JButton startProfileButton
           
protected  SpeedoConsoleFrame.ProfileState state
           
protected  javax.swing.JLabel statusLabel
           
protected  javax.swing.JButton stopProfileButton
           
protected  float targetSpeed
           
(package private)  SpeedoTrafficController tc
           
protected  DccThrottle throttle
           
protected static int THROTTLE
           
protected  boolean timerRunning
           
protected  javax.swing.JRadioButton toggleGridButton
           
protected  javax.swing.JButton trackPowerButton
           
 
Fields inherited from class jmri.util.JmriJFrame
allowInFrameServlet, properties, reuseFrameSavedPosition, reuseFrameSavedSized, windowInterface
 
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 jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted
 
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
 
Constructor Summary
SpeedoConsoleFrame()
           
 
Method Summary
protected  void avClr()
           
protected  void avFn(float speed)
           
protected  void calcSpeed()
           
protected  void displayTimeout()
          Internal routine to update the target speed for display
 void dispose()
          When window is finally destroyed, remove it from the list of windows.
protected  void fastDisplayTimeout()
          Internal routine to update the displayed speed
 void initComponents()
          By default, Swing components should be created an installed in this method, rather than in the ctor itself.
 void notifyFailedThrottleRequest(DccLocoAddress address, java.lang.String reason)
          Get notification that an attempt to request a throttle has failed
 void notifyThrottleFound(DccThrottle t)
          Get notification that a throttle has been found as you requested.
protected  void profileTimeout()
          Time to change to next speed increment
 void programmingOpReply(int value, int status)
          Receive a callback at the end of a programming operation.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
protected  void readAddress()
           
 void reply(SpeedoReply l)
          Handle "replies" from the hardware.
protected  void replyTimeout()
          Internal routine to reset the speed on a timeout
 void setRosterEntry(RosterEntry entry)
          Set the RosterEntry for this throttle.
protected  void showSpeed()
           
protected  void startDisplayTimer()
           
protected  void startFastDisplayTimer()
           
protected  void startProfile()
           
protected  void startRead(int cv)
           
protected  void startReplyTimer()
           
protected  void stopProfile()
           
protected  void switchRange()
           
protected  void throttleTimeout()
          timeout requesting a throttle
protected  void tidyUp()
           
protected  java.lang.String title()
           
protected  void trackPower()
           
 
Methods inherited from class jmri.util.JmriJFrame
addHelpMenu, addNotify, componentHidden, componentMoved, componentResized, componentShown, generateWindowRef, getAllowInFrameServlet, getEscapeKeyAction, getEscapeKeyClosesWindow, getFrame, getFrame, getFrameList, getFrameList, getIndexedProperty, getMaximumSize, getModifiedFlag, getPreferredSize, getProperty, getPropertyNames, getSavePosition, getSaveSize, getWindowFrameRef, getWindowInterface, handleModified, hasProperty, makePrivateWindow, markWindowModified, multipleInstances, pack, setAllowInFrameServlet, setEscapeKeyAction, setEscapeKeyClosesWindow, setIndexedProperty, setModifiedFlag, setProperty, setSavePosition, setSaveSize, setShutDownTask, setWindowInterface, show, show, storeValues, 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, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, 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, transferFocusBackward, 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, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, isOpaque, 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, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, 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
 

Field Detail

rb

static final java.util.ResourceBundle rb
TODO: Complete the help file Allow selection of arbitrary scale


scaleLabel

protected javax.swing.JLabel scaleLabel

speedTextField

protected javax.swing.JTextField speedTextField

modeGroup

protected javax.swing.ButtonGroup modeGroup

progButton

protected javax.swing.JRadioButton progButton

mainButton

protected javax.swing.JRadioButton mainButton

speedGroup

protected javax.swing.ButtonGroup speedGroup

mphButton

protected javax.swing.JRadioButton mphButton

kphButton

protected javax.swing.JRadioButton kphButton

displayGroup

protected javax.swing.ButtonGroup displayGroup

numButton

protected javax.swing.JRadioButton numButton

dialButton

protected javax.swing.JRadioButton dialButton

speedoDialDisplay

protected SpeedoDial speedoDialDisplay

dirFwdButton

protected javax.swing.JRadioButton dirFwdButton

dirRevButton

protected javax.swing.JRadioButton dirRevButton

toggleGridButton

protected javax.swing.JRadioButton toggleGridButton

profileGraphPane

GraphPane profileGraphPane

readAddressButton

protected javax.swing.JButton readAddressButton

rosterEntry

protected RosterEntry rosterEntry

trackPowerButton

protected javax.swing.JButton trackPowerButton

startProfileButton

protected javax.swing.JButton startProfileButton

stopProfileButton

protected javax.swing.JButton stopProfileButton

exportProfileButton

protected javax.swing.JButton exportProfileButton

printProfileButton

protected javax.swing.JButton printProfileButton

printTitleText

protected javax.swing.JTextField printTitleText

statusLabel

protected javax.swing.JLabel statusLabel

readerLabel

protected javax.swing.JLabel readerLabel

scaleStrings

protected java.lang.String[] scaleStrings

scales

protected float[] scales

defaultScale

protected static final int defaultScale
See Also:
Constant Field Values

selectedScale

protected float selectedScale

series

protected int series

sampleSpeed

protected float sampleSpeed

targetSpeed

protected float targetSpeed

currentSpeed

protected float currentSpeed

incSpeed

protected float incSpeed

oldSpeed

protected float oldSpeed

acc

protected float acc

avSpeed

protected float avSpeed

range

protected int range

circ

protected float circ

count

protected float count

freq

protected float freq

DISPLAY_UPDATE

protected static final int DISPLAY_UPDATE
See Also:
Constant Field Values

FAST_DISPLAY_RATIO

protected static final int FAST_DISPLAY_RATIO
See Also:
Constant Field Values

RANGE1LO

protected static final int RANGE1LO
See Also:
Constant Field Values

RANGE1HI

protected static final int RANGE1HI
See Also:
Constant Field Values

RANGE2LO

protected static final int RANGE2LO
See Also:
Constant Field Values

RANGE2HI

protected static final int RANGE2HI
See Also:
Constant Field Values

RANGE3LO

protected static final int RANGE3LO
See Also:
Constant Field Values

RANGE3HI

protected static final int RANGE3HI
See Also:
Constant Field Values

RANGE4LO

protected static final int RANGE4LO
See Also:
Constant Field Values

RANGE4HI

protected static final int RANGE4HI
See Also:
Constant Field Values

filterLength

static final int[] filterLength

display

protected SpeedoConsoleFrame.DisplayType display

dccServices

protected int dccServices

BASIC

protected static final int BASIC
See Also:
Constant Field Values

PROG

protected static final int PROG
See Also:
Constant Field Values

COMMAND

protected static final int COMMAND
See Also:
Constant Field Values

THROTTLE

protected static final int THROTTLE
See Also:
Constant Field Values

timerRunning

protected boolean timerRunning

spFwd

protected DccSpeedProfile spFwd

spRev

protected DccSpeedProfile spRev

state

protected SpeedoConsoleFrame.ProfileState state

profileDir

protected SpeedoConsoleFrame.ProfileDirection profileDir

throttle

protected DccThrottle throttle

profileStep

protected int profileStep

profileSpeed

protected float profileSpeed

profileIncrement

protected float profileIncrement

readAddress

protected int readAddress

prog

protected Programmer prog

commandStation

protected CommandStation commandStation

readState

protected SpeedoConsoleFrame.ProgState readState

scaleList

javax.swing.JComboBox scaleList

tc

SpeedoTrafficController tc

replyString

java.lang.String replyString

replyTimer

javax.swing.Timer replyTimer

displayTimer

javax.swing.Timer displayTimer

fastDisplayTimer

javax.swing.Timer fastDisplayTimer

profileTimer

javax.swing.Timer profileTimer

log

static org.slf4j.Logger log
Constructor Detail

SpeedoConsoleFrame

public SpeedoConsoleFrame()
Method Detail

title

protected java.lang.String title()

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()

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

initComponents

public void initComponents()
                    throws java.lang.Exception
Description copied from class: JmriJFrame
By default, Swing components should be created an installed in this method, rather than in the ctor itself.

Overrides:
initComponents in class JmriJFrame
Throws:
java.lang.Exception

setRosterEntry

public void setRosterEntry(RosterEntry entry)
Set the RosterEntry for this throttle.


propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

reply

public void reply(SpeedoReply l)
Handle "replies" from the hardware. In fact, all the hardware does is send a constant stream of unsolicited speed updates.

Specified by:
reply in interface SpeedoListener
Parameters:
l -

calcSpeed

protected void calcSpeed()

avFn

protected void avFn(float speed)

avClr

protected void avClr()

switchRange

protected void switchRange()

showSpeed

protected void showSpeed()

trackPower

protected void trackPower()

startProfile

protected void startProfile()

stopProfile

protected void stopProfile()

notifyThrottleFound

public void notifyThrottleFound(DccThrottle t)
Description copied from interface: ThrottleListener
Get notification that a throttle has been found as you requested.

Specified by:
notifyThrottleFound in interface ThrottleListener
Parameters:
t - An instantiation of the DccThrottle with the address requested.

notifyFailedThrottleRequest

public void notifyFailedThrottleRequest(DccLocoAddress address,
                                        java.lang.String reason)
Description copied from interface: ThrottleListener
Get notification that an attempt to request a throttle has failed

Specified by:
notifyFailedThrottleRequest in interface ThrottleListener
Parameters:
address - DccLocoAddress of the failed loco request.
reason - The reason why the throttle request failed.

startReplyTimer

protected void startReplyTimer()

replyTimeout

protected void replyTimeout()
Internal routine to reset the speed on a timeout


startDisplayTimer

protected void startDisplayTimer()

startFastDisplayTimer

protected void startFastDisplayTimer()

displayTimeout

protected void displayTimeout()
Internal routine to update the target speed for display


fastDisplayTimeout

protected void fastDisplayTimeout()
Internal routine to update the displayed speed


throttleTimeout

protected void throttleTimeout()
timeout requesting a throttle


profileTimeout

protected void profileTimeout()
Time to change to next speed increment


tidyUp

protected void tidyUp()

readAddress

protected void readAddress()

startRead

protected void startRead(int cv)

programmingOpReply

public void programmingOpReply(int value,
                               int status)
Description copied from interface: ProgListener
Receive a callback at the end of a programming operation.

Specified by:
programmingOpReply in interface ProgListener
Parameters:
value - Value from a read operation, or value written on a write
status - Denotes the completion code. Note that this is a bitwise combination of the various status coded defined in this interface.


Copyright © 1997-2014 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads