LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control.form
Class LyFieldSetController

java.lang.Object
  extended by leon.control.LyController
      extended by leon.control.form.LyFieldController
          extended by leon.control.form.LyFieldConsultController
              extended by leon.control.form.LyFieldSetController
All Implemented Interfaces:
LyGetSessionInterface, LyControllerContextInterface, LyGuiListener, LyEvaluator, LyDemandListener
Direct Known Subclasses:
LyArrayFieldSetController, LyArrayTableFieldSetController, LyChoiceFieldSetController, LyCompositionFieldSetController, LyCompositionFieldUnitSetController, LyDateFieldSetController, LyFileFieldSetController, LyNumberFieldSetController, LyRelationFieldSetController, LyStructFieldSetController, LyTextFieldSetController

public class LyFieldSetController
extends LyFieldConsultController
implements LyControllerContextInterface

Default field controller for a modification.

See Also:
LySetController

Field Summary
static java.lang.String __VERSION
          File version
static java.lang.String STANDARD_ARRAY_TOOL
          Name of the tranverse tool like STANDARD_CLASSINFO but for internal update in an array.
static java.lang.String STANDARD_CLASSINFO
          Name of a standard classInfo used in creation when type of the object is dependant of an other fieldinfo (for example: a group of radio bouton, each one defining a different type so we have to create the good form when an action occurs).
static java.lang.String TRANSVERSE_ACTION_SEP
          Separator used for labels of transverse action tools (inserted between action name and class name).
 
Fields inherited from class leon.control.form.LyFieldController
FORM_FIELD_SEP, OLD_FORM_FIELD_SEP
 
Fields inherited from class leon.control.LyController
_nbControllers, _nextId, CONTROLLER_ID_SEP, DEFAULT_IMAGE_FORMAT, DEMAND_HELP, ID_SEP
 
Constructor Summary
LyFieldSetController(LySetController parent, LyFieldInfo fieldInfo)
          Constructor.
 
Method Summary
 void actionDemand(LyActionDemand demand)
          Invoked when an action occurs.
 void addTempFilePath(java.lang.String path)
          Add a file to the delete on free list
 void cancel()
          Method called when the form is cancelled.
 boolean checkIfModified()
          Checks if the value for the fieldInfo has been modified.
 void clear()
          Clears specified fieldInfo value : setting value to null.
 void commit()
          Method called when all modifications are committed.
 void completeValue(java.lang.String value)
          Internal method for completing a formatted value (for a unit).
 short control()
          Controls current edition.
 short endValidate()
          End validation of the form : commit edition.
 LyContext getControllerContext()
          Gets the controller context.
 LyBuilder getDefaultBuilder()
          Factory of the default builder for a controller.
 LyValue getFieldValue()
          Extract current value for the specified fieldInfo in the form.
 LyValue getFieldValue(LyUnit unit)
          Extract current value for the specified fieldInfo in the form.
 LyValue getFinalValue()
          Extract final value for the specified fieldInfo in the form.
 LyValue getLastValue()
          Gets last value of this field controller.
 LyObject getModel()
          get the model object
 LyFieldSetController getParentFieldController()
           
 LySetController getSetController()
          get the associated Set controller
 LyInfoDataList<LyAction,LyClassInfo> getTransverseActions()
          Get the transverse action associated to this field controller
 LyUnit getUnit()
          Get current unit for the specified fieldInfo in the form.
 java.lang.Object getValue()
          Accessor to the internal value associated to a filedInfo.
 boolean isCreation()
          Return the mode of the controller
 boolean isEditable()
          Accessor to the editable/ non editable status for a field in the form.
 boolean isEnabled()
          Accessor to the enabled/disabled status for a field in the form.
 boolean isOptional()
          Accessor to the optional status for a field in the form.
 void reset()
          Resets specified fieldInfo value : the default value is fetched from the associated behavior.
 void resetFromValue(java.lang.Object value, boolean freeOldValue, boolean createNewValue)
          Sets the field content from the specified value Any value modified by the user is the form is lost.
 boolean restore(LyFieldSave fieldSave)
          Restore field input.
 LyFieldSave save(boolean full)
          Save field input.
 void setEditable(boolean editable)
          Changes current field status to (non-)editable.
 void setEnabled(boolean enabled)
          Changes current field status to (non-)enabled.
 void setFieldValue(LyValue newValue, boolean propagate)
          Sets the value of a fieldInfo This methods extracts the value and calls updateFieldItem.
 void setHidden(boolean hidden)
          Changes current field status to (non-)hidden.
 void setInternal(boolean status)
          Identify this controller as being hidden.
 void setOptional(boolean optional)
          Changes current field status to (non-)optional.
 short startValidate()
          Start validation of the form.
 void unitChanged(java.lang.String newUnitId, java.lang.String oldUnitId)
          Internal method for propagating a unit change.
 void update(LyFieldInfo origin, boolean propagate, boolean valueChange)
          Utility method (internal use for behavior) to calculate formulas of fieldInfos.
 void updateFieldItem(java.lang.Object newValue, java.lang.Object oldValue, boolean propagate)
          Internal use : update the value of a fieldInfo in the form.
 void updateViewContent()
          Check (when it makes sence) the graphical component to see if they have a pending value typed by the user, and not yet refreshed in the LyView components.
 void updateViewFromValues(LyDemand demand)
          Update the view of the controller with the specified values from the demand.
 
