dsto.dfc.swing.forms
Class CellToFormEditorAdapter

java.lang.Object
  extended by dsto.dfc.swing.forms.BasicFormEditorEventSource
      extended by dsto.dfc.swing.forms.AbstractFormEditor
          extended by dsto.dfc.swing.forms.CellToFormEditorAdapter
All Implemented Interfaces:
FormEditor, Copyable, Serializable, Cloneable, EventListener, CellEditorListener

public class CellToFormEditorAdapter
extends AbstractFormEditor
implements CellEditorListener

Attempts to adapt a JFC TreeCellEditor/TableCellEditor implementation to the DFC FormEditor interface. Will only work with CellEditor's that do not care what component they are hosted in ie editors that do not need access the JTree or JTable instance that is passed into getTableCellEditorComponent() or getTreeCellEditorComponent() (which will be null).

Version:
$Revision$
Author:
Matthew
See Also:
AbstractCellEditor, Serialized Form

Field Summary
 
Fields inherited from class dsto.dfc.swing.forms.AbstractFormEditor
converter, description
 
Constructor Summary
CellToFormEditorAdapter(CellEditor cellEditor)
           
 
Method Summary
 void commitEdits()
          Commit any changes not already committed into the value of this editor (eg a text editor will attempt to perform any uncommitted text conversions at this point).
 void editingCanceled(ChangeEvent e)
           
 void editingStopped(ChangeEvent e)
           
 Component getEditorComponent()
          Get the component, if any, that acts as a UI for this editor.
 Object getEditorValue()
          Get the current value from the form editor.
 boolean isDirectEdit()
          True if the editor directly edits the value passed in with setValue ().
 void setEditorValue(Object value)
          Implements the FormEditor.setEditorValue () mathod by calling get*CellEditorComponent().
 
Methods inherited from class dsto.dfc.swing.forms.AbstractFormEditor
getEditorDescription, getPreferredValueType, setEditorDescription
 
Methods inherited from class dsto.dfc.swing.forms.BasicFormEditorEventSource
addFormEditorListener, clone, fireEditComitted, fireEditCommitRequested, fireEditCommitted, removeFormEditorListener, setFormEditorEventSource
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dsto.dfc.swing.forms.FormEditor
addFormEditorListener, removeFormEditorListener
 

Constructor Detail

CellToFormEditorAdapter

public CellToFormEditorAdapter(CellEditor cellEditor)
Method Detail

isDirectEdit

public boolean isDirectEdit()
Description copied from interface: FormEditor
True if the editor directly edits the value passed in with setValue (). If false, the parent editor will be reponsible for retrieving the value from the editor and storing it.

Specified by:
isDirectEdit in interface FormEditor
Specified by:
isDirectEdit in class AbstractFormEditor

setEditorValue

public void setEditorValue(Object value)
                    throws IllegalFormatException
Implements the FormEditor.setEditorValue () mathod by calling get*CellEditorComponent(). Incidentally sets the component returned by getEditorComponent().

Specified by:
setEditorValue in interface FormEditor
Specified by:
setEditorValue in class AbstractFormEditor
Parameters:
value - The value to display.
Throws:
IllegalFormatException - if the value was not in the correct format for display by this editor. The source specified by the exception should be this FormEditor instance or a child.

getEditorValue

public Object getEditorValue()
Description copied from interface: FormEditor
Get the current value from the form editor. At least one call to setValue () must be made beforehand.

Specified by:
getEditorValue in interface FormEditor
Specified by:
getEditorValue in class AbstractFormEditor

getEditorComponent

public Component getEditorComponent()
Description copied from interface: FormEditor
Get the component, if any, that acts as a UI for this editor. May return null if not associated with a component.

Specified by:
getEditorComponent in interface FormEditor
Specified by:
getEditorComponent in class AbstractFormEditor

commitEdits

public void commitEdits()
Description copied from interface: FormEditor
Commit any changes not already committed into the value of this editor (eg a text editor will attempt to perform any uncommitted text conversions at this point). Only editors that need support editing in non-atomic sessions (such as text fields) will generally do anything when this method is called. If commit is made that has not been signalled with a previous editCommitted event, the editor should fire an editCommitted event at this point. Composite editors, such as forms, will generally forward this request to their child editors.

Specified by:
commitEdits in interface FormEditor
Specified by:
commitEdits in class AbstractFormEditor

editingStopped

public void editingStopped(ChangeEvent e)
Specified by:
editingStopped in interface CellEditorListener

editingCanceled

public void editingCanceled(ChangeEvent e)
Specified by:
editingCanceled in interface CellEditorListener


Copyright © 2008 Commonwealth of Australia