org.jurvis.swing.table
Class JvTableEditorSelector

java.lang.Object
  extended by org.jurvis.swing.table.JvTableEditorSelector
All Implemented Interfaces:
CellEditor, TableCellEditor

public class JvTableEditorSelector
extends Object
implements TableCellEditor

A TableCellEditor that is used to select a registered TableCellEditor based on the some criteria about the row or column being edited. Typically the name of the column is used to select the editor.

Author:
Neil W. Weber

Field Summary
protected static String COLUMN_PREFIX
           
protected  TableCellEditor defaultEditor
           
protected  TableCellEditor editor
           
protected  HashMap editors
           
protected static String ROW_PREFIX
           
 
Constructor Summary
JvTableEditorSelector()
          Construct a JvTableEditorSelector using a JTextField as the default editor.
JvTableEditorSelector(TableCellEditor defaultEditor)
          Construct a JvTableEditorSelector using the specified TableCellEditor as the default editor.
 
Method Summary
 void addCellEditorListener(CellEditorListener l)
           
 void cancelCellEditing()
           
 Object getCellEditorValue()
           
 Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
           
 boolean isCellEditable(EventObject anEvent)
           
 void registerByColumn(int columnIndex, TableCellEditor editor)
          Register an TableCellEditor to be used for editing the specified column.
 void registerByName(String columnName, TableCellEditor editor)
          Register an TableCellEditor to be used for editing the named column.
 void registerByRow(int rowIndex, TableCellEditor editor)
          Register an TableCellEditor to be used for editing the specified row.
 void removeCellEditorListener(CellEditorListener l)
           
 boolean shouldSelectCell(EventObject anEvent)
           
 boolean stopCellEditing()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editors

protected HashMap editors

defaultEditor

protected TableCellEditor defaultEditor

editor

protected TableCellEditor editor

COLUMN_PREFIX

protected static final String COLUMN_PREFIX
See Also:
Constant Field Values

ROW_PREFIX

protected static final String ROW_PREFIX
See Also:
Constant Field Values
Constructor Detail

JvTableEditorSelector

public JvTableEditorSelector()
Construct a JvTableEditorSelector using a JTextField as the default editor.


JvTableEditorSelector

public JvTableEditorSelector(TableCellEditor defaultEditor)
Construct a JvTableEditorSelector using the specified TableCellEditor as the default editor.

Parameters:
defaultEditor - the default editor
Method Detail

registerByName

public void registerByName(String columnName,
                           TableCellEditor editor)
Register an TableCellEditor to be used for editing the named column.

Parameters:
columnName - the name of the column
editor - the table cell editor

registerByColumn

public void registerByColumn(int columnIndex,
                             TableCellEditor editor)
Register an TableCellEditor to be used for editing the specified column.

Parameters:
columnIndex - the index of the column
editor - the table cell editor

registerByRow

public void registerByRow(int rowIndex,
                          TableCellEditor editor)
Register an TableCellEditor to be used for editing the specified row.

Parameters:
rowIndex - the index of the row
editor - the table cell editor

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
Specified by:
getTableCellEditorComponent in interface TableCellEditor

getCellEditorValue

public Object getCellEditorValue()
Specified by:
getCellEditorValue in interface CellEditor

stopCellEditing

public boolean stopCellEditing()
Specified by:
stopCellEditing in interface CellEditor

cancelCellEditing

public void cancelCellEditing()
Specified by:
cancelCellEditing in interface CellEditor

isCellEditable

public boolean isCellEditable(EventObject anEvent)
Specified by:
isCellEditable in interface CellEditor

addCellEditorListener

public void addCellEditorListener(CellEditorListener l)
Specified by:
addCellEditorListener in interface CellEditor

removeCellEditorListener

public void removeCellEditorListener(CellEditorListener l)
Specified by:
removeCellEditorListener in interface CellEditor

shouldSelectCell

public boolean shouldSelectCell(EventObject anEvent)
Specified by:
shouldSelectCell in interface CellEditor


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.