dsto.dfc.swing.forms
Interface FormEditor

All Known Subinterfaces:
Form
All Known Implementing Classes:
AbstractFormEditor, AbstractFormEditorComponent, BasicEnumeratedTermCustomizer, BasicForm, CellToFormEditorAdapter, ColorChooserCombo, ColorChooserPanel, EnumFormEditor, FontLabelEditor, FontSelectorEditor, FormDialog, FormEditorValueAdapter, FormPanel, GradientPanel, JCheckBoxFormEditor, JComboBoxFormEditor, JFileChooserFormEditor, JLabelFormEditor, JListFormEditor, JListSelectionFormEditor, JSliderFormEditor, JTableFormEditor, JTextFieldFormEditor, JTreeSelectionFormEditor, LogWindowPopperEditor, MapTableView, MultiplexFormEditor, NumericSpinnerFormEditor, PopupFormEditor, RadioBox, StyleSheetLabelView, StyleSheetTableView.FormEditorAdapter, TermCustomizer

public interface FormEditor

Defines an editor for a value, similar in concept to a JFC cell editor. Editors support set/get of their current editorValue property, as well as notification of changes to the value via editCommitted events (see FormEditorListener).

When the value of the editor changes, the editor should immediately fire an editCommitted event (eg see JCheckBoxFormEditor). If an editor wishes to initiate a controlled commit, where an error in the new value might need to be handled, it should fire an editCommitRequested event instead: this will signal its parent environment to call the editor's commitEdits () and either handle any IllegalFormatException encountered or commit the new value. Only editors that must handle invalid entries need use this capability - for an example, see JTextFieldFormEditor.

Version:
$Revision$
Author:
Matthew

Method Summary
 void addFormEditorListener(FormEditorListener l)
           
 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).
 Component getEditorComponent()
          Get the component, if any, that acts as a UI for this editor.
 String getEditorDescription()
          Get a short description of the value being edited for this editor (eg 'host name').
 Object getEditorValue()
          Get the current value from the form editor.
 Class getPreferredValueType()
          The preferred type of value for the editor.
 boolean isDirectEdit()
          True if the editor directly edits the value passed in with setValue ().
 void removeFormEditorListener(FormEditorListener l)
           
 void setEditorValue(Object value)
          Sets the value to be displayed/edited by the form editor.
 

Method Detail

isDirectEdit

boolean isDirectEdit()
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.


getPreferredValueType

Class getPreferredValueType()
The preferred type of value for the editor. Values conforming to this type may be safely passed to setEditorValue(java.lang.Object). May return java.lang.Object to indictate no preferred type.


setEditorValue

void setEditorValue(Object value)
                    throws IllegalFormatException
Sets the value to be displayed/edited by the form editor.

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

Object getEditorValue()
Get the current value from the form editor. At least one call to setValue () must be made beforehand.


getEditorComponent

Component getEditorComponent()
Get the component, if any, that acts as a UI for this editor. May return null if not associated with a component.


getEditorDescription

String getEditorDescription()
Get a short description of the value being edited for this editor (eg 'host name'). May be null.


commitEdits

void commitEdits()
                 throws IllegalFormatException
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.

Throws:
IllegalFormatException - if the commit failed because of an illegal input or other error. The source specified by the exception should be the FormEditor instance that caused the error (ie either this editor or a child).

addFormEditorListener

void addFormEditorListener(FormEditorListener l)

removeFormEditorListener

void removeFormEditorListener(FormEditorListener l)


Copyright © 2008 Commonwealth of Australia