Class FunctionTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
jmri.jmrit.roster.swing.functiontable.FunctionTableModel
- All Implemented Interfaces:
PropertyChangeListener,Serializable,EventListener,TableModel
A TableModel that provides a way for the user to edit details of functions of a decoder in the roster.
It is used in the FunctionLabelPane.
This file is part of JMRI.
This file is part of JMRI.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final intstatic final intFields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new FunctionTableModel for a COPY of the given RosterEntry, -
Method Summary
Modifier and TypeMethodDescriptionClass<?>getColumnClass(int columnIndex) intgetColumnName(int columnIndex) intgetFnForRow(int rowIndex) Return the function number for a row index.getFunctionImagePanel(int fn) Return the EditableResizableImagePanel for the function image (off) for a function number.getFunctionSelectedImagePanel(int fn) Return the EditableResizableImagePanel for the function image (on) for a function number.getLabel(int fn) Return the function label for a function numberReturn list of all function label ordered by function numberbooleangetLockable(int fn) Return the function lockable flag for a function numberReturns the RosterEntry being edited by that table modelgetRosterFunctionEntryAtRow(int row) intintgetRowForFn(int fn) Return the row index for a function number.getValueAt(int rowIndex, int columnIndex) Return the function visibility order attribute string to be stored in the RosterEntry.booleanisCellEditable(int rowIndex, int columnIndex) voidmoveRow(int from, int to) Move one row from first ndex to second index.voidvoidreset(RosterFunctionEntry[] fnEntries, String shuntFn, String fnDisplayOrder) Reset the FunctionTableModel from the given inputsvoidSet the function label for a function numbervoidsetLockable(int fn, boolean lockable) Set a function lockable flag for a function numbervoidUpdate the FunctionTableModel with a COPY of the given RosterEntry,voidsetRosterFunctionEntryAtRow(RosterFunctionEntry rfe, int rowIndex) voidsetValueAt(Object value, int rowIndex, int columnIndex) Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Field Details
-
FB_ORDER_ATTR
- See Also:
-
COL_FN
- See Also:
-
COL_LK
- See Also:
-
COL_OF
- See Also:
-
COL_ON
- See Also:
-
COL_VI
- See Also:
-
COL_SH
- See Also:
-
COL_LA
- See Also:
-
NBCOL
- See Also:
-
NBVISCOL
- See Also:
-
COL_DO
- See Also:
-
-
Constructor Details
-
FunctionTableModel
Create a new FunctionTableModel for a COPY of the given RosterEntry,- Parameters:
re- the RosterEntry on which to base this model. A copy of the RosterEntry is made so that changes to the model do not affect the original RosterEntry.
-
-
Method Details
-
setRosterEntry
Update the FunctionTableModel with a COPY of the given RosterEntry,- Parameters:
re- the RosterEntry on which to base this model. A copy of the RosterEntry is made so that changes to the model do not affect the original RosterEntry.
-
reset
Reset the FunctionTableModel from the given inputs- Parameters:
fnEntries- an array of RosterFunctionEntryshuntFn- the shunting function string, if any, or nullfnDisplayOrder- the function display order JSON array, if any, or null
-
getRosterFunctionEntryAtRow
-
setRosterFunctionEntryAtRow
-
getFunctionImagePanel
Return the EditableResizableImagePanel for the function image (off) for a function number.- Parameters:
fn- the function number- Returns:
- the EditableResizableImagePanel
-
getFunctionSelectedImagePanel
Return the EditableResizableImagePanel for the function image (on) for a function number.- Parameters:
fn- the function number- Returns:
- the EditableResizableImagePanel
-
getFnForRow
Return the function number for a row index.- Parameters:
rowIndex- the row index- Returns:
- the function number, -1 if out of bounds
-
getRowForFn
Return the row index for a function number.- Parameters:
fn- the function number- Returns:
- the row index, -1 if out of bounds
-
moveRow
Move one row from first ndex to second index. Lines between the two indexes are shifted up or down to make room for the moved line.- Parameters:
from- moving from this indexto- moving to this index
-
getVisibilityOrderAttributeString
Return the function visibility order attribute string to be stored in the RosterEntry. This is a JSON string representing the rowFn array, or null if the order is the default order (i.e. rowFn[i] == i for all i). At index i is the function number of the function to be shown at that position in the GUI (Throttle for instance).. The function number is the index in the RosterEntry function list.- Returns:
- the attriute string to be stored in the RosterEntry, or null if not needed
-
getRowCount
- Specified by:
getRowCountin interfaceTableModel
-
getColumnCount
- Specified by:
getColumnCountin interfaceTableModel
-
getColumnClass
- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel
-
getValueAt
- Specified by:
getValueAtin interfaceTableModel
-
isCellEditable
- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel
-
setValueAt
- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel
-
getColumnName
- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel
-
getLabels
Return list of all function label ordered by function number- Returns:
- a list of String
-
getLabel
Return the function label for a function number- Parameters:
fn- the function number- Returns:
- a list of String
-
setLabel
Set the function label for a function number- Parameters:
fn- the function numberlabel- the label to set
-
getLockable
Return the function lockable flag for a function number- Parameters:
fn- the function number- Returns:
- the lockable flag
-
setLockable
Set a function lockable flag for a function number- Parameters:
fn- the function numberlockable- the lockable flag to set
-
getRosterEntry
Returns the RosterEntry being edited by that table model- Returns:
- the RosterEntry being edited by that table model
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-