Package jmri.jmrit.symbolicprog
Class FnMapPanelESU
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- jmri.jmrit.symbolicprog.FnMapPanelESU
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
public final class FnMapPanelESU extends javax.swing.JPanel
Provide a graphical representation of the ESU mapping table. Each row represents a possible mapping between input conditions (function keys, etc.) and logical, physical or sound outputs.Uses data from the "model" and "family" elements from the decoder definition file to configure the number of rows and set up any custom item names:
- extFnsESU
- Uses the ESU-style function map rather than the NMRA style.
- extFnsESU="V4" for generation 4 decoders.
- extFnsESU="V5" for generation 5 decoders.
- numOuts
- Number of physical outputs (information only, not used by the code).
- numOutsFromDefinition
- Number of physical outputs read from decoder definition.
- numFns
- Number of mapping rows to display.
- Only use this parameter if the specific decoder definition implements less rows than the default for that decoder generation (V4/V5), for example the LokPilot V4.
- output (in "family" or "model")
- name="blockNo,itemNo" label="theName"
- - Set name of block "blockNo", item "itemNo" to "theName".
- name="blockNo,itemNo" label="theName|OnChoice|OffChoice"
- - Set name of block "blockNo", item "itemNo" to "theName" and replace the default "On and "Off" choices for enumChoice items.
- name="blockNo,itemNo" label="|"
- - Cause item block "blockNo", item "itemNo" to be suppressed from the table.
- name="itemNo" label="..."
- - As above, but using an absolute "itemNo" (not recommended).
- name="theName" label="OnChoice|OffChoice"
- - Set name of the nth item to "theName" and replace the default "On and "Off" choices for enumChoice items, where this line is the nth "output" element of the "model" element in the decoder definition file (not recommended).
- Default item headings:
- Coded in String array itemDescESU[] of this class.
- Item headings can be overridden by the "output" elements documented above.
- Items will be suppressed if any of the following are true:
- No variables are found for that item.
- The item output name is of the form name="n" label="|".
- Item number is > numOuts.
- Variable definitions:
- Are of the form "ESU Function Row xx Item yy" and are created "on the fly" by this class. Many thousands of variables are needed to populate the function map. It is more efficient to create these in code than to use XML in the decoder file. DO NOT specify them in the decoder file.
The "tooltip" & "label" attributes on a fnmapping variable are ignored. Expanded internationalized tooltips are generated in the code.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
BIT_MODULUS
(package private) static int
BLOCK_NAME_ROW
(package private) java.awt.GridBagConstraints
cs
(package private) int
currentCol
(package private) int
currentRow
(package private) static int
CV_PAGE_MODULUS
(package private) java.lang.String
extFnsESU
(package private) static int
FIRST_ROW
(package private) int
firstCol
(package private) int
firstOut
(package private) java.awt.GridBagLayout
gl
(package private) static int
HINTS_ROW
(package private) java.lang.String[]
itemDescESU
(package private) boolean[]
itemIsUsed
(package private) java.lang.String[]
itemLabel
Default item labels.(package private) java.lang.String[][]
itemName
(package private) int[][]
iVarIndex
(package private) int
maxItems
(package private) static int
MOVE_ARROWS_TOP_ROW
(package private) int
numConfig2
(package private) int
numFns
(package private) int
numItems
(package private) int
numLogic
(package private) int
numOuts
(package private) int
numOutsFromDefinition
(package private) int
numReserved
(package private) int
numRows
(package private) int
numSensors
(package private) int
numSounds
(package private) int
numStates
(package private) int
numWheelSensors
(package private) int[]
outBlockCvModulus
(package private) int[]
outBlockItemBits
(package private) int[]
outBlockLength
(package private) java.lang.String[]
outBlockName
(package private) int[]
outBlockSiCvModulus
(package private) int[]
outBlockSiStartCv
(package private) int[]
outBlockStartCol
(package private) int[]
outBlockStartCv
(package private) int[]
outBlockUsed
(package private) static int
PI_CV
(package private) static int
ROW_LABEL_ROW
(package private) javax.swing.JRadioButton[]
rowButton
(package private) int
selectedRow
(package private) static int
SI_CV_MODULUS
(package private) static int
SI_START_CV
(package private) static int
START_CV
(package private) javax.swing.JTextField[][]
summaryLine
(package private) VariableTableModel
varModel
-
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
-
-
Constructor Summary
Constructors Constructor Description FnMapPanelESU(VariableTableModel v, java.util.List<java.lang.Integer> varsUsed, org.jdom2.Element model, RosterEntry rosterEntry, CvTableModel cvModel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addOutputElements(java.util.List<org.jdom2.Element> input, java.util.List<org.jdom2.Element> accumulate)
Adds a list of "output" or "outputs" elements to an existing list.(package private) void
addRowMoveButtons()
Adds the Row Move buttons at top and bottom.(package private) void
configOutputs(org.jdom2.Element model)
Use the "model" and "family" elements from the decoder definition file to configure the number of rows and columns and set up any custom column names.void
dispose()
Clean up at end.(package private) void
loadModelAttributes(org.jdom2.Element model)
Use the "model" element from the decoder definition file to fetch attributes relevant to building this function map.(package private) void
loadSplitLabel(int item, java.lang.String theLabel)
Splits a label as per documentation atFnMapPanelESU
.(package private) void
moveRow(int increment)
Moves rows up or down.(package private) void
parseLoadLabel(int item, java.lang.String name, java.lang.String label)
Loads labels as per documentation atFnMapPanelESU
.(package private) int
priorityValue(AbstractValue.ValueState state)
Assigns a priority value to a specified state.(package private) void
saveAt(int row, int column, javax.swing.JComponent j)
Saves an item at the specified row and column.(package private) void
setupDefaultNamesLabels()
Set up the default names and labels.(package private) void
updateAllSummaryLines()
Updates all summary lines, including setting appropriate states.(package private) void
updateSummaryLine(int row, int block)
Updates a summary line at the specified location, including setting appropriate state.-
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 Detail
-
firstCol
int firstCol
-
firstOut
int firstOut
-
currentCol
int currentCol
-
HINTS_ROW
static final int HINTS_ROW
- See Also:
- Constant Field Values
-
MOVE_ARROWS_TOP_ROW
static final int MOVE_ARROWS_TOP_ROW
- See Also:
- Constant Field Values
-
BLOCK_NAME_ROW
static final int BLOCK_NAME_ROW
- See Also:
- Constant Field Values
-
FIRST_ROW
static final int FIRST_ROW
- See Also:
- Constant Field Values
-
ROW_LABEL_ROW
static final int ROW_LABEL_ROW
- See Also:
- Constant Field Values
-
currentRow
int currentRow
-
PI_CV
static final int PI_CV
- See Also:
- Constant Field Values
-
SI_START_CV
static final int SI_START_CV
- See Also:
- Constant Field Values
-
SI_CV_MODULUS
static final int SI_CV_MODULUS
- See Also:
- Constant Field Values
-
START_CV
static final int START_CV
- See Also:
- Constant Field Values
-
CV_PAGE_MODULUS
static final int CV_PAGE_MODULUS
- See Also:
- Constant Field Values
-
BIT_MODULUS
static final int BIT_MODULUS
- See Also:
- Constant Field Values
-
gl
java.awt.GridBagLayout gl
-
cs
java.awt.GridBagConstraints cs
-
varModel
VariableTableModel varModel
-
outBlockName
java.lang.String[] outBlockName
-
outBlockLength
int[] outBlockLength
-
outBlockSiStartCv
int[] outBlockSiStartCv
-
outBlockSiCvModulus
int[] outBlockSiCvModulus
-
outBlockStartCv
int[] outBlockStartCv
-
outBlockCvModulus
int[] outBlockCvModulus
-
outBlockItemBits
int[] outBlockItemBits
-
outBlockStartCol
int[] outBlockStartCol
-
outBlockUsed
int[] outBlockUsed
-
summaryLine
javax.swing.JTextField[][] summaryLine
-
maxItems
int maxItems
-
itemDescESU
java.lang.String[] itemDescESU
-
itemLabel
java.lang.String[] itemLabel
Default item labels.- Two rows are available for item labels
- Use the '|' character to designate a row break
Item labels can be overridden by the "output" element of the "model" or "family" element from the decoder definition file.
-
itemName
java.lang.String[][] itemName
-
itemIsUsed
boolean[] itemIsUsed
-
iVarIndex
int[][] iVarIndex
-
extFnsESU
java.lang.String extFnsESU
-
numItems
int numItems
-
numFns
int numFns
-
numRows
int numRows
-
numOuts
int numOuts
-
numOutsFromDefinition
int numOutsFromDefinition
-
numStates
int numStates
-
numWheelSensors
int numWheelSensors
-
numReserved
int numReserved
-
numSensors
int numSensors
-
numConfig2
int numConfig2
-
numLogic
int numLogic
-
numSounds
int numSounds
-
selectedRow
int selectedRow
-
rowButton
javax.swing.JRadioButton[] rowButton
-
-
Constructor Detail
-
FnMapPanelESU
public FnMapPanelESU(VariableTableModel v, java.util.List<java.lang.Integer> varsUsed, org.jdom2.Element model, RosterEntry rosterEntry, CvTableModel cvModel)
-
-
Method Detail
-
setupDefaultNamesLabels
void setupDefaultNamesLabels()
Set up the default names and labels.
-
updateAllSummaryLines
void updateAllSummaryLines()
Updates all summary lines, including setting appropriate states.
-
updateSummaryLine
void updateSummaryLine(int row, int block)
Updates a summary line at the specified location, including setting appropriate state.- Parameters:
row
- the row to updateblock
- the block to update
-
priorityValue
int priorityValue(AbstractValue.ValueState state)
Assigns a priority value to a specified state.- Parameters:
state
- the state- Returns:
- the assigned priority value
-
saveAt
void saveAt(int row, int column, javax.swing.JComponent j)
Saves an item at the specified row and column.- Parameters:
row
- the rowcolumn
- the columnj
- the item
-
moveRow
void moveRow(int increment)
Moves rows up or down.Row moves are for convenience purposes only. Decoder functioning is unaffected by row position in mapping table.
- Parameters:
increment
- number of rows to move by
-
addRowMoveButtons
void addRowMoveButtons()
Adds the Row Move buttons at top and bottom.
-
configOutputs
void configOutputs(org.jdom2.Element model)
Use the "model" and "family" elements from the decoder definition file to configure the number of rows and columns and set up any custom column names.- Parameters:
model
- the "model" element from the decoder definition file
-
loadModelAttributes
void loadModelAttributes(org.jdom2.Element model)
Use the "model" element from the decoder definition file to fetch attributes relevant to building this function map.- Parameters:
model
- the "model" element from the decoder definition file
-
addOutputElements
void addOutputElements(java.util.List<org.jdom2.Element> input, java.util.List<org.jdom2.Element> accumulate)
Adds a list of "output" or "outputs" elements to an existing list.- Parameters:
input
- the list to add fromaccumulate
- the list to add to
-
parseLoadLabel
void parseLoadLabel(int item, java.lang.String name, java.lang.String label)
Loads labels as per documentation atFnMapPanelESU
.- Parameters:
item
- the item number to loadname
- the "name" attribute from the "output" elementlabel
- the "label" attribute from the "output" element
-
loadSplitLabel
void loadSplitLabel(int item, java.lang.String theLabel)
Splits a label as per documentation atFnMapPanelESU
.- Parameters:
item
- the item number to loadtheLabel
- the label attribute from the "output" element
-
dispose
public void dispose()
Clean up at end.
-
-