net.sf.jguiraffe.gui.platform.swing.builder.components.table
Class SwingTableCellEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by net.sf.jguiraffe.gui.platform.swing.builder.components.table.SwingTableCellEditor
All Implemented Interfaces:
java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor

 class SwingTableCellEditor
extends javax.swing.AbstractCellEditor
implements javax.swing.table.TableCellEditor

A specialized cell editor class for Swing tables.

This class is used as editor class for table columns that define a custom editor. The component that is used as editor is obtained from the TableTag defining the table. Together with the special table model and the Form instance constructed for the table the current values are transfered into the editor component and input validation can be performed.

An instance of this class is responsible for a complete table. The editor component to be used is obtained from the table definition based on the given column index. Setting and retrieving the editor's values is of less importance because this is handled by the table's editor form object.

Version:
$Id: SwingTableCellEditor.java 58 2007-04-15 16:34:21Z oheger $
Author:
Oliver Heger
See Also:
SwingTableModel

Field Summary
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
SwingTableCellEditor(SwingTableModel tabModel)
          Creates a new instance of SwingTableCellEditor and sets the associated table model.
 
Method Summary
 java.lang.Object getCellEditorValue()
          Returns the current value of this editor.
 SwingTableModel getModel()
          Returns a reference to the associated table model.
 java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean selected, int row, int col)
          Returns the editor component for the specified cell.
 boolean stopCellEditing()
          Tests whether editing can be stopped.
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.CellEditor
addCellEditorListener, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell
 

Constructor Detail

SwingTableCellEditor

public SwingTableCellEditor(SwingTableModel tabModel)
Creates a new instance of SwingTableCellEditor and sets the associated table model.

Parameters:
tabModel - the table model
Method Detail

getModel

public SwingTableModel getModel()
Returns a reference to the associated table model.

Returns:
the table model

getTableCellEditorComponent

public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
                                                      java.lang.Object value,
                                                      boolean selected,
                                                      int row,
                                                      int col)
Returns the editor component for the specified cell. This implementation will return the editor component that was specified in the table definition.

Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor
Parameters:
table - the affected table
value - the current value of this cell
selected - a flag if the cell is highlighted
row - the row index
col - the column index
Returns:
the editor component to be used

getCellEditorValue

public java.lang.Object getCellEditorValue()
Returns the current value of this editor. This implementation just returns null. The value will be processed by the table's editor form and directly written into the table model.

Specified by:
getCellEditorValue in interface javax.swing.CellEditor
Returns:
the editor's current value

stopCellEditing

public boolean stopCellEditing()
Tests whether editing can be stopped. This implementation performs validation of the user input.

Specified by:
stopCellEditing in interface javax.swing.CellEditor
Overrides:
stopCellEditing in class javax.swing.AbstractCellEditor
Returns:
a flag if editing can be stopped (this is the case if the input is valid)


Copyright 2007 null. All Rights Reserved.