jmri.jmrix.sprog.sprogslotmon
Class SprogSlotMonDataModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jmri.jmrix.sprog.sprogslotmon.SprogSlotMonDataModel
All Implemented Interfaces:
Serializable, EventListener, TableModel, SprogSlotListener

public class SprogSlotMonDataModel
extends AbstractTableModel
implements SprogSlotListener

Table data model for display of slot manager contents

Author:
Bob Jacobsen Copyright (C) 2001 Andrew Crosland (C) 2006 ported to SPROG
See Also:
Serialized Form

Field Summary
static int ADDRCOLUMN
           
static int DIRCOLUMN
           
static int NUMCOLUMN
           
static int SLOTCOLUMN
           
static int SPDCOLUMN
           
static int STATCOLUMN
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Method Summary
 void configureTable(JTable slotTable)
          Configure a table to have our standard rows and columns.
 void dispose()
           
 Class<?> getColumnClass(int col)
           
 int getColumnCount()
           
 String getColumnName(int col)
           
 int getPreferredWidth(int col)
           
 int getRowCount()
          Returns the number of rows to be displayed.
 Object getValueAt(int row, int col)
           
 boolean isCellEditable(int row, int col)
           
 void notifyChangedSlot(SprogSlot s)
           
 void setValueAt(Object value, int row, int col)
           
 void showAllSlots(boolean val)
           
protected  int slotNum(int row)
          Returns slot number for a specific row.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SLOTCOLUMN

public static final int SLOTCOLUMN
See Also:
Constant Field Values

ADDRCOLUMN

public static final int ADDRCOLUMN
See Also:
Constant Field Values

SPDCOLUMN

public static final int SPDCOLUMN
See Also:
Constant Field Values

STATCOLUMN

public static final int STATCOLUMN
See Also:
Constant Field Values

DIRCOLUMN

public static final int DIRCOLUMN
See Also:
Constant Field Values

NUMCOLUMN

public static final int NUMCOLUMN
See Also:
Constant Field Values
Method Detail

getRowCount

public int getRowCount()
Returns the number of rows to be displayed. This can vary depending on whether only active rows are displayed.

This should probably use a local cache instead of counting/searching each time.

Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getColumnName

public String getColumnName(int col)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getColumnClass

public Class<?> getColumnClass(int col)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

getValueAt

public Object getValueAt(int row,
                         int col)
Specified by:
getValueAt in interface TableModel

getPreferredWidth

public int getPreferredWidth(int col)

setValueAt

public void setValueAt(Object value,
                       int row,
                       int col)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

configureTable

public void configureTable(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 -

notifyChangedSlot

public void notifyChangedSlot(SprogSlot s)
Specified by:
notifyChangedSlot in interface SprogSlotListener

showAllSlots

public void showAllSlots(boolean val)

slotNum

protected int slotNum(int row)
Returns slot number for a specific row.

This should probably use a local cache instead of counting/searching each time.

Parameters:
row - Row number in the displayed table

dispose

public void dispose()


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads