jmri.jmrix.can.cbus.swing.eventtable
Class CbusEventTableDataModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jmri.jmrix.can.cbus.swing.eventtable.CbusEventTableDataModel
All Implemented Interfaces:
Serializable, EventListener, TableModel, AbstractMRListener, CanListener

public class CbusEventTableDataModel
extends AbstractTableModel
implements CanListener

Table data model for display of Cbus events

Author:
Andrew Crosland (C) 2009
See Also:
Serialized Form

Field Summary
static int COMMENTCOLUMN
           
static int EVENTCOLUMN
           
static int IDCOLUMN
           
static int NAMECOLUMN
           
static int NODECOLUMN
           
static int NUMCOLUMN
           
static int TYPECOLUMN
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Method Summary
 void addEvent()
          Register new event
 void configureTable(JTable eventTable)
          Configure a table to have our standard rows and columns.
 void dispose()
           
 Class<?> getColumnClass(int col)
           
 int getColumnCount()
           
 String getColumnName(int col)
           
 int getColumnWidth(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 message(CanMessage m)
          *** Capture node and event and add to table
protected  void printColumns(HardcopyWriter w, String[] columnStrings, int[] columnWidth)
           
 void printTable(HardcopyWriter w)
          Method to self print or print preview the table.
 void reply(CanReply m)
          *** Capture node and event and add to table
 void saveAsTable()
          Method to self save as a .csv file, first prompting for a filename
 void saveTable()
          Method to self save as a .csv file
 void setValueAt(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDCOLUMN

public static final int IDCOLUMN
See Also:
Constant Field Values

NODECOLUMN

public static final int NODECOLUMN
See Also:
Constant Field Values

NAMECOLUMN

public static final int NAMECOLUMN
See Also:
Constant Field Values

EVENTCOLUMN

public static final int EVENTCOLUMN
See Also:
Constant Field Values

TYPECOLUMN

public static final int TYPECOLUMN
See Also:
Constant Field Values

COMMENTCOLUMN

public static final int COMMENTCOLUMN
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.

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

getColumnWidth

public int getColumnWidth(int col)

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 eventTable)
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:
eventTable -

message

public void message(CanMessage m)
*** Capture node and event and add to table

Specified by:
message in interface CanListener

reply

public void reply(CanReply m)
*** Capture node and event and add to table

Specified by:
reply in interface CanListener

addEvent

public void addEvent()
Register new event


dispose

public void dispose()

saveTable

public void saveTable()
Method to self save as a .csv file


saveAsTable

public void saveAsTable()
Method to self save as a .csv file, first prompting for a filename


printTable

public void printTable(HardcopyWriter w)
Method to self print or print preview the table. Copied from BeanTableDataModel modified to print variable column widths. Final column with size zero runs to extent of page width Printed with headings and vertical lines between each column. Data is word wrapped within a column. Can handle data as strings, integers, comboboxes or booleans


printColumns

protected void printColumns(HardcopyWriter w,
                            String[] columnStrings,
                            int[] columnWidth)


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