Class CarsTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.operations.rollingstock.cars.CarsTableModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
public class CarsTableModel extends javax.swing.table.AbstractTableModel implements java.beans.PropertyChangeListener
Table Model for edit of cars used by operations- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) CarsTableFrame
_frame
(package private) int
_index
(package private) java.lang.String
_roadNumber
(package private) javax.swing.JTable
_table
(package private) java.util.List<Car>
carList
(package private) CarManager
carManager
(package private) CarEditFrame
cef
(package private) CarSetFrame
csf
java.lang.String
locationName
(package private) boolean
showAllCars
int
SORTBY_BUILT
int
SORTBY_COLOR
int
SORTBY_COMMENT
int
SORTBY_DESTINATION
int
SORTBY_DIVISION
int
SORTBY_FINALDESTINATION
int
SORTBY_KERNEL
int
SORTBY_LAST
int
SORTBY_LOAD
int
SORTBY_LOCATION
int
SORTBY_MOVES
int
SORTBY_NUMBER
int
SORTBY_OWNER
int
SORTBY_PICKUP
int
SORTBY_RFID
int
SORTBY_ROAD
int
SORTBY_ROUTE
int
SORTBY_RWE
int
SORTBY_RWL
int
SORTBY_TRAIN
int
SORTBY_TYPE
int
SORTBY_VALUE
int
SORTBY_WAIT
java.lang.String
trackName
-
Constructor Summary
Constructors Constructor Description CarsTableModel(boolean showAllCars, java.lang.String locationName, java.lang.String trackName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
int
findCarByRoadNumber(java.lang.String roadNumber)
Search for car by road numberCar
getCarAtIndex(int index)
java.util.List<Car>
getCarList(int sort)
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
java.lang.String
getColumnName(int col)
int
getRowCount()
java.util.List<Car>
getSelectedCarList()
java.lang.String
getSortByName()
java.lang.String
getSortByName(int sort)
java.lang.Object
getValueAt(int row, int col)
(package private) void
initTable()
(package private) void
initTable(javax.swing.JTable table, CarsTableFrame frame)
boolean
isCellEditable(int row, int col)
void
propertyChange(java.beans.PropertyChangeEvent e)
void
resetCheckboxes()
void
setSort(int sort)
Not all columns in the Cars table are shown.void
setValueAt(java.lang.Object value, int row, int col)
void
toggleSelectVisible()
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
carManager
CarManager carManager
-
SORTBY_NUMBER
public final int SORTBY_NUMBER
- See Also:
- Constant Field Values
-
SORTBY_ROAD
public final int SORTBY_ROAD
- See Also:
- Constant Field Values
-
SORTBY_TYPE
public final int SORTBY_TYPE
- See Also:
- Constant Field Values
-
SORTBY_LOCATION
public final int SORTBY_LOCATION
- See Also:
- Constant Field Values
-
SORTBY_DESTINATION
public final int SORTBY_DESTINATION
- See Also:
- Constant Field Values
-
SORTBY_TRAIN
public final int SORTBY_TRAIN
- See Also:
- Constant Field Values
-
SORTBY_MOVES
public final int SORTBY_MOVES
- See Also:
- Constant Field Values
-
SORTBY_KERNEL
public final int SORTBY_KERNEL
- See Also:
- Constant Field Values
-
SORTBY_LOAD
public final int SORTBY_LOAD
- See Also:
- Constant Field Values
-
SORTBY_COLOR
public final int SORTBY_COLOR
- See Also:
- Constant Field Values
-
SORTBY_BUILT
public final int SORTBY_BUILT
- See Also:
- Constant Field Values
-
SORTBY_OWNER
public final int SORTBY_OWNER
- See Also:
- Constant Field Values
-
SORTBY_RFID
public final int SORTBY_RFID
- See Also:
- Constant Field Values
-
SORTBY_RWE
public final int SORTBY_RWE
- See Also:
- Constant Field Values
-
SORTBY_RWL
public final int SORTBY_RWL
- See Also:
- Constant Field Values
-
SORTBY_ROUTE
public final int SORTBY_ROUTE
- See Also:
- Constant Field Values
-
SORTBY_DIVISION
public final int SORTBY_DIVISION
- See Also:
- Constant Field Values
-
SORTBY_FINALDESTINATION
public final int SORTBY_FINALDESTINATION
- See Also:
- Constant Field Values
-
SORTBY_VALUE
public final int SORTBY_VALUE
- See Also:
- Constant Field Values
-
SORTBY_WAIT
public final int SORTBY_WAIT
- See Also:
- Constant Field Values
-
SORTBY_PICKUP
public final int SORTBY_PICKUP
- See Also:
- Constant Field Values
-
SORTBY_LAST
public final int SORTBY_LAST
- See Also:
- Constant Field Values
-
SORTBY_COMMENT
public final int SORTBY_COMMENT
- See Also:
- Constant Field Values
-
showAllCars
boolean showAllCars
-
locationName
public java.lang.String locationName
-
trackName
public java.lang.String trackName
-
_table
javax.swing.JTable _table
-
_frame
CarsTableFrame _frame
-
_roadNumber
java.lang.String _roadNumber
-
_index
int _index
-
cef
CarEditFrame cef
-
csf
CarSetFrame csf
-
-
Constructor Detail
-
CarsTableModel
public CarsTableModel(boolean showAllCars, java.lang.String locationName, java.lang.String trackName)
-
-
Method Detail
-
setSort
public void setSort(int sort)
Not all columns in the Cars table are shown. This was done to limit the width of the table. Only one column from the following groups is shown at any one time.Load, Color, and RWE Load are grouped together.
Destination, Final Destination, and RWE Destination are grouped together.
Moves, Built, Owner, Value, RFID, Wait, Pickup, and Last are grouped together.
- Parameters:
sort
- The integer sort to use.
-
getSortByName
public java.lang.String getSortByName()
-
getSortByName
public java.lang.String getSortByName(int sort)
-
toggleSelectVisible
public void toggleSelectVisible()
-
resetCheckboxes
public void resetCheckboxes()
-
findCarByRoadNumber
public int findCarByRoadNumber(java.lang.String roadNumber)
Search for car by road number- Parameters:
roadNumber
- The string road number to search for.- Returns:
- -1 if not found, table row number if found
-
getCarAtIndex
public Car getCarAtIndex(int index)
-
getSelectedCarList
public java.util.List<Car> getSelectedCarList()
-
getCarList
public java.util.List<Car> getCarList(int sort)
-
initTable
void initTable(javax.swing.JTable table, CarsTableFrame frame)
-
initTable
void initTable()
-
getRowCount
public int getRowCount()
- 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
-
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
-
dispose
public void dispose()
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
-