jmri.jmrit.beantable
Class BeanTableDataModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jmri.jmrit.beantable.BeanTableDataModel
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, TableModel
Direct Known Subclasses:
AudioTableAction.AudioTableDataModel, SensorTableDataModel, SignalMastTableDataModel

public abstract class BeanTableDataModel
extends AbstractTableModel
implements PropertyChangeListener

Table data model for display of NamedBean manager contents

Author:
Bob Jacobsen Copyright (C) 2003, Dennis Miller Copyright (C) 2006
See Also:
Serialized Form

Field Summary
static int COMMENTCOL
           
static int DELETECOL
           
static int NUMCOLUMN
           
static int SYSNAMECOL
           
protected  List<String> sysNameList
           
static int USERNAMECOL
           
static int VALUECOL
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
BeanTableDataModel()
           
 
Method Summary
protected abstract  void clickOn(NamedBean t)
           
protected  void configDeleteColumn(JTable table)
           
 JButton configureButton()
           
 void configureTable(JTable table)
          Configure a table to have our standard rows and columns.
protected  void configValueColumn(JTable table)
           
protected  void deleteBean(int row, int col)
           
 void dispose()
           
protected abstract  String getBeanType()
           
protected abstract  NamedBean getBySystemName(String name)
           
protected abstract  NamedBean getByUserName(String name)
           
 Class<?> getColumnClass(int col)
           
 int getColumnCount()
           
 String getColumnName(int col)
           
 int getDisplayDeleteMsg()
           
protected abstract  Manager getManager()
           
protected abstract  String getMasterClassName()
           
 int getPreferredWidth(int col)
           
 int getRowCount()
           
abstract  String getValue(String systemName)
           
 Object getValueAt(int row, int col)
           
 boolean isCellEditable(int row, int col)
           
protected  JTable makeJTable(TableSorter sorter)
           
protected  boolean matchPropertyName(PropertyChangeEvent e)
          Is this property event announcing a change this table should display?
 void moveBean(int row, int column)
           
protected  void printColumns(HardcopyWriter w, String[] columnStrings, int columnSize)
           
 void printTable(HardcopyWriter w)
          Method to self print or print preview the table.
 void propertyChange(PropertyChangeEvent e)
           
 void removeName(int row, int column)
           
 void renameBean(int row, int column)
           
protected  void setColumnToHoldButton(JTable table, int column, JButton sample)
          Service method to setup a column so that it will hold a button for it's values
 void setDisplayDeleteMsg(int boo)
           
protected  void setManager(Manager man)
           
 void setValueAt(Object value, int row, int col)
           
protected  void showPopup(MouseEvent e)
           
protected  void updateNameList()
           
 
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

SYSNAMECOL

public static final int SYSNAMECOL
See Also:
Constant Field Values

USERNAMECOL

public static final int USERNAMECOL
See Also:
Constant Field Values

VALUECOL

public static final int VALUECOL
See Also:
Constant Field Values

COMMENTCOL

public static final int COMMENTCOL
See Also:
Constant Field Values

DELETECOL

public static final int DELETECOL
See Also:
Constant Field Values

NUMCOLUMN

public static final int NUMCOLUMN
See Also:
Constant Field Values

sysNameList

protected List<String> sysNameList
Constructor Detail

BeanTableDataModel

public BeanTableDataModel()
Method Detail

updateNameList

protected void updateNameList()

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener

matchPropertyName

protected boolean matchPropertyName(PropertyChangeEvent e)
Is this property event announcing a change this table should display?

Note that events will come both from the NamedBeans and also from the manager


getRowCount

public int getRowCount()
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)

getValue

public abstract String getValue(String systemName)

getManager

protected abstract Manager getManager()

setManager

protected void setManager(Manager man)

getBySystemName

protected abstract NamedBean getBySystemName(String name)

getByUserName

protected abstract NamedBean getByUserName(String name)

clickOn

protected abstract void clickOn(NamedBean t)

getDisplayDeleteMsg

public int getDisplayDeleteMsg()

setDisplayDeleteMsg

public void setDisplayDeleteMsg(int boo)

getMasterClassName

protected abstract String getMasterClassName()

setValueAt

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

deleteBean

protected void deleteBean(int row,
                          int col)

configureTable

public void configureTable(JTable table)
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:
table -

configValueColumn

protected void configValueColumn(JTable table)

configureButton

public JButton configureButton()

configDeleteColumn

protected void configDeleteColumn(JTable table)

setColumnToHoldButton

protected void setColumnToHoldButton(JTable table,
                                     int column,
                                     JButton sample)
Service method to setup a column so that it will hold a button for it's values

Parameters:
table -
column -
sample - Typical button, used for size

dispose

public void dispose()

printTable

public void printTable(HardcopyWriter w)
Method to self print or print preview the table. Printed in equally sized columns across the page with headings and vertical lines between each column. Data is word wrapped within a column. Can handle data as strings, comboboxes or booleans


printColumns

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

makeJTable

protected JTable makeJTable(TableSorter sorter)

getBeanType

protected abstract String getBeanType()

showPopup

protected void showPopup(MouseEvent e)

renameBean

public void renameBean(int row,
                       int column)

removeName

public void removeName(int row,
                       int column)

moveBean

public void moveBean(int row,
                     int column)


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