Holger's
Java API

com.antelmann.util.table
Class FormDialogCellEditor<T>

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by javax.swing.DefaultCellEditor
          extended by com.antelmann.util.table.AbstractDialogCellEditor<T>
              extended by com.antelmann.util.table.FormDialogCellEditor<T>
All Implemented Interfaces:
ValueRetriever<T>, ValueSetter<T>, Serializable, CellEditor, TableCellEditor, TreeCellEditor

public class FormDialogCellEditor<T>
extends AbstractDialogCellEditor<T>

uses a FormDialog instead of a JOptionPane to support more complex editing

Since:
23.07.2008, 13:20:06
Author:
Holger Antelmann
See Also:
FormDialog, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.DefaultCellEditor
DefaultCellEditor.EditorDelegate
 
Field Summary
 
Fields inherited from class com.antelmann.util.table.AbstractDialogCellEditor
column, columnName, dialogComponent, dialogTitle, expanded, isSelected, leaf, row, table, tree
 
Fields inherited from class javax.swing.DefaultCellEditor
clickCountToStart, delegate, editorComponent
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
FormDialogCellEditor(JComponent component, FormValidator<T> validator, ValueSetter<T> setter)
          constructs the instance
 
Method Summary
 T getRelevantValue()
          returns the relevant value for this instance at the time of calling
 void setRelevantValue(T value)
          sets the relevant value for this instance with the given value
protected  int showDialog(JComponent parent)
          returns FormDialog.OK if the dialog was confirmed with ok
 
Methods inherited from class com.antelmann.util.table.AbstractDialogCellEditor
getCellEditorValue, getDialogComponent, getRelevantComponent, getTableCellEditorComponent, getTreeCellEditorComponent, isCellEditable, isResizable, setResizable, valueChanged
 
Methods inherited from class javax.swing.DefaultCellEditor
cancelCellEditing, getClickCountToStart, getComponent, setClickCountToStart, shouldSelectCell, stopCellEditing
 
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
 

Constructor Detail

FormDialogCellEditor

public FormDialogCellEditor(JComponent component,
                            FormValidator<T> validator,
                            ValueSetter<T> setter)
constructs the instance

Parameters:
component - the component that contains the editable elements that can be handled by the validator
validator - responsible for validating and committing the component
setter - responsible for setting the value from the cell before editing starts (used for implementing the interface); if the class needed access to more information (like the current row), the easiest way is to subclass this and override the setRelevantValue(Object) method to handle it.
Method Detail

showDialog

protected int showDialog(JComponent parent)
returns FormDialog.OK if the dialog was confirmed with ok

Overrides:
showDialog in class AbstractDialogCellEditor<T>
See Also:
JOptionPane.showConfirmDialog(Component, Object)

getRelevantValue

public T getRelevantValue()
Description copied from interface: ValueRetriever
returns the relevant value for this instance at the time of calling


setRelevantValue

public void setRelevantValue(T value)
                      throws Exception
Description copied from interface: ValueSetter
sets the relevant value for this instance with the given value

Throws:
Exception


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads