Class VariableTableModel
- All Implemented Interfaces:
ActionListener,PropertyChangeListener,Serializable,EventListener,TableModel
- See Also:
-
Field Summary
FieldsFields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
ConstructorsConstructorDescriptionVariableTableModel(JLabel status, String[] h, CvTableModel cvModel) Define the columns. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbooleanCheck for change to values, etc, hence rewriting the decoder is desirable.voiddispose()booleanRepresents any change to values, etc, hence rewriting the file is desirable.Returns the (first) variable that matches a given name string.intfindVarIndex(String name) Returns the index of the first variable that matches a given name string.intfindVarIndex(String name, boolean searchFromEnd) Returns the index of a variable that matches a given name string.Class<?>getColumnClass(int col) intgetColumnName(int col) getCvName(int row) getItem(int row) getLabel(int row) intgetState(int row) getValString(int row) getValueAt(int row, int col) getVariable(int row) protected voidhandleCompositeValChildren(org.jdom2.Element e, CompositeVariableValue var) Recursively walk the child compositeChoice elements, working through the compositeChoiceGroup elements as needed.protected voidhandleEnumValChildren(org.jdom2.Element e, EnumVariableValue var) Recursively walk the child enumChoice elements, working through the enumChoiceGroup elements as needed.protected voidhandleSplitEnumValChildren(org.jdom2.Element e, SplitEnumVariableValue var) Recursively walk the child enumChoice elements, working through the enumChoiceGroup elements as needed.booleanisCellEditable(int row, int col) voidnewDecVariableValue(String name, String CV, String comment, String mask, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly) Programmatically create a new DecVariableValue from parameters.protected VariableValueprocessCompositeVal(org.jdom2.Element child, String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item) protected VariableValueprocessDecVal(org.jdom2.Element child, String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item) protected VariableValueprocessEnumVal(org.jdom2.Element child, String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item) protected VariableValueprocessHexVal(org.jdom2.Element child, String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item) protected VariableValueprocessLongAddressVal(String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) protected voidprocessModifierElements(org.jdom2.Element e, VariableValue variable) If there are any modifier elements, process them by e.g. setting attributes on the VariableValue.protected VariableValueprocessShortAddressVal(String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item, org.jdom2.Element child) protected VariableValueprocessSpeedTableVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) protected VariableValueprocessSplitDateTimeVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) protected VariableValueprocessSplitEnumVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) protected VariableValueprocessSplitHexVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) protected VariableValueprocessSplitHundredsVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) protected VariableValueprocessSplitTextVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) protected VariableValueprocessSplitVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) voidvoidread(int i) Command reading of a particular variable.(package private) voidreportBogus(org.jdom2.Element elem) voidprotected voidsetButtonsReadWrite(boolean readOnly, boolean infoOnly, boolean writeOnly, JButton bw, JButton br, int row) voidsetConstant(org.jdom2.Element e) Configure from a constant.(package private) booleansetDefaultValue(org.jdom2.Element e, VariableValue variable) If there's a "default" attribute, or matching defaultItem element, set that value to start.voidsetFileDirty(boolean b) voidsetIntValue(int row, int val) voidsetRow(int row, org.jdom2.Element e) Load one row in the VariableTableModel, by reading in the Element containing its definition.voidsetRow(int row, org.jdom2.Element e, DecoderFile df) Load one row in the VariableTableModel, by reading in the Element containing its definition.voidsetState(int row, AbstractValue.ValueState val) protected voidsetToolTip(org.jdom2.Element e, VariableValue v) voidsetValueAt(Object value, int row, int col) voidwrite(int i) Command writing of a particular variable.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Field Details
-
_df
-
-
Constructor Details
-
VariableTableModel
Define the columns.Values understood are: "Name", "Value", "Range", "Read", "Write", "Comment", "CV", "Mask", "State".
For each, a property key in SymbolicProgBundle by the same name allows i18n.
- Parameters:
status- variable status.h- values headers array.cvModel- cv table model to use.
-
-
Method Details
-
getRowCount
- Specified by:
getRowCountin interfaceTableModel
-
getColumnCount
- Specified by:
getColumnCountin interfaceTableModel
-
getColumnName
- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel
-
getColumnClass
- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel
-
isCellEditable
- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel
-
getVariable
-
getLabel
-
getItem
-
getCvName
-
getValString
-
setIntValue
-
setState
-
getState
-
getRep
-
getValueAt
- Specified by:
getValueAtin interfaceTableModel
-
setValueAt
- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel
-
setRow
Load one row in the VariableTableModel, by reading in the Element containing its definition.Note that this method does not pass a reference to a
DecoderFileinstance, hence include/exclude processing at the sub-variable level is not possible and will be ignored.Use of
setRow(int row, Element e, DecoderFile df)is preferred.- Parameters:
row- number of row to fille- Element of type "variable"
-
setRow
Load one row in the VariableTableModel, by reading in the Element containing its definition.Invoked from
DecoderFile- Parameters:
row- number of row to fille- Element of type "variable"df- the sourceDecoderFileinstance (needed for include/exclude processing at the sub-variable level)
-
processModifierElements
If there are any modifier elements, process them by e.g. setting attributes on the VariableValue.- Parameters:
e- Element that's source of infovariable- Variable to load
-
setDefaultValue
If there's a "default" attribute, or matching defaultItem element, set that value to start.- Parameters:
e- Element that's source of infovariable- Variable to load- Returns:
- true if the value was set
-
processCompositeVal
protected VariableValue processCompositeVal(org.jdom2.Element child, String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item) -
handleCompositeValChildren
Recursively walk the child compositeChoice elements, working through the compositeChoiceGroup elements as needed.Adapted from handleEnumValChildren for use in LocoIO Legacy tool.
- Parameters:
e- Element that's source of infovar- Variable to load
-
processDecVal
protected VariableValue processDecVal(org.jdom2.Element child, String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
processEnumVal
protected VariableValue processEnumVal(org.jdom2.Element child, String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
processSplitEnumVal
protected VariableValue processSplitEnumVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
handleSplitEnumValChildren
Recursively walk the child enumChoice elements, working through the enumChoiceGroup elements as needed.- Parameters:
e- Element that's source of infovar- Variable to load
-
handleEnumValChildren
Recursively walk the child enumChoice elements, working through the enumChoiceGroup elements as needed.- Parameters:
e- Element that's source of infovar- Variable to load
-
processHexVal
protected VariableValue processHexVal(org.jdom2.Element child, String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
processLongAddressVal
protected VariableValue processLongAddressVal(String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) -
processShortAddressVal
protected VariableValue processShortAddressVal(String name, String comment, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String CV, String mask, String item, org.jdom2.Element child) -
processSpeedTableVal
protected VariableValue processSpeedTableVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
processSplitVal
protected VariableValue processSplitVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
processSplitHexVal
protected VariableValue processSplitHexVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
processSplitHundredsVal
protected VariableValue processSplitHundredsVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
processSplitTextVal
protected VariableValue processSplitTextVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
processSplitDateTimeVal
protected VariableValue processSplitDateTimeVal(org.jdom2.Element child, String CV, boolean readOnly, boolean infoOnly, boolean writeOnly, String name, String comment, boolean opsOnly, String mask, String item) throws NumberFormatException - Throws:
NumberFormatException
-
setButtonsReadWrite
protected void setButtonsReadWrite(boolean readOnly, boolean infoOnly, boolean writeOnly, JButton bw, JButton br, int row) -
setButtonModeFromProgrammer
-
setToolTip
-
reportBogus
-
setConstant
Configure from a constant. This is like setRow (which processes a variable Element).- Parameters:
e- element to set.
-
newDecVariableValue
public void newDecVariableValue(String name, String CV, String comment, String mask, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly) Programmatically create a new DecVariableValue from parameters.- Parameters:
name- variable name.CV- CV string.comment- variable comment.mask- CV mask.readOnly- true if read only, else false.infoOnly- true if information only, else false.writeOnly- true if write only, else false.opsOnly- true if ops only, else false.
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
read
Command reading of a particular variable.- Parameters:
i- row number
-
write
Command writing of a particular variable.- Parameters:
i- row number
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
configDone
-
fileDirty
Represents any change to values, etc, hence rewriting the file is desirable.- Returns:
- true if dirty, else false.
-
setFileDirty
-
decoderDirty
Check for change to values, etc, hence rewriting the decoder is desirable.- Returns:
- true if dirty, else false.
-
findVar
Returns the (first) variable that matches a given name string.Searches first for "item", the true name, but if none found will attempt to find a matching "label". In that case, only the default language is checked.
- Parameters:
name- search string.- Returns:
- first matching variable found.
-
findVarIndex
Returns the index of the first variable that matches a given name string.Checks the search string against every variable's "item", the true name, then against their "label" (default language only) and finally the CV name before moving on to the next variable if none of those match.
- Parameters:
name- search string.- Returns:
- index of the first matching variable found.
-
findVarIndex
Returns the index of a variable that matches a given name string.Checks the search string against every variable's "item", the true name, then against their "label" (default language only) and finally the CV name before moving on to the next variable if none of those match. Depending on the second parameter, it will return the index of the first or last variable in our internal rowVector that matches the given string.
- Parameters:
name- search string.searchFromEnd- If true, will start searching from the end.- Returns:
- index of the first matching variable found.
-
dispose
-