Methods inherited from class leon.control.form.LyFieldConsultController
isHidden, propagate, setLabel
 
Methods inherited from class leon.control.form.LyFieldController
clearViewCache, free, getAction, getAreaController, getBehavior, getClassInfo, getComponent, getDefaultFieldUnit, getDefaultFieldUnit, getEnvironment, getFieldController, getFieldInfo, getFormController, getFormField, getFormField, getImage, getInfoLabel, getInfoLabel, getLabel, getObject, getState, getViewController, hasMark, invokeTransverseAction, isIdle, menuDemand, setAreaNoScroll, setFieldValue, setFormField, setState, toString
 
Methods inherited from class leon.control.LyController
activateViewDemand, demandPerformed, dragDropDemand, getApplication, getBehaviorInterface, getBuilder, getClassInfo, getId, getImage, getImage, getImage, getImageFromPrefix, getImageFromPrefix, getImageFromPrefix, getKeyValue, getLastModified, getName, getObjectId, getParent, getSession, getUserData, getView, getViewManager, hasViewController, helpDemand, hideView, hideView, isFreed, selectionDemand, setBuilder, setBuilderClass, setIdle, setLastModified, setName, setUserData, showError, showError, showView, showWarning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version

See Also:
Constant Field Values

STANDARD_CLASSINFO

public static final java.lang.String STANDARD_CLASSINFO
Name of a standard classInfo used in creation when type of the object is dependant of an other fieldinfo (for example: a group of radio bouton, each one defining a different type so we have to create the good form when an action occurs).

See Also:
Constant Field Values

STANDARD_ARRAY_TOOL

public static final java.lang.String STANDARD_ARRAY_TOOL
Name of the tranverse tool like STANDARD_CLASSINFO but for internal update in an array.

See Also:
Constant Field Values

TRANSVERSE_ACTION_SEP

public static final java.lang.String TRANSVERSE_ACTION_SEP
Separator used for labels of transverse action tools (inserted between action name and class name).

See Also:
Constant Field Values
Constructor Detail

LyFieldSetController

public LyFieldSetController(LySetController parent,
                            LyFieldInfo fieldInfo)
Constructor.

Parameters:
parent - parent controller
fieldInfo - fieldInfo handled by this controller
Method Detail

getDefaultBuilder

public LyBuilder getDefaultBuilder()
Description copied from class: LyController
Factory of the default builder for a controller. The application should never invoke this method directly (internal use only : use getBuilder instead). This method is specialized in subclasses of LyController to return a valid builder instance.

Overrides:
getDefaultBuilder in class LyFieldConsultController
Returns:
the builder which creates the XML description of the view
See Also:
LyFieldConsultController.getDefaultBuilder()

getTransverseActions

public LyInfoDataList<LyAction,LyClassInfo> getTransverseActions()
Get the transverse action associated to this field controller

Overrides:
getTransverseActions in class LyFieldConsultController
Returns:
a list of transverse actions.

isCreation

public boolean isCreation()
Return the mode of the controller

Returns:
true if in creation mode

getModel

public LyObject getModel()
get the model object

