org.objectweb.jac.aspects.gui.web
Class AbstractFieldEditor

java.lang.Object
  extended byorg.objectweb.jac.aspects.gui.web.AbstractView
      extended byorg.objectweb.jac.aspects.gui.web.AbstractFieldEditor
All Implemented Interfaces:
FieldEditor, FieldUpdate, FieldView, View, ViewIdentity
Direct Known Subclasses:
AttachmentEditor, BooleanEditor, FormatEditor, IndexSelector, InputStreamEditor, ObjectChooser, PasswordFieldEditor, PrimitiveFieldEditor, ReaderEditor, TextEditor, URLEditor

public abstract class AbstractFieldEditor
extends AbstractView
implements FieldEditor, FieldUpdate

Base class for field editors


Field Summary
protected  FieldItem field
           
protected  boolean isEmbedded
           
protected  MethodItem setter
           
protected  Object substance
           
protected  ClassItem type
           
protected  Object value
           
 
Fields inherited from class org.objectweb.jac.aspects.gui.web.AbstractView
column, context, description, height, isCellViewer, label, parentView, row, table, width
 
Constructor Summary
AbstractFieldEditor(Object substance, FieldItem field)
           
 
Method Summary
 void close(boolean validate)
          Close this view.
 void commit()
          Commit editing by calling the setter method.
protected abstract  boolean doReadValue(Object parameter)
           
 void fieldUpdated(Object substance, FieldItem field, Object value, Object param)
          Upcalled when a field was modified.
 FieldItem getField()
           
 Object getSubstance()
          Gets the substance object holding the field
 Object getValue()
          Gets the value of the edited object.
 boolean isEnabled()
           
 void onSetFocus(Object param)
          Called when the focus is given to the editor
 boolean readValue(Object parameter)
           
 void setAutoUpdate(boolean autoUpdate)
          Sets the auto-update property of the view.
 void setEditedType(ClassItem type)
          Sets the type of the edited value
 void setEmbedded(boolean isEmbedded)
          Sets wether the editor is embedded in a view.
 void setEnabled(boolean enabled)
           
 void setField(FieldItem field)
          Sets the field being displayed
 void setSubstance(Object substance)
          Sets the substance object holding the field
 void setValue(Object value)
          Sets the value to display
protected  String sizeSpec()
           
 
Methods inherited from class org.objectweb.jac.aspects.gui.web.AbstractView
closeForm, equalsView, equalsView, eventURL, eventURL, genBody, genEventAndActionButton, genPage, genStyleSheets, getBaseURL, getCloseBorder, getContext, getDescription, getFactory, getId, getId, getLabel, getMessage, getOpenBorder, getParameters, getParentView, getRootView, getStyle, getType, getViewBorder, iconElement, iconElement, isClosed, isDescendantOf, isInForm, openForm, printAttributes, setAttribute, setColumn, setContext, setDescription, setFactory, setFocus, setLabel, setMessage, setParameters, setParentView, setRow, setSize, setStyle, setStyleSheet, setTable, setType, setViewBorder, showButton, showFormButtons, showFormButtons
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jac.aspects.gui.View
getContext, getDescription, getFactory, getLabel, getMessage, getParentView, getRootView, getStyle, getViewBorder, isClosed, isDescendantOf, setContext, setDescription, setFactory, setFocus, setLabel, setMessage, setParentView, setSize, setStyle, setViewBorder
 
Methods inherited from interface org.objectweb.jac.aspects.gui.ViewIdentity
equalsView, equalsView, getParameters, getType, setParameters, setType
 

Field Detail

substance

protected Object substance

field

protected FieldItem field

type

protected ClassItem type

setter

protected MethodItem setter

value

protected Object value

isEmbedded

protected boolean isEmbedded
Constructor Detail

AbstractFieldEditor

public AbstractFieldEditor(Object substance,
                           FieldItem field)
Method Detail

getValue

public Object getValue()
Description copied from interface: FieldEditor
Gets the value of the edited object.

Specified by:
getValue in interface FieldEditor
Returns:
an object of the edited type

setValue

public void setValue(Object value)
Description copied from interface: FieldView
Sets the value to display

Specified by:
setValue in interface FieldView
Parameters:
value - the value

setSubstance

public void setSubstance(Object substance)
Description copied from interface: FieldView
Sets the substance object holding the field

Specified by:
setSubstance in interface FieldView
Parameters:
substance - the substance
See Also:
FieldView.getSubstance()

getSubstance

public Object getSubstance()
Description copied from interface: FieldView
Gets the substance object holding the field

Specified by:
getSubstance in interface FieldView
See Also:
FieldView.setSubstance(Object)

setEditedType

public void setEditedType(ClassItem type)
Description copied from interface: FieldEditor
Sets the type of the edited value

Specified by:
setEditedType in interface FieldEditor
Parameters:
type - the type of the edited value

setField

public void setField(FieldItem field)
Description copied from interface: FieldView
Sets the field being displayed

Specified by:
setField in interface FieldView
Parameters:
field - the field

getField

public FieldItem getField()
Specified by:
getField in interface FieldView
Returns:
the field item

setAutoUpdate

public void setAutoUpdate(boolean autoUpdate)
Description copied from interface: FieldView
Sets the auto-update property of the view. If auto-update is true (which is the default), the view registers for changes on field it displays.

Specified by:
setAutoUpdate in interface FieldView

setEmbedded

public void setEmbedded(boolean isEmbedded)
Description copied from interface: FieldEditor
Sets wether the editor is embedded in a view.

Specified by:
setEmbedded in interface FieldEditor

close

public void close(boolean validate)
Description copied from interface: View
Close this view. This should be upcalled when the view is closed in order to free resources or close other dependant views.

Specified by:
close in interface View
Overrides:
close in class AbstractView

onSetFocus

public void onSetFocus(Object param)
Description copied from interface: FieldEditor
Called when the focus is given to the editor

Specified by:
onSetFocus in interface FieldEditor
Parameters:
param - an optional parameter

readValue

public boolean readValue(Object parameter)

doReadValue

protected abstract boolean doReadValue(Object parameter)

commit

public void commit()
Commit editing by calling the setter method.

Specified by:
commit in interface FieldEditor

fieldUpdated

public void fieldUpdated(Object substance,
                         FieldItem field,
                         Object value,
                         Object param)
Description copied from interface: FieldUpdate
Upcalled when a field was modified.

Specified by:
fieldUpdated in interface FieldUpdate
Parameters:
substance - the object of which a field was updated
field - the updated field
value - new value of the vield
param - extra infos (unused)
See Also:
ViewControlWrapper.registerField(Wrappee,FieldItem,FieldUpdate,Object)

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface FieldEditor

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface FieldEditor

sizeSpec

protected String sizeSpec()