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

java.lang.Object
  |
  +--org.objectweb.jac.aspects.gui.web.AbstractView
        |
        +--org.objectweb.jac.aspects.gui.web.AbstractFieldEditor
              |
              +--org.objectweb.jac.aspects.gui.web.ObjectChooser
All Implemented Interfaces:
ChoiceListener, FieldEditor, FieldUpdate, FieldView, HTMLEditor, HTMLViewer, ReferenceEditor, View, ViewIdentity

public class ObjectChooser
extends AbstractFieldEditor
implements HTMLEditor, ChoiceListener, ReferenceEditor

This is a special value editor that allows the user to choose a value within a set of object of a given type.


Field Summary
 
Fields inherited from class org.objectweb.jac.aspects.gui.web.AbstractFieldEditor
field, isEmbedded, setter, substance, type, value
 
Fields inherited from class org.objectweb.jac.aspects.gui.web.AbstractView
column, context, description, height, isCellViewer, label, parentView, row, table, width
 
Constructor Summary
ObjectChooser(Object substance, FieldItem reference, ComboBoxModel model, boolean isEditable)
          Constructs a new object chooser.
 
Method Summary
 void close(boolean validate)
          Close this view.
protected  boolean doReadValue(Object parameter)
           
 void genHTML(PrintWriter out)
          Generate the HTML code for the editor.
 ComboBoxModel getModel()
          Gets the model containing the list of items the user can choose from.
 Object getValue()
          Gets the value of the edited object.
 boolean isEditable()
          Tells wether the user is allowed to enter a value which is not in the list
 void onCreateObject()
           
 void setEditable(boolean editable)
           
 void setValue(Object value)
          Sets the value to display
 
Methods inherited from class org.objectweb.jac.aspects.gui.web.AbstractFieldEditor
commit, fieldUpdated, getField, getSubstance, isEnabled, onSetFocus, readValue, setAutoUpdate, setEditedType, setEmbedded, setEnabled, setField, setSubstance, 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.web.HTMLEditor
commit, readValue, setAttribute
 
Methods inherited from interface org.objectweb.jac.aspects.gui.web.HTMLViewer
setStyleSheet
 
Methods inherited from interface org.objectweb.jac.aspects.gui.FieldEditor
commit, isEnabled, onSetFocus, setEditedType, setEmbedded, setEnabled
 
Methods inherited from interface org.objectweb.jac.aspects.gui.FieldView
getField, getSubstance, setAutoUpdate, setField, setSubstance
 
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
 

Constructor Detail

ObjectChooser

public ObjectChooser(Object substance,
                     FieldItem reference,
                     ComboBoxModel model,
                     boolean isEditable)
Constructs a new object chooser.

Parameters:
substance -
reference - the subtance reference that is affected by this chooser (can be null)
isEditable - should the user be allowed to enter a new value
Method Detail

getModel

public ComboBoxModel getModel()
Gets the model containing the list of items the user can choose from.

Specified by:
getModel in interface ReferenceEditor

setValue

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

Specified by:
setValue in interface FieldView
Overrides:
setValue in class AbstractFieldEditor
Parameters:
value - the value

getValue

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

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

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 AbstractFieldEditor
Parameters:
validate - wether to validate any value contained in editors.

isEditable

public boolean isEditable()
Description copied from interface: ReferenceEditor
Tells wether the user is allowed to enter a value which is not in the list

Specified by:
isEditable in interface ReferenceEditor
See Also:
ReferenceEditor.setEditable(boolean)

setEditable

public void setEditable(boolean editable)
Specified by:
setEditable in interface ReferenceEditor
See Also:
ReferenceEditor.isEditable()

genHTML

public void genHTML(PrintWriter out)
Description copied from interface: HTMLViewer
Generate the HTML code for the editor.

Specified by:
genHTML in interface HTMLViewer
Parameters:
out - the writer where to write the HTML code.

doReadValue

protected boolean doReadValue(Object parameter)
Specified by:
doReadValue in class AbstractFieldEditor

onCreateObject

public void onCreateObject()
Specified by:
onCreateObject in interface ChoiceListener