Class ThrottleFrame
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
javax.swing.JDesktopPane
jmri.jmrit.throttle.implementation.ThrottleFrame
- All Implemented Interfaces:
ComponentListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ThrottleControllerUI
The classic JMRI throttle implementation as a JDesktopPane
Class naming is bad but kept for backwards compatibility. This is the main class for the throttle UI, it contains the 4 main panels (address, control, function and speed) as JInternalFrames and manages them. It also manages the Jynstruments that can be added to the throttle frame.
This file is part of JMRI.
This file is part of JMRI.
JMRI is free 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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classAn extension of InternalFrameAdapter for listening to the closing of of this frame's internal frames.Nested classes/interfaces inherited from class javax.swing.JDesktopPane
JDesktopPane.AccessibleJDesktopPaneNested classes/interfaces inherited from class javax.swing.JLayeredPane
JLayeredPane.AccessibleJLayeredPaneNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class javax.swing.JDesktopPane
LIVE_DRAG_MODE, OUTLINE_DRAG_MODEFields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYERFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidAdd an address listener to that throttle control UI.voidvoidvoidvoidvoidDispatch that throttle UI, will dispatch for that throttle control UI only.voiddispose()Handle my own destruction.voideStop()Emergency stop that throttlevoidGet that throttle control addressbooleanGet that throttle control roster entry for the function locomotiveGet that throttle control function throttle object (for consists)getLabel()Get a copy of that throttle control UI label (a text or the roster entry icon, for consits a consist icon will be built from the locomotives in the consist).Get that throttle control roster entryGet that throttle control UI roster entry selector panel, or null if that throttle control UI does not have one.Get that throttle control UI throttle objectReturn that throttle control containerorg.jdom2.ElementgetXml()org.jdom2.ElementbooleanisActive()Check if that throttle control is active (non null speed and at least one active function)booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanCheck if that throttle control is running (non null speed)booleanCheck if that throttle control UI is using continuous speed display (a speed slider from -100 to 100) (Used by external controls like USB game controllers) SeeSimpleThrottlePanelfor an example implementationbooleanbooleanCheck if that throttle control is using that addressvoidloadThrottleFile(String sfile) Load that throttle control UI from a throttle file.voidvoidRemove an address listener from that throttle control UI.voidvoidvoidvoidvoidSet that throttle control addressvoidsetAddressPanelVisible(boolean visible) voidSet that throttle consist control addressvoidsetConsistFunctionsPanelVisible(boolean visible) voidsetControlPanelVisible(boolean visible) voidsetEditMode(boolean mode) voidsetFunctionPanelVisible(boolean visible) voidsetLocation(int x, int y) Sets the location of a throttle frame on the screen according to x and y coordinatesvoidsetLocoIconPanelVisible(boolean visible) voidSet that throttle control roster entryvoidsetSpeedPanelVisible(boolean visible) voidSet that throttle control containervoidvoidsetXml(org.jdom2.Element e) voidtoFront()Bring that throttle UI control to front (window will be activated and raised if it is not already the case).voidsetFrameTitle - set the frame title based on type, text and addressvoidUpdate that throttle control UI.ynstrument(String path) Methods inherited from class javax.swing.JDesktopPane
addImpl, getAccessibleContext, getAllFrames, getAllFramesInLayer, getDesktopManager, getDragMode, getSelectedFrame, getUI, getUIClassID, paramString, remove, remove, removeAll, selectFrame, setComponentZOrder, setDesktopManager, setDragMode, setSelectedFrame, setUI, updateUIMethods inherited from class javax.swing.JLayeredPane
getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, setLayer, setLayer, setPositionMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.jmrit.throttle.interfaces.ThrottleControllerUI
isVisible
-
Constructor Details
-
ThrottleFrame
-
ThrottleFrame
-
-
Method Details
-
getControlPanelJIF
-
getAddressPanelJIF
-
getFunctionPanelJIF
-
updateGUI
Description copied from interface:ThrottleControllerUIUpdate that throttle control UI. Called by the throttle core UI when the controlled throttle address or roster entry is updated- Specified by:
updateGUIin interfaceThrottleControllerUI
-
setAddressPanelVisible
-
setControlPanelVisible
-
setFunctionPanelVisible
-
setSpeedPanelVisible
-
setLocoIconPanelVisible
-
setConsistFunctionsPanelVisible
-
resetFunctionPanelButton
-
dispose
Handle my own destruction.- dispose of sub windows.
- notify my manager of my demise.
-
getThrottleControllersContainer
Description copied from interface:ThrottleControllerUIReturn that throttle control container- Specified by:
getThrottleControllersContainerin interfaceThrottleControllerUI- Returns:
- the throttle control container
-
setThrottleControllersContainer
Description copied from interface:ThrottleControllerUISet that throttle control container- Specified by:
setThrottleControllersContainerin interfaceThrottleControllerUI- Parameters:
tw- the throttle control container to set
-
toFront
Description copied from interface:ThrottleControllerUIBring that throttle UI control to front (window will be activated and raised if it is not already the case).- Specified by:
toFrontin interfaceThrottleControllerUI
-
setRosterEntry
Description copied from interface:ThrottleControllerUISet that throttle control roster entry- Specified by:
setRosterEntryin interfaceThrottleControllerUI- Parameters:
re- the roster entry
-
getRosterEntry
Description copied from interface:ThrottleControllerUIGet that throttle control roster entry- Specified by:
getRosterEntryin interfaceThrottleControllerUI- Returns:
- the roster entry or null
-
getFunctionRosterEntry
Description copied from interface:ThrottleControllerUIGet that throttle control roster entry for the function locomotive- Specified by:
getFunctionRosterEntryin interfaceThrottleControllerUI- Returns:
- the roster entry or null
-
setAddress
Description copied from interface:ThrottleControllerUISet that throttle control address- Specified by:
setAddressin interfaceThrottleControllerUI- Parameters:
la- locomotive DccLocoAddress
-
getAddress
Description copied from interface:ThrottleControllerUIGet that throttle control address- Specified by:
getAddressin interfaceThrottleControllerUI- Returns:
- the throttle control address or null
-
setConsistAddress
Description copied from interface:ThrottleControllerUISet that throttle consist control address- Specified by:
setConsistAddressin interfaceThrottleControllerUI- Parameters:
la- consist DccLocoAddress
-
dispatchAddress
Description copied from interface:ThrottleControllerUIDispatch that throttle UI, will dispatch for that throttle control UI only. Throttle will actully be released only if that throttle control UI is the only one using that address.- Specified by:
dispatchAddressin interfaceThrottleControllerUI
-
isUsingAddress
Description copied from interface:ThrottleControllerUICheck if that throttle control is using that address- Specified by:
isUsingAddressin interfaceThrottleControllerUI- Parameters:
la- the DccLocoAddress to check- Returns:
- true if that throttle control is using that address, false otherwise
-
eStop
Description copied from interface:ThrottleControllerUIEmergency stop that throttle- Specified by:
eStopin interfaceThrottleControllerUI
-
isRunning
Description copied from interface:ThrottleControllerUICheck if that throttle control is running (non null speed)- Specified by:
isRunningin interfaceThrottleControllerUI- Returns:
- true if that throttle control is running, false otherwise
-
isActive
Description copied from interface:ThrottleControllerUICheck if that throttle control is active (non null speed and at least one active function)- Specified by:
isActivein interfaceThrottleControllerUI- Returns:
- true if that throttle control is active, false otherwise
-
getThrottle
Description copied from interface:ThrottleControllerUIGet that throttle control UI throttle object- Specified by:
getThrottlein interfaceThrottleControllerUI- Returns:
- the throttle or null
-
getFunctionThrottle
Description copied from interface:ThrottleControllerUIGet that throttle control function throttle object (for consists)- Specified by:
getFunctionThrottlein interfaceThrottleControllerUI- Returns:
- the function throttle or null
-
getLabel
Description copied from interface:ThrottleControllerUIGet a copy of that throttle control UI label (a text or the roster entry icon, for consits a consist icon will be built from the locomotives in the consist). SeeSimpleThrottlePanelfor an example implementation- Specified by:
getLabelin interfaceThrottleControllerUI- Returns:
- the label or null
-
isSpeedDisplayContinuous
Description copied from interface:ThrottleControllerUICheck if that throttle control UI is using continuous speed display (a speed slider from -100 to 100) (Used by external controls like USB game controllers) SeeSimpleThrottlePanelfor an example implementation- Specified by:
isSpeedDisplayContinuousin interfaceThrottleControllerUI- Returns:
- true if that throttle control UI is using continuous speed display, false otherwise
-
forceAddressPanelSelected
-
isAddressPanelVisible
-
isControlPanelVisible
-
isFunctionPanelVisible
-
isSpeedPanelVisible
-
isLocoIconPanelVisible
-
isConsistFunctionsPanelVisible
-
isKnownLastUsedSaveFile
-
isKnownRosterEntry
-
setTitle
-
saveRosterChanges
-
getRosterEntrySelector
Description copied from interface:ThrottleControllerUIGet that throttle control UI roster entry selector panel, or null if that throttle control UI does not have one. (Used by external controls like USB game controllers) SeeSimpleThrottlePanelfor an example implementation- Specified by:
getRosterEntrySelectorin interfaceThrottleControllerUI- Returns:
- the roster entry selector panel or null
-
addAddressListener
Description copied from interface:ThrottleControllerUIAdd an address listener to that throttle control UI. SeeSimpleThrottlePanelfor an example implementation- Specified by:
addAddressListenerin interfaceThrottleControllerUI- Parameters:
l- the address listener to add
-
removeAddressListener
Description copied from interface:ThrottleControllerUIRemove an address listener from that throttle control UI. SeeSimpleThrottlePanelfor an example implementation- Specified by:
removeAddressListenerin interfaceThrottleControllerUI- Parameters:
l- the address listener to remove
-
setLocation
Sets the location of a throttle frame on the screen according to x and y coordinates- Overrides:
setLocationin classComponent- See Also:
-
componentResized
- Specified by:
componentResizedin interfaceComponentListener
-
componentMoved
- Specified by:
componentMovedin interfaceComponentListener
-
componentShown
- Specified by:
componentShownin interfaceComponentListener
-
componentHidden
- Specified by:
componentHiddenin interfaceComponentListener
-
ynstrument
-
makeAllComponentsInBounds
-
setEditMode
-
getEditMode
-
activateNextJInternalFrame
-
activatePreviousJInternalFrame
-
updateFrameTitle
setFrameTitle - set the frame title based on type, text and address- Specified by:
updateFrameTitlein interfaceThrottleControllerUI
-
getXmlFile
-
setXml
-
getXml
-
saveThrottle
-
saveThrottleAs
-
loadThrottleFile
Description copied from interface:ThrottleControllerUILoad that throttle control UI from a throttle file.- Specified by:
loadThrottleFilein interfaceThrottleControllerUI- Parameters:
sfile- the throttle file to load, if null a file chooser will be prompted to select the throttle file to load
-