de.tkuhn.util.prefs.gui
Class BasicPrefTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by de.tkuhn.util.prefs.gui.PrefTableModel
          extended by de.tkuhn.util.prefs.gui.BasicPrefTableModel
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.util.EventListener, javax.swing.table.TableModel
Direct Known Subclasses:
MetaPrefTableModel

public class BasicPrefTableModel
extends PrefTableModel
implements javax.swing.table.TableModel, java.awt.event.ActionListener

This TableModel implementation provides editing capabilities for Preferences objects.

Author:
Tilmann Kuhn
See Also:
Serialized Form

Field Summary
protected  de.tkuhn.swing.actions.ActionManager actionManager
           
protected  boolean allowDelete
           
protected  boolean allowNew
           
protected static java.lang.String COL_PROPERTY_NAME
           
protected static java.lang.String COL_VALUE_NAME
           
protected static java.lang.String DEL_PREF_COMMAND
           
protected static javax.swing.KeyStroke DEL_PREF_KEY
           
protected static java.lang.String DEL_PREF_NAME
           
protected static java.lang.String DEL_PREF_SDESC
           
protected  java.util.List<PrefMapping> mappings
           
protected static java.lang.String NEW_PREF_COMMAND
           
protected static javax.swing.KeyStroke NEW_PREF_KEY
           
protected static java.lang.String NEW_PREF_NAME
           
protected static java.lang.String NEW_PREF_SDESC
           
protected  java.util.prefs.Preferences prefs
           
protected static java.lang.String REQUEST_MAPPING_KEY
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
BasicPrefTableModel(java.util.prefs.Preferences prefs, boolean allowDelete, boolean allowNew)
          Creates a new instance of UserPrefTableModel
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
           
 java.util.Collection<javax.swing.Action> getActions()
          Return a Collection of Actions that can be used to manipulate the Model
 java.lang.Class<?> getColumnClass(int param)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int param)
           
protected  java.lang.String getKeyForRow(int row)
           
 java.util.prefs.Preferences getPrefs()
          Get the Preferences instance reflected by this TableModel
 int getRowCount()
           
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
protected  void initActions()
           
 boolean isCellEditable(int row, int column)
           
 void registerCellEditors(javax.swing.JTable table)
          Set the CellEditor of the tree suiting to this model
 void registerCellRenderers(javax.swing.JTable table)
          Register the CellRenderers at the tree suiting this models elements.
 void setPrefs(java.util.prefs.Preferences prefs)
          Set a new References instnce to be reflected by this TableModel
 void setValueAt(java.lang.Object obj, int row, int column)
           
 
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
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
 

Field Detail

NEW_PREF_COMMAND

protected static final java.lang.String NEW_PREF_COMMAND
See Also:
Constant Field Values

NEW_PREF_NAME

protected static final java.lang.String NEW_PREF_NAME

NEW_PREF_SDESC

protected static final java.lang.String NEW_PREF_SDESC

NEW_PREF_KEY

protected static final javax.swing.KeyStroke NEW_PREF_KEY

DEL_PREF_COMMAND

protected static final java.lang.String DEL_PREF_COMMAND
See Also:
Constant Field Values

DEL_PREF_NAME

protected static final java.lang.String DEL_PREF_NAME

DEL_PREF_SDESC

protected static final java.lang.String DEL_PREF_SDESC

DEL_PREF_KEY

protected static final javax.swing.KeyStroke DEL_PREF_KEY

COL_PROPERTY_NAME

protected static final java.lang.String COL_PROPERTY_NAME

COL_VALUE_NAME

protected static final java.lang.String COL_VALUE_NAME

REQUEST_MAPPING_KEY

protected static final java.lang.String REQUEST_MAPPING_KEY

prefs

protected java.util.prefs.Preferences prefs

allowDelete

protected boolean allowDelete

allowNew

protected boolean allowNew

actionManager

protected de.tkuhn.swing.actions.ActionManager actionManager

mappings

protected java.util.List<PrefMapping> mappings
Constructor Detail

BasicPrefTableModel

public BasicPrefTableModel(java.util.prefs.Preferences prefs,
                           boolean allowDelete,
                           boolean allowNew)
Creates a new instance of UserPrefTableModel

Parameters:
prefs - the Preferences reflected by this TableModel
allowDelete - is it allowed to delete prefs?
allowNew - is it allowed to create new prefs?
Method Detail

initActions

protected void initActions()

setPrefs

public void setPrefs(java.util.prefs.Preferences prefs)
Set a new References instnce to be reflected by this TableModel

Specified by:
setPrefs in class PrefTableModel
Parameters:
prefs - the new Preferences for this model.

getColumnClass

public java.lang.Class<?> getColumnClass(int param)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface javax.swing.table.TableModel

getColumnName

public java.lang.String getColumnName(int param)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Specified by:
getValueAt in interface javax.swing.table.TableModel

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

setValueAt

public void setValueAt(java.lang.Object obj,
                       int row,
                       int column)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

getActions

public java.util.Collection<javax.swing.Action> getActions()
Return a Collection of Actions that can be used to manipulate the Model

Specified by:
getActions in class PrefTableModel
Returns:
the Collection of Actions

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getPrefs

public java.util.prefs.Preferences getPrefs()
Get the Preferences instance reflected by this TableModel

Specified by:
getPrefs in class PrefTableModel
Returns:
the preferences reflected by this Model

registerCellRenderers

public void registerCellRenderers(javax.swing.JTable table)
Description copied from class: PrefTableModel
Register the CellRenderers at the tree suiting this models elements.

Overrides:
registerCellRenderers in class PrefTableModel
Parameters:
table - the table to set the Renderers for

registerCellEditors

public void registerCellEditors(javax.swing.JTable table)
Set the CellEditor of the tree suiting to this model

Overrides:
registerCellEditors in class PrefTableModel
Parameters:
table - the table to set the CellEditor for

getKeyForRow

protected java.lang.String getKeyForRow(int row)


Copyright © Tilmann Kuhn