Package jmri.jmrix.pricom.pockettester
Class PacketDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrix.pricom.pockettester.PacketDataModel
-
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.table.TableModel
public class PacketDataModel extends javax.swing.table.AbstractTableModel
Table data model for display of DCC packet contents- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
ADDRESSCOLUMN
(package private) java.util.Vector<java.lang.String>
addresses
static int
DETAILCOLUMN
(package private) java.util.Vector<java.lang.String>
details
(package private) static java.lang.Boolean
False
(package private) java.util.Vector<java.lang.String>
keys
static int
MONITORBUTTONCOLUMN
static int
NUMCOLUMN
(package private) DataSource
source
(package private) static java.lang.Boolean
True
static int
TYPECOLUMN
(package private) java.util.Vector<java.lang.String>
types
-
Constructor Summary
Constructors Constructor Description PacketDataModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
asciiFormattedMessage(java.lang.String m)
void
configureTable(javax.swing.JTable slotTable)
Configure a table to have our standard rows and columns.void
dispose()
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
java.lang.String
getColumnName(int col)
(package private) java.lang.String
getDetails(java.lang.String s)
Find the message arguments (3rd column) from the current input line.(package private) java.lang.String
getKey(java.lang.String s)
Find the display key from the current input line.int
getPreferredWidth(int col)
(package private) java.lang.String
getPrefix(java.lang.String s)
Find the address (1st column) from the current input lineint
getRowCount()
Returns the number of rows to be displayed.(package private) java.lang.String
getType(java.lang.String s)
Find the message type (2nd column) from the current input line.java.lang.Object
getValueAt(int row, int col)
boolean
isCellEditable(int row, int col)
void
reset()
(package private) void
setColumnToHoldButton(javax.swing.JTable slotTable, int column)
void
setSource(DataSource d)
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
-
ADDRESSCOLUMN
public static final int ADDRESSCOLUMN
- See Also:
- Constant Field Values
-
TYPECOLUMN
public static final int TYPECOLUMN
- See Also:
- Constant Field Values
-
DETAILCOLUMN
public static final int DETAILCOLUMN
- See Also:
- Constant Field Values
-
MONITORBUTTONCOLUMN
public static final int MONITORBUTTONCOLUMN
- See Also:
- Constant Field Values
-
NUMCOLUMN
public static final int NUMCOLUMN
- See Also:
- Constant Field Values
-
True
static final java.lang.Boolean True
-
False
static final java.lang.Boolean False
-
source
DataSource source
-
keys
java.util.Vector<java.lang.String> keys
-
addresses
java.util.Vector<java.lang.String> addresses
-
types
java.util.Vector<java.lang.String> types
-
details
java.util.Vector<java.lang.String> details
-
-
Constructor Detail
-
PacketDataModel
public PacketDataModel()
-
-
Method Detail
-
getRowCount
public int getRowCount()
Returns the number of rows to be displayed. This can vary depending on what has been seen- Returns:
- number of rows
-
getColumnCount
public int getColumnCount()
-
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)
-
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
-
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)
-
dispose
public void dispose()
-
asciiFormattedMessage
public void asciiFormattedMessage(java.lang.String m)
-
setSource
public void setSource(DataSource d)
-
reset
public void reset()
-
getKey
java.lang.String getKey(java.lang.String s)
Find the display key from the current input line. A later input line that maps to the same key will overwrite the earlier line.The current implementation is address+type, so that separate lines will be used for each type sent to the same address.
- Parameters:
s
- Current line of input- Returns:
- null if not to be displayed, e.g. no address
-
getPrefix
java.lang.String getPrefix(java.lang.String s)
Find the address (1st column) from the current input line- Parameters:
s
- Current line of input- Returns:
- address
-
getType
java.lang.String getType(java.lang.String s)
Find the message type (2nd column) from the current input line. Should not be called if getPrefix has returned null.- Parameters:
s
- Current line of input- Returns:
- null if not to be displayed, e.g. too short
-
getDetails
java.lang.String getDetails(java.lang.String s)
Find the message arguments (3rd column) from the current input line. Should not be called if getPrefix has returned null.- Parameters:
s
- Current line of input- Returns:
- null if not to be displayed, e.g. too short
-
-