Package jmri.jmrit.roster
Class UpdateDecoderDefinitionAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- jmri.util.swing.JmriAbstractAction
-
- jmri.jmrit.roster.UpdateDecoderDefinitionAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
public class UpdateDecoderDefinitionAction extends JmriAbstractAction
Update the decoder definitions in the roster.
When required, provides a user GUI to assist with replacing multiple-match definitions.- See Also:
XmlFile
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) javax.swing.JButton
cancelButton
(package private) CombinedLocoSelTreePane
combinedLocoSelTree
(package private) int
cV7Value
(package private) int
cV8Value
(package private) DecoderIndexFile
di
(package private) javax.swing.JDialog
f
(package private) java.awt.event.FocusListener
fListener
(package private) boolean
hasReplacementFamilyQuery
(package private) boolean
hasReplacementModelQuery
(package private) javax.swing.JLabel
lastActionDisplay
Displays the last-selected filter action.(package private) ProgModeSelector
modePane
static java.lang.String
QRY_PREFIX
The prefix string used to specify a query in decoder definition file replacementFamily and replacementModel elements.static java.lang.String
QRY_SEPARATOR
Theregex
separator tosplit
items in replacementFamily and replacementModel elements.(package private) javax.swing.JToggleButton
replacementButton
(package private) java.lang.String
replacementFamily
ThereplacementFamily
attribute from the decoder definition file.(package private) java.lang.String
replacementFamilyString
(package private) java.util.List<DecoderFile>
replacementList
AList
based on the combination of any replacementFamily and replacementModel suggestions.(package private) java.lang.String
replacementModel
ThereplacementModel
attribute from the decoder definition file.(package private) java.lang.String
replacementModelString
(package private) javax.swing.JLabel
statusLabel
(package private) RosterEntry
tempRe
A temporary roster entry used in matching and replacement.(package private) javax.swing.JToggleButton
versionButton
(package private) java.util.List<DecoderFile>
versionMatchList
The subset of thereplacementList
that also matches both theIdentifyDecoder
manufacturerID stored in CV8 and theIdentifyDecoder
versionID stored in CV7.-
Fields inherited from class jmri.util.swing.JmriAbstractAction
context, hint, wi
-
-
Constructor Summary
Constructors Constructor Description UpdateDecoderDefinitionAction(java.lang.String name)
Update the decoder definitions in the roster.UpdateDecoderDefinitionAction(java.lang.String name, javax.swing.Icon i, WindowInterface wi)
Update the decoder definitions in the roster.UpdateDecoderDefinitionAction(java.lang.String name, WindowInterface wi)
Update the decoder definitions in the roster.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
(package private) void
decoderSelectionPane(RosterEntry theEntry)
Creates the "Replacement Definition" pane, which is similar in appearance toCreate New Loco
pane, likewise utilizing a customized instance ofCombinedLocoSelTreePane
.(package private) javax.swing.JOptionPane
getOptionPane(javax.swing.JComponent source)
Fetch theJOptionPane
associated with thisJComponent
.(package private) void
makeMatchLists(RosterEntry theEntry)
Creates twoArrayLists
for decoder matching.JmriPanel
makePanel()
Never invoked, because we overrode actionPerformed above.(package private) int
multiReplacementDialog(java.lang.String text, boolean missing)
Creates the "Multiple Replacements Found" dialog box with custom buttons and tooltips.(package private) void
setLastActionDisplay(java.lang.String propertyName)
Updates thelastActionDisplay
JLabel
to be the text fetched by the key named "TextLastAction
", after inclusion of the text fetched by the key named "propertyName
".(package private) void
updateMatchButtons(RosterEntry theEntry)
Updates theversionButton
andreplacementButton
availability and tooltips, depending on whetherversionMatchList
andreplacementList
are empty or not.-
Methods inherited from class jmri.util.swing.JmriAbstractAction
dispose, setContext, setHint, setName, setParameter, setParameter, setWindowInterface, toString
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
QRY_PREFIX
public static final java.lang.String QRY_PREFIX
The prefix string used to specify a query in decoder definition file replacementFamily and replacementModel elements.- See Also:
- Constant Field Values
-
QRY_SEPARATOR
public static final java.lang.String QRY_SEPARATOR
Theregex
separator tosplit
items in replacementFamily and replacementModel elements.- See Also:
- Constant Field Values
-
replacementFamily
java.lang.String replacementFamily
ThereplacementFamily
attribute from the decoder definition file.
-
replacementFamilyString
java.lang.String replacementFamilyString
-
hasReplacementFamilyQuery
boolean hasReplacementFamilyQuery
-
replacementModel
java.lang.String replacementModel
ThereplacementModel
attribute from the decoder definition file.
-
replacementModelString
java.lang.String replacementModelString
-
hasReplacementModelQuery
boolean hasReplacementModelQuery
-
cV7Value
int cV7Value
-
cV8Value
int cV8Value
-
lastActionDisplay
javax.swing.JLabel lastActionDisplay
Displays the last-selected filter action.
-
tempRe
transient volatile RosterEntry tempRe
A temporary roster entry used in matching and replacement.
-
replacementList
transient volatile java.util.List<DecoderFile> replacementList
AList
based on the combination of any replacementFamily and replacementModel suggestions.
-
versionMatchList
transient volatile java.util.List<DecoderFile> versionMatchList
The subset of thereplacementList
that also matches both theIdentifyDecoder
manufacturerID stored in CV8 and theIdentifyDecoder
versionID stored in CV7.
-
di
transient volatile DecoderIndexFile di
-
fListener
transient volatile java.awt.event.FocusListener fListener
-
statusLabel
transient volatile javax.swing.JLabel statusLabel
-
f
transient volatile javax.swing.JDialog f
-
modePane
final ProgModeSelector modePane
-
cancelButton
javax.swing.JButton cancelButton
-
versionButton
javax.swing.JToggleButton versionButton
-
replacementButton
javax.swing.JToggleButton replacementButton
-
combinedLocoSelTree
CombinedLocoSelTreePane combinedLocoSelTree
-
-
Constructor Detail
-
UpdateDecoderDefinitionAction
public UpdateDecoderDefinitionAction(java.lang.String name)
Update the decoder definitions in the roster.- Parameters:
name
- the name (Action.NAME
) for the action; a value ofnull
is ignored
-
UpdateDecoderDefinitionAction
public UpdateDecoderDefinitionAction(java.lang.String name, WindowInterface wi)
Update the decoder definitions in the roster.- Parameters:
name
- the name (Action.NAME
) for the action; a value ofnull
is ignoredwi
- the window interface controlling how this action is displayed
-
UpdateDecoderDefinitionAction
public UpdateDecoderDefinitionAction(java.lang.String name, javax.swing.Icon i, WindowInterface wi)
Update the decoder definitions in the roster.- Parameters:
name
- the name (Action.NAME
) for the action; a value ofnull
is ignoredi
- the small icon (Action.SMALL_ICON
) for the action; a value ofnull
is ignoredwi
- the window interface controlling how this action is displayed
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Overrides:
actionPerformed
in classJmriAbstractAction
-
getOptionPane
javax.swing.JOptionPane getOptionPane(javax.swing.JComponent source)
Fetch theJOptionPane
associated with thisJComponent
.
Note that:- The
source
must be within (or itself be) aJOptionPane
. - If
source
is aJOptionPane
, the returned element will besource
- Parameters:
source
- theJComponent
- Returns:
- the
JOptionPane
associated withsource
- The
-
multiReplacementDialog
int multiReplacementDialog(java.lang.String text, boolean missing)
Creates the "Multiple Replacements Found" dialog box with custom buttons and tooltips.- Parameters:
text
- the explanatory text to displaymissing
- if true, displays a "missing definition" title rather than a "multiple replacements" title- Returns:
- sequence number of the button selected
-
decoderSelectionPane
void decoderSelectionPane(RosterEntry theEntry)
Creates the "Replacement Definition" pane, which is similar in appearance toCreate New Loco
pane, likewise utilizing a customized instance ofCombinedLocoSelTreePane
.- Parameters:
theEntry
- an existing roster entry that needs replacement
-
setLastActionDisplay
void setLastActionDisplay(java.lang.String propertyName)
Updates thelastActionDisplay
JLabel
to be the text fetched by the key named "TextLastAction
", after inclusion of the text fetched by the key named "propertyName
".- Parameters:
propertyName
- the name of aResourceBundle
key
-
makeMatchLists
void makeMatchLists(RosterEntry theEntry)
Creates twoArrayLists
for decoder matching.
They are:-
A
replacementList
based on the combination of anyreplacementFamily
andreplacementModel
suggestions. -
A
versionMatchList
that is the subset ofreplacementList
that also matches both a manufacturerID (fromIdentifyDecoder
mfgID) stored in CV8 and a versionID (fromIdentifyDecoder
modelID) stored in CV7.
- Parameters:
theEntry
- an existing roster entry that needs replacement
-
A
-
updateMatchButtons
void updateMatchButtons(RosterEntry theEntry)
Updates theversionButton
andreplacementButton
availability and tooltips, depending on whetherversionMatchList
andreplacementList
are empty or not.- Parameters:
theEntry
- an existing roster entry that needs replacement
-
makePanel
public JmriPanel makePanel()
Never invoked, because we overrode actionPerformed above.- Specified by:
makePanel
in classJmriAbstractAction
- Returns:
- never because it deliberately throws an
IllegalArgumentException
-
-