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 intADDRESSCOLUMN(package private) java.util.Vector<java.lang.String>addressesstatic intDETAILCOLUMN(package private) java.util.Vector<java.lang.String>details(package private) static java.lang.BooleanFalse(package private) java.util.Vector<java.lang.String>keysstatic intMONITORBUTTONCOLUMNstatic intNUMCOLUMN(package private) DataSourcesource(package private) static java.lang.BooleanTruestatic intTYPECOLUMN(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 voidasciiFormattedMessage(java.lang.String m)voidconfigureTable(javax.swing.JTable slotTable)Configure a table to have our standard rows and columns.voiddispose()java.lang.Class<?>getColumnClass(int col)intgetColumnCount()java.lang.StringgetColumnName(int col)(package private) java.lang.StringgetDetails(java.lang.String s)Find the message arguments (3rd column) from the current input line.(package private) java.lang.StringgetKey(java.lang.String s)Find the display key from the current input line.intgetPreferredWidth(int col)(package private) java.lang.StringgetPrefix(java.lang.String s)Find the address (1st column) from the current input lineintgetRowCount()Returns the number of rows to be displayed.(package private) java.lang.StringgetType(java.lang.String s)Find the message type (2nd column) from the current input line.java.lang.ObjectgetValueAt(int row, int col)booleanisCellEditable(int row, int col)voidreset()(package private) voidsetColumnToHoldButton(javax.swing.JTable slotTable, int column)voidsetSource(DataSource d)voidsetValueAt(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:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classjavax.swing.table.AbstractTableModel
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein 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:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin 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
-
-