Returns:
the model object

getSetController

public LySetController getSetController()
get the associated Set controller

Returns:
the set controller

updateViewFromValues

public void updateViewFromValues(LyDemand demand)
Update the view of the controller with the specified values from the demand. This will force the graphical objects to use current demand values. This demand is performed after a user interaction. Unlike updateViewContent, the controller is only taking the values from the demand, on 'poling' the possible values.

Overrides:
updateViewFromValues in class LyController
Parameters:
demand - demand parameters sent by the view component.
See Also:
updateViewContent()

updateViewContent

public void updateViewContent()
Check (when it makes sence) the graphical component to see if they have a pending value typed by the user, and not yet refreshed in the LyView components. Like a textfield, which value may have changed in the graphical component and this modification has not been notified. This method may do nothing, depending on the nature of the graphical component.


actionDemand

public void actionDemand(LyActionDemand demand)
Invoked when an action occurs. At this level, the implementation manages
DEMAND_VALIDATE demands. (demand.getType = LyActionDemand.TYPE_ACTION AND demand.getSource() = LyController.DEMAND_VALIDATE)
DEMAND_APPLY demands. (demand.getType = LyActionDemand.TYPE_ACTION AND demand.getSource() = LyController.DEMAND_APPLY)
Default action (double click)
Default action (double click)
VALUE_CHANGED demands. (demand.getType = LyActionDemand.TYPE_VALUE_CHANGED

Overrides:
actionDemand in class LyFieldController
Parameters:
demand - the action demand
See Also:
LyController.demandPerformed(leon.view.event.LyDemand)

setFieldValue

public void setFieldValue(LyValue newValue,
                          boolean propagate)
Sets the value of a fieldInfo This methods extracts the value and calls updateFieldItem.

Overrides:
setFieldValue in class LyFieldController
Parameters:
newValue - the new value of the field. This value may be null to set the value to blank (empty).
propagate - Indicates whether the change is notified (propagated) to other fields or not. This is useless if you reset all fields for instance.
See Also:
getFieldValue()

getUnit

public LyUnit getUnit()
Get current unit for the specified fieldInfo in the form.

Returns:
current unit, or null if not found or field is disabled.

getFinalValue

public LyValue getFinalValue()
Extract final value for the specified fieldInfo in the form.

Returns:
Final value, or null if not found or field is disabled.

getFieldValue

public LyValue getFieldValue()
Extract current value for the specified fieldInfo in the form.

Overrides:
getFieldValue in class LyFieldConsultController
Returns:
current value, or null if not found or field is disabled.

getFieldValue

public LyValue getFieldValue(LyUnit unit)
Extract current value for the specified fieldInfo in the form.

Parameters:
unit - Unit of the value.
Returns:
current value, or null if not found or field is disabled.

updateFieldItem

public void updateFieldItem(java.lang.Object newValue,
                            java.lang.Object oldValue,
                            boolean propagate)
Internal use : update the value of a fieldInfo in the form. Application should use setFieldValue instead. For relation fieldInfo, this method invokes updateRelation (specialization). For choice fieldInfo, this method invokes updateChoice (specialization).

Overrides:
updateFieldItem in class LyFieldConsultController
Parameters:
newValue - the new value of the field. This value may be null, a LyValue instance or the internal value associated to thge fieldInfo. See LyValue.getValue()
oldValue - the latest value of the field. This value may be null, a LyValue instance or the internal value associated to thge fieldInfo. See LyValue.getValue()
propagate - Indicates whether the change is notified (propagated) to other fields or not. This is useless if you reset all fields for instance.
See Also:
setFieldValue(leon.data.LyValue, boolean)

completeValue

public void completeValue(java.lang.String value)
Internal method for completing a formatted value (for a unit). This methods is called when the field unit has been changed by the user.

Parameters:
value - the current fieldValue (not completed).

unitChanged

public void unitChanged(java.lang.String newUnitId,
                        java.lang.String oldUnitId)
Internal method for propagating a unit change. This methods is called when the field unit has been changed by the user.

The LySetController additionaly impact the view using the setValid method.

Parameters:
newUnitId - The new fieldinfo unit.
oldUnitId - The old fieldinfo unit.

startValidate

public short startValidate()
Start validation of the form.

Returns:
the start validate status
See Also:
LyFormInterface

endValidate

public short endValidate()
End validation of the form : commit edition.

Returns:
the end validate status
See Also:
LyFormInterface

commit

public void commit()
Method called when all modifications are committed.


cancel

public void cancel()
Method called when the form is cancelled.


getValue

public java.lang.Object getValue()
Accessor to the internal value associated to a filedInfo. This is a shortcut to getFieldValue(fieldInfo).getValue()

Returns:
the value if found and set, null otherwise.

clear

public void clear()
Clears specified fieldInfo value : setting value to null.


reset

public void reset()
Resets specified fieldInfo value : the default value is fetched from the associated behavior. LyClassBehavior.getValue (LySetBehaviorInterface) The field is restored to its original value when the view was opened.


update

public void update(LyFieldInfo origin,
                   boolean propagate,
                   boolean valueChange)
Utility method (internal use for behavior) to calculate formulas of fieldInfos. Application should use setFieldValue instead.

Overrides:
update in class LyFieldConsultController
Parameters:
origin - the field that propagates the modification
propagate - Indicates whether the change is notified (propagated) to other fields or not.
valueChange - indicates if thie event occurs after a value changed
See Also:
setFieldValue(leon.data.LyValue, boolean)

setOptional

public void setOptional(boolean optional)
Changes current field status to (non-)optional. An optional field may accêpt an empty (null) value and its label is not shown as bold.

Parameters:
optional - new fieldInfo status. (default is from the view description)

isOptional

public boolean isOptional()
Accessor to the optional status for a field in the form.

Returns:
current field status

setEditable

public void setEditable(boolean editable)
Changes current field status to (non-)editable. If the field is not editable, the value is read-only but however submited with all other values. A disabled field is not submited with all other values and is just ignored.

Parameters:
editable - new fieldInfo status. (default is true or obtained from the view description)

isEditable

public boolean isEditable()
Accessor to the editable/ non editable status for a field in the form.

Returns:
current field status

setEnabled

public void setEnabled(boolean enabled)
Changes current field status to (non-)enabled. If the field is not editable, and not submited with all other values.

Parameters:
enabled - new fieldInfo status. (default is true or obtained from the view description)

isEnabled

public boolean isEnabled()
Accessor to the enabled/disabled status for a field in the form.

Returns:
current field status

setHidden

public void setHidden(boolean hidden)
Changes current field status to (non-)hidden. If the field is hidden, it is not submited with all other values. When the field is set hidden, it is also set enabled.

Overrides:
setHidden in class LyFieldConsultController
Parameters:
hidden - new fieldInfo visibility. (default is true)

getLastValue

public final LyValue getLastValue()
Gets last value of this field controller.

Returns:
The last value of this controller.

checkIfModified

public boolean checkIfModified()
Checks if the value for the fieldInfo has been modified.

Returns:
true if the value has been modified, false otherwise.

getControllerContext

public LyContext getControllerContext()
Gets the controller context.

Specified by:
getControllerContext in interface LyControllerContextInterface
Returns:
The controller context.
See Also:
LyControllerContextInterface.getControllerContext()

control

public short control()
Controls current edition.

Returns:
The error status.

setInternal

public void setInternal(boolean status)
Identify this controller as being hidden.

Parameters:
status - the internal status

resetFromValue

public void resetFromValue(java.lang.Object value,
                           boolean freeOldValue,
                           boolean createNewValue)
Sets the field content from the specified value Any value modified by the user is the form is lost. Default implementation just call updateFieldItem but this may be overriden in subclasses.

Overrides:
resetFromValue in class LyFieldController
Parameters:
value - new value to set in the field.
freeOldValue - indicates if the old value should be freed (deleted) when it is an object
createNewValue - indicates if a new empty value should created when object is null and when the value is an object

addTempFilePath

public void addTempFilePath(java.lang.String path)
Add a file to the delete on free list

Parameters:
path - the file path to add to the delete list

save

public LyFieldSave save(boolean full)
Save field input.

Overrides:
save in class LyFieldController

restore

public boolean restore(LyFieldSave fieldSave)
Restore field input.

Overrides:
restore in class LyFieldController

getParentFieldController

public final LyFieldSetController getParentFieldController()

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com