Class LocoDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrix.tams.swing.locodatabase.LocoDataModel
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
,AbstractMRListener
,TamsListener
public class LocoDataModel extends javax.swing.table.AbstractTableModel implements TamsListener
Table data model for display the loco database of the Tams MC.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
ADDRCOLUMN
static int
DELCOLUMN
static int
FMTCOLUMN
(package private) java.util.ArrayList<java.lang.String[]>
locolist
(package private) TamsSystemConnectionMemo
memo
static int
NAMECOLUMN
static int
NUMCOLUMN
static int
SPDCOLUMN
-
Constructor Summary
Constructors Constructor Description LocoDataModel(int row, int column, TamsSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addLoco(TamsMessage m)
void
configureTable(javax.swing.JTable slotTable)
Configure a table to have our standard rows and columns.(package private) void
deleteLoco(int row)
void
dispose()
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
java.lang.String
getColumnName(int col)
int
getPreferredWidth(int col)
int
getRowCount()
Returns the number of rows to be displayed.java.lang.Object
getValueAt(int row, int col)
boolean
isCellEditable(int row, int col)
void
message(TamsMessage m)
void
reply(TamsReply r)
(package private) void
setColumnToHoldButton(javax.swing.JTable slotTable, int column)
(package private) void
setColumnToHoldEStopButton(javax.swing.JTable slotTable, int column)
void
setValueAt(java.lang.Object value, int row, int col)
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
ADDRCOLUMN
public static final int ADDRCOLUMN
- See Also:
- Constant Field Values
-
SPDCOLUMN
public static final int SPDCOLUMN
- See Also:
- Constant Field Values
-
FMTCOLUMN
public static final int FMTCOLUMN
- See Also:
- Constant Field Values
-
NAMECOLUMN
public static final int NAMECOLUMN
- See Also:
- Constant Field Values
-
DELCOLUMN
public static final int DELCOLUMN
- See Also:
- Constant Field Values
-
NUMCOLUMN
public static final int NUMCOLUMN
- See Also:
- Constant Field Values
-
locolist
java.util.ArrayList<java.lang.String[]> locolist
-
-
Constructor Detail
-
LocoDataModel
LocoDataModel(int row, int column, TamsSystemConnectionMemo memo)
-
-
Method Detail
-
getRowCount
public int getRowCount()
Returns the number of rows to be displayed. This can vary depending on whether only active rows are displayed, and whether the system slots should be displayed.This should probably use a local cache instead of counting/searching each time.
- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.AbstractTableModel
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.AbstractTableModel
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
-
getPreferredWidth
public int getPreferredWidth(int col)
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classjavax.swing.table.AbstractTableModel
-
deleteLoco
void deleteLoco(int row)
-
configureTable
public void configureTable(javax.swing.JTable slotTable)
Configure a table to have our standard rows and columns. This is optional, in that other table formats can use this table model. But we put it here to help keep it consistent.- Parameters:
slotTable
- the table to configure
-
setColumnToHoldButton
void setColumnToHoldButton(javax.swing.JTable slotTable, int column)
-
setColumnToHoldEStopButton
void setColumnToHoldEStopButton(javax.swing.JTable slotTable, int column)
-
dispose
public void dispose()
-
message
public void message(TamsMessage m)
- Specified by:
message
in interfaceTamsListener
-
reply
public void reply(TamsReply r)
- Specified by:
reply
in interfaceTamsListener
-
addLoco
protected void addLoco(TamsMessage m)
-
-