Package jmri.jmrit.roster.swing
Class RosterTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- javax.swing.table.DefaultTableModel
-
- jmri.jmrit.roster.swing.RosterTableModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
public class RosterTableModel extends javax.swing.table.DefaultTableModel implements java.beans.PropertyChangeListener
Table data model for display of Roster variable values.Any desired ordering, etc, is handled outside this class.
The initial implementation doesn't automatically update when roster entries change, doesn't allow updating of the entries, and only shows some of the fields. But it's a start....
- Since:
- 2.7.5
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
ADDRESSCOL
(package private) static int
DATEUPDATECOL
(package private) static int
DECODERCOL
(package private) boolean
editable
(package private) static int
ICONCOL
(package private) RosterIconFactory
iconFactory
static int
IDCOL
(package private) static int
MFGCOL
(package private) static int
MODELCOL
static int
NUMCOL
(package private) static int
OWNERCOL
static int
PROTOCOL
(package private) static int
ROADNAMECOL
(package private) static int
ROADNUMBERCOL
-
Constructor Summary
Constructors Constructor Description RosterTableModel()
RosterTableModel(boolean editable)
RosterTableModel(RosterGroup group)
Create a table model for a Roster group.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
java.lang.String
getColumnName(int col)
(package private) javax.swing.ImageIcon
getIcon(RosterEntry re)
int
getPreferredWidth(int column)
java.lang.String
getRosterGroup()
int
getRowCount()
java.lang.Object
getValueAt(int row, int col)
Provides an empty string for a column if the model returns null for that value.boolean
isCellEditable(int row, int col)
void
propertyChange(java.beans.PropertyChangeEvent e)
void
setRosterGroup(java.lang.String rosterGroup)
void
setValueAt(java.lang.Object value, int row, int col)
-
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getDataVector, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
IDCOL
public static final int IDCOL
- See Also:
- Constant Field Values
-
ADDRESSCOL
static final int ADDRESSCOL
- See Also:
- Constant Field Values
-
ICONCOL
static final int ICONCOL
- See Also:
- Constant Field Values
-
DECODERCOL
static final int DECODERCOL
- See Also:
- Constant Field Values
-
ROADNAMECOL
static final int ROADNAMECOL
- See Also:
- Constant Field Values
-
ROADNUMBERCOL
static final int ROADNUMBERCOL
- See Also:
- Constant Field Values
-
MFGCOL
static final int MFGCOL
- See Also:
- Constant Field Values
-
MODELCOL
static final int MODELCOL
- See Also:
- Constant Field Values
-
OWNERCOL
static final int OWNERCOL
- See Also:
- Constant Field Values
-
DATEUPDATECOL
static final int DATEUPDATECOL
- See Also:
- Constant Field Values
-
PROTOCOL
public static final int PROTOCOL
- See Also:
- Constant Field Values
-
NUMCOL
public static final int NUMCOL
- See Also:
- Constant Field Values
-
editable
boolean editable
-
iconFactory
RosterIconFactory iconFactory
-
-
Constructor Detail
-
RosterTableModel
public RosterTableModel()
-
RosterTableModel
public RosterTableModel(boolean editable)
-
RosterTableModel
public RosterTableModel(@CheckForNull RosterGroup group)
Create a table model for a Roster group.- Parameters:
group
- the roster group to show; if null, behaves the same asRosterTableModel()
-
-
Method Detail
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
- Overrides:
getRowCount
in classjavax.swing.table.DefaultTableModel
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnCount
in classjavax.swing.table.DefaultTableModel
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.DefaultTableModel
-
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)
Note that the table can be set to be non-editable when constructed, in which case this always returns false.
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.DefaultTableModel
- Returns:
- true if cell is editable in roster entry model and table allows editing
-
getIcon
javax.swing.ImageIcon getIcon(RosterEntry re)
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
Provides an empty string for a column if the model returns null for that value.- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
getValueAt
in classjavax.swing.table.DefaultTableModel
-
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.DefaultTableModel
-
getPreferredWidth
public int getPreferredWidth(int column)
-
setRosterGroup
public final void setRosterGroup(java.lang.String rosterGroup)
-
getRosterGroup
public final java.lang.String getRosterGroup()
-
dispose
public void dispose()
-
-