dsto.dfc.swing.forms
Class JLabelFormEditor

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

public class JLabelFormEditor
extends AbstractFormEditor
implements FormEditor

A read-only editor binding for JLabel's. Supports display of Icon, String and Iconic values.

Version:
$Revision$
See Also:
Serialized Form

Field Summary
protected  int iconicMode
           
protected  JLabel label
           
static int SHOW_LARGE_ICON
          Show Iconic largeIcon property as label icon.
static int SHOW_SMALL_ICON
          Show Iconic icon property as label icon.
static int SHOW_TEXT
          Show Iconic name property as label text.
protected  Object value
           
 
Fields inherited from class dsto.dfc.swing.forms.AbstractFormEditor
converter, description
 
Constructor Summary
JLabelFormEditor(JLabel label)
           
JLabelFormEditor(JLabel label, int iconicMode, ValueConverter converter)
          Create a new JLabelFormEditor instance.
JLabelFormEditor(JLabel label, ValueConverter converter)
           
 
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).
 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 newValue)
          Sets the value to be displayed/edited by the form editor.
 
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, getEditorDescription, getPreferredValueType, removeFormEditorListener
 

Field Detail

SHOW_TEXT

public static final int SHOW_TEXT
Show Iconic name property as label text.

See Also:
Constant Field Values

SHOW_SMALL_ICON

public static final int SHOW_SMALL_ICON
Show Iconic icon property as label icon.

See Also:
Constant Field Values

SHOW_LARGE_ICON

public static final int SHOW_LARGE_ICON
Show Iconic largeIcon property as label icon.

See Also:
Constant Field Values

label

protected JLabel label

value

protected Object value

iconicMode

protected int iconicMode
Constructor Detail

JLabelFormEditor

public JLabelFormEditor(JLabel label)

JLabelFormEditor

public JLabelFormEditor(JLabel label,
                        ValueConverter converter)

JLabelFormEditor

public JLabelFormEditor(JLabel label,
                        int iconicMode,
                        ValueConverter converter)
Create a new JLabelFormEditor instance.

Parameters:
label - The label to bind.
iconicMode - Used to resolve display of Iconic values. See docs for SHOW_TEXT, SHOW_SMALL_ICON and SHOW_LARGE_ICON for details.
converter - A value converter for conversion between the value and String.
See Also:
SHOW_TEXT, SHOW_LARGE_ICON, SHOW_SMALL_ICON
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 newValue)
                    throws IllegalFormatException
Description copied from interface: FormEditor
Sets the value to be displayed/edited by the form editor.

Specified by:
setEditorValue in interface FormEditor
Specified by:
setEditorValue in class AbstractFormEditor
Parameters:
newValue - 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.

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

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


Copyright © 2008 Commonwealth of Australia