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:
ImageObserver,MenuContainer,Serializable,Accessible
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested 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
FieldsModifier and TypeFieldDescription(package private) static final int(package private) static final int(package private) GridBagConstraints(package private) int(package private) int(package private) static final int(package private) String(package private) static final int(package private) int(package private) int(package private) GridBagLayout(package private) static final int(package private) String[](package private) boolean[](package private) String[]Default item labels.(package private) String[][](package private) int[][](package private) int(package private) static final int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int[](package private) int[](package private) int[](package private) String[](package private) int[](package private) int[](package private) int[](package private) int[](package private) int[](package private) static final int(package private) static final int(package private) JRadioButton[](package private) int(package private) static final int(package private) static final int(package private) static final int(package private) JTextField[][](package private) VariableTableModelFields 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
ConstructorsConstructorDescriptionFnMapPanelESU(VariableTableModel v, List<Integer> varsUsed, org.jdom2.Element model, RosterEntry rosterEntry, CvTableModel cvModel) -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddOutputElements(List<org.jdom2.Element> input, List<org.jdom2.Element> accumulate) Adds a list of "output" or "outputs" elements to an existing list.(package private) voidAdds the Row Move buttons at top and bottom.(package private) voidconfigOutputs(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.voiddispose()Clean up at end.(package private) voidloadModelAttributes(org.jdom2.Element model) Use the "model" element from the decoder definition file to fetch attributes relevant to building this function map.(package private) voidloadSplitLabel(int item, String theLabel) Splits a label as per documentation atFnMapPanelESU.(package private) voidmoveRow(int increment) Moves rows up or down.(package private) voidparseLoadLabel(int item, String name, String label) Loads labels as per documentation atFnMapPanelESU.(package private) intAssigns a priority value to a specified state.(package private) voidsaveAt(int row, int column, JComponent j) Saves an item at the specified row and column.(package private) voidSet up the default names and labels.(package private) voidUpdates all summary lines, including setting appropriate states.(package private) voidupdateSummaryLine(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, updateUIMethods 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, updateMethods 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, 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, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
firstCol
int firstCol -
firstOut
int firstOut -
currentCol
int currentCol -
HINTS_ROW
- See Also:
-
MOVE_ARROWS_TOP_ROW
- See Also:
-
BLOCK_NAME_ROW
- See Also:
-
FIRST_ROW
- See Also:
-
ROW_LABEL_ROW
- See Also:
-
currentRow
int currentRow -
PI_CV
- See Also:
-
SI_START_CV
- See Also:
-
SI_CV_MODULUS
- See Also:
-
START_CV
- See Also:
-
CV_PAGE_MODULUS
- See Also:
-
BIT_MODULUS
- See Also:
-
gl
-
cs
-
varModel
-
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
-
maxItems
int maxItems -
itemDescESU
-
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
-
itemIsUsed
boolean[] itemIsUsed -
iVarIndex
int[][] iVarIndex -
extFnsESU
-
numItems
int numItems -
numFns
int numFns -
numRows
int numRows -
numOuts
int numOuts -
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
-
-
Constructor Details
-
FnMapPanelESU
public FnMapPanelESU(VariableTableModel v, List<Integer> varsUsed, org.jdom2.Element model, RosterEntry rosterEntry, CvTableModel cvModel)
-
-
Method Details
-
setupDefaultNamesLabels
void setupDefaultNamesLabels()Set up the default names and labels. -
updateAllSummaryLines
void updateAllSummaryLines()Updates all summary lines, including setting appropriate states. -
updateSummaryLine
Updates a summary line at the specified location, including setting appropriate state.- Parameters:
row- the row to updateblock- the block to update
-
priorityValue
Assigns a priority value to a specified state.- Parameters:
state- the state- Returns:
- the assigned priority value
-
saveAt
Saves an item at the specified row and column.- Parameters:
row- the rowcolumn- the columnj- the item
-
moveRow
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
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
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
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
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
Splits a label as per documentation atFnMapPanelESU.- Parameters:
item- the item number to loadtheLabel- the label attribute from the "output" element
-
dispose
Clean up at end.
-