net.luniks.swing
Class TextValidatorCellEditor

java.lang.Object
  extended byjavax.swing.AbstractCellEditor
      extended byjavax.swing.DefaultCellEditor
          extended bynet.luniks.swing.TextValidatorCellEditor
All Implemented Interfaces:
javax.swing.CellEditor, java.io.Serializable, javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor
Direct Known Subclasses:
DateCellEditor

public class TextValidatorCellEditor
extends javax.swing.DefaultCellEditor

Class to provide a CellEditor for text. It calls the method validate in the interface Validator at the moment when the user has finished editing the cell. The value the user has entered is given as argument to validate(), it can then be validated and depending on the result a boolean returned. If the return value is false, editing is not stopped and the user has to enter a valid value or cancel editing, for example by pressing ESC. If the returned boolean is true, editing is stopped and the edited value is accepted.

See Also:
Serialized Form

Nested Class Summary
static interface TextValidatorCellEditor.Validator
          Interface for TextValidatorCellEditor
 
Nested classes inherited from class javax.swing.DefaultCellEditor
javax.swing.DefaultCellEditor.EditorDelegate
 
Field Summary
private  javax.swing.JTextField textField
           
private  TextValidatorCellEditor.Validator validator
           
 
Fields inherited from class javax.swing.DefaultCellEditor
clickCountToStart, delegate, editorComponent
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
TextValidatorCellEditor(TextValidatorCellEditor.Validator validator)
          Constructs a TextValidatorCellEditor
 
Method Summary
 javax.swing.JTextField getTextField()
           
 boolean stopCellEditing()
           
 
Methods inherited from class javax.swing.DefaultCellEditor
cancelCellEditing, getCellEditorValue, getClickCountToStart, getComponent, getTableCellEditorComponent, getTreeCellEditorComponent, isCellEditable, setClickCountToStart, shouldSelectCell
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener
 
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, removeCellEditorListener
 

Field Detail

validator

private TextValidatorCellEditor.Validator validator

textField

private javax.swing.JTextField textField
Constructor Detail

TextValidatorCellEditor

public TextValidatorCellEditor(TextValidatorCellEditor.Validator validator)
Constructs a TextValidatorCellEditor

Parameters:
validator - implementation of the interface Validator
Method Detail

stopCellEditing

public boolean stopCellEditing()

getTextField

public javax.swing.JTextField getTextField()


Copyright (c) 2004, 2005 Torsten Römer, dode@luniks.net