Package jmri.jmrix.nce.macro
Class NceMacroEditPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jmri.util.swing.JmriPanel
jmri.jmrix.nce.swing.NcePanel
jmri.jmrix.nce.macro.NceMacroEditPanel
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,AbstractMRListener
,NceListener
,NcePanelInterface
public class NceMacroEditPanel extends NcePanel implements NceListener
Frame for user edit of NCE macros
NCE macros are stored in Command Station (CS) memory starting at address
xC800. Each macro consists of 20 bytes. The last macro 255 is at address
xDBEC.
Macro addr 0 xC800 1 xC814 2 xC828 3 xC83C . . . . 255 xDBEC
Each macro can close or throw up to ten accessories. Macros can also be
linked together. Two bytes (16 bit word) define an accessory address and
command, or the address of the next macro to be executed. If the upper byte
of the macro data word is xFF, then the next byte contains the address of the
next macro to be executed by the NCE CS. For example, xFF08 means link to
macro 8. NCE uses the NMRA DCC accessory decoder packet format for the word
definition of their macros.
Macro data byte:
bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 _ _ _ _ 1 0 A A A A A A 1 A A A C D
D D addr bit 7 6 5 4 3 2 10 9 8 1 0 turnout T
By convention, MSB address bits 10 - 8 are one's complement. NCE macros
always set the C bit to 1. The LSB "D" (0) determines if the accessory is to
be thrown (0) or closed (1). The next two bits "D D" are the LSBs of the
accessory address. Note that NCE display addresses are 1 greater than NMRA
DCC. Note that address bit 2 isn't supposed to be inverted, but it is the way
NCE implemented their macros.
Examples:
81F8 = accessory 1 thrown 9FFC = accessory 123 thrown B5FD = accessory 211
close BF8F = accessory 2044 close
FF10 = link macro 16
Updated for including the USB 7.* for 1.65 command station
Variables found on cab context page 14 (Cab address 14)
;macro table MACRO_TBL ;table of macros, 16 entries of 16 bytes organized as:
; macro 0, high byte, low byte - 7 more times (8 accy commands total) ; macro
1, high byte, low byte - 7 more times (8 accy commands total) ; ; macro 16,
high byte, low byte - 7 more times (8 accy commands total)
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NceMacroEditPanel.Default
Nested class to create one of these using old-style defaultsNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields Modifier and Type Field Description (package private) JTextField
accyTextField1
(package private) JTextField
accyTextField10
(package private) JTextField
accyTextField2
(package private) JTextField
accyTextField3
(package private) JTextField
accyTextField4
(package private) JTextField
accyTextField5
(package private) JTextField
accyTextField6
(package private) JTextField
accyTextField7
(package private) JTextField
accyTextField8
(package private) JTextField
accyTextField9
(package private) JButton
backUpButton
(package private) JCheckBox
checkBoxEmpty
(package private) JCheckBox
checkBoxNce
(package private) JButton
cmdButton1
(package private) JButton
cmdButton10
(package private) JButton
cmdButton2
(package private) JButton
cmdButton3
(package private) JButton
cmdButton4
(package private) JButton
cmdButton5
(package private) JButton
cmdButton6
(package private) JButton
cmdButton7
(package private) JButton
cmdButton8
(package private) JButton
cmdButton9
(package private) JButton
deleteButton1
(package private) JButton
deleteButton10
(package private) JButton
deleteButton2
(package private) JButton
deleteButton3
(package private) JButton
deleteButton4
(package private) JButton
deleteButton5
(package private) JButton
deleteButton6
(package private) JButton
deleteButton7
(package private) JButton
deleteButton8
(package private) JButton
deleteButton9
(package private) JButton
getButton
(package private) JLabel
macroReply
(package private) JTextField
macroTextField
(package private) Thread
nceMemoryThread
(package private) JButton
nextButton
(package private) JLabel
num1
(package private) JLabel
num10
(package private) JLabel
num2
(package private) JLabel
num3
(package private) JLabel
num4
(package private) JLabel
num5
(package private) JLabel
num6
(package private) JLabel
num7
(package private) JLabel
num8
(package private) JLabel
num9
(package private) JButton
previousButton
(package private) int
recChar
response from read(package private) int[]
recChars
(package private) JButton
restoreButton
(package private) JButton
saveButton
(package private) JLabel
space15
(package private) JLabel
space2
(package private) JLabel
space3
(package private) JLabel
space4
(package private) JLabel
textAccy1
(package private) JLabel
textAccy10
(package private) JLabel
textAccy2
(package private) JLabel
textAccy3
(package private) JLabel
textAccy4
(package private) JLabel
textAccy5
(package private) JLabel
textAccy6
(package private) JLabel
textAccy7
(package private) JLabel
textAccy8
(package private) JLabel
textAccy9
(package private) JLabel
textMacro
(package private) JLabel
textReply
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, 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
-
Constructor Summary
Constructors Constructor Description NceMacroEditPanel()
-
Method Summary
Modifier and Type Method Description void
buttonActionCmdPerformed(ActionEvent ae)
void
buttonActionDeletePerformed(ActionEvent ae)
void
buttonActionPerformed(ActionEvent ae)
void
checkBoxActionPerformed(ActionEvent ae)
String
getHelpTarget()
Provide a help target string which an enclosing frame can provide as a help reference.String
getTitle()
Provide a recommended title for an enclosing frame.void
initComponents(NceSystemConnectionMemo memo)
2nd stage of initialization, invoked after the constuctor is complete.void
initContext(Object context)
3rd stage of initialization, invoked after Swing components exist.void
message(NceMessage m)
void
reply(NceReply r)
Methods inherited from class jmri.util.swing.JmriPanel
dispose, getMenus, getWindowInterface, initComponents, isMultipleInstances, setWindowInterface
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods 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, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, 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, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
nceMemoryThread
-
textMacro
-
textReply
-
macroReply
-
previousButton
-
nextButton
-
getButton
-
saveButton
-
backUpButton
-
restoreButton
-
checkBoxEmpty
-
checkBoxNce
-
macroTextField
-
space2
-
space3
-
space4
-
space15
-
num1
-
textAccy1
-
accyTextField1
-
cmdButton1
-
deleteButton1
-
num2
-
textAccy2
-
accyTextField2
-
cmdButton2
-
deleteButton2
-
num3
-
textAccy3
-
accyTextField3
-
cmdButton3
-
deleteButton3
-
num4
-
textAccy4
-
accyTextField4
-
cmdButton4
-
deleteButton4
-
num5
-
textAccy5
-
accyTextField5
-
cmdButton5
-
deleteButton5
-
num6
-
textAccy6
-
accyTextField6
-
cmdButton6
-
deleteButton6
-
num7
-
textAccy7
-
accyTextField7
-
cmdButton7
-
deleteButton7
-
num8
-
textAccy8
-
accyTextField8
-
cmdButton8
-
deleteButton8
-
num9
-
textAccy9
-
accyTextField9
-
cmdButton9
-
deleteButton9
-
num10
-
textAccy10
-
accyTextField10
-
cmdButton10
-
deleteButton10
-
recChar
int recCharresponse from read -
recChars
int[] recChars
-
-
Constructor Details
-
NceMacroEditPanel
public NceMacroEditPanel()
-
-
Method Details
-
initContext
3rd stage of initialization, invoked after Swing components exist.- Overrides:
initContext
in classNcePanel
- Parameters:
context
- the context that this panel may be initialized with
-
getHelpTarget
Provide a help target string which an enclosing frame can provide as a help reference.This automatically provides a reference to the usual place for JMRI window-specific help pages that are named for the implementing class, but note this is a Pane class, not a Frame class.
- Overrides:
getHelpTarget
in classJmriPanel
- Returns:
- the target String
-
getTitle
Provide a recommended title for an enclosing frame. -
initComponents
2nd stage of initialization, invoked after the constuctor is complete.This needs to be connected to the initContext() method in implementing classes.
- Specified by:
initComponents
in interfaceNcePanelInterface
- Overrides:
initComponents
in classNcePanel
- Parameters:
memo
- the system connection memo for this connection
-
buttonActionPerformed
-
buttonActionCmdPerformed
-
buttonActionDeletePerformed
-
checkBoxActionPerformed
-
message
- Specified by:
message
in interfaceNceListener
-
reply
- Specified by:
reply
in interfaceNceListener
-