LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control
Class LySetController

java.lang.Object
  extended by leon.control.LyController
      extended by leon.control.LyAreaController
          extended by leon.control.LyMultiAreaController
              extended by leon.control.LyFormController
                  extended by leon.control.LyConsultController
                      extended by leon.control.LySetController
All Implemented Interfaces:
LyGetSessionInterface, LyContextInterface, LyControllerContextInterface, LyFormInterface, LyFormResultInterface, LyGetActionInterface, LySelectFileListenerInterface, LyTransverseInterface, LyAdvancedWorkSpaceListener, LyContextListener, LyGuiListener, LyWorkSpaceListener, LyGetClassInfoInterface, LyInfoListener, LyEvaluator, LyDemandListener, LySubmitTab, LyAnswerInterface, LyQuestionAnswerInterface
Direct Known Subclasses:
LyCreateController, LyEditTableSetController

public class LySetController
extends LyConsultController
implements LyQuestionAnswerInterface, LyContextInterface, LyFormInterface, LyFormResultInterface, LySubmitTab, LyContextListener, LyTransverseInterface

This class describes the controller associated to a modification form.

This class implements a 'read-write' LyFormController and specializes methods from its parent.

This form controller is associated to an object or a list of objects, however this is not mandatory. The LySetController is also inherited by LyCreateController which may not have any object.

The LySetController is associated to a LySetBuilder class which sets the content and the overall structure of the view.

This class uses a LyClassBehavior instance which may implement specific application logic, additional value validation, automatic field calculation, value filtering or dynamic impact on value changes...

Services supported by the LySetController :

See Also:
LyClassBehavior, LySetBehaviorInterface, LySetBuilder, LyConsultController, LyCreateController

Field Summary
static java.lang.String __VERSION
          File Version
 boolean _valueChange
          Indicate if propagation is caused by a value change or not.
 
Fields inherited from class leon.control.LyFormController
DEMAND_APPLY, DEMAND_NEXT_OBJECT, DEMAND_NEXT_STEP, DEMAND_PREVIOUS_OBJECT, DEMAND_PREVIOUS_STEP, DEMAND_SAVE, DEMAND_SELECTION, DEMAND_VALIDATE, FORM_FIELD_SEP
 
Fields inherited from class leon.control.LyAreaController
DEFAULT_MENU_ITEM_IMAGE_SIZE, DEMAND_CANCEL, DEMAND_CLOSE, DEMAND_CREATE_CHART, DEMAND_DELETE_CHART, DEMAND_DELETE_OBJECTINFOS, DEMAND_DELETE_PREFERENCE, DEMAND_UPDATE_VIEW
 
Fields inherited from class leon.control.LyController
_nbControllers, _nextId, CONTROLLER_ID_SEP, DEFAULT_IMAGE_FORMAT, DEMAND_HELP, ID_SEP
 
Fields inherited from interface leon.control.LyFormInterface
STATUS_CANCEL, STATUS_IGNORE, STATUS_KO, STATUS_OK
 
Constructor Summary
LySetController(LySession session, LyController parent, LyAction action, LyClassInfo classInfo, LyObjectList objects)
          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
 short apply()
          Apply form.
 void cancel()
          Method called when the form is cancelled.
 void cancelChanges()
          Cancel all changes done in the form.
 boolean canClose(boolean showMessage)
          Check if the area controller may be freed.
 boolean canFree(boolean showMessage)
          Check if the area controller may be freed.
 boolean checkIfModified()
          Check if the form content has been modified and if the object need to be created.
 void clear(LyFieldInfo fieldInfo)
          Clears specified fieldInfo value : setting value to null.
 void clearViewCache()
          Clears all cached data for this controller (especially the view and the component).
 void commit()
          Method called when all modifications are committed.
 LyValue computeFieldValue(LyFieldInfo fieldInfo)
          Method to recompute the field value of a field.
 void contextEnded(LyContext context, LyContext brother)
          Method called when a context is ended by a brother context.
 short control()
          Controls current edition.
 short endValidate()
          End validation of the form : commit edition.
 void execRule(LyRule rule, boolean checked)
          Exec given rule inside this controller.
 LyFieldController fieldControllerFactory(LyFieldInfo fieldInfo, boolean forceConsult)
          Factory for constructing the field controller of a field info.
 void free(LyController controller)
          Free this controller on request of the specified controller.
 java.lang.Class<?> getBehaviorInterface()
          Method that gives the interface that must be implemented by the behavior associated to this controller.
 LyContext getControllerContext()
          Gets the controller context.
 LyInfoList<LyFieldInfo> getFields()
          Gets the list of fields being displayed in the form.
 LyValue getFieldValue(LyFieldInfo fieldInfo)
          Extract current value for the specified fieldInfo in the form.
 LyFormSave getFormSave()
          Gets form save associated to this set controller.
 LyObject getModel()
          Get the model of the current form
 LySetBehaviorInterface getSetBehavior()
          Accessor to controler behavior : shortcut to (LySetBehaviorInterface)getBehavior().
 short getState()
          Get the state of the set controller.
 LyUnit getUnit(LyFieldInfo fieldInfo)
          Get current unit for the specified fieldInfo in the form.
 java.lang.Object getValue(LyFieldInfo fieldInfo)
          Accessor to the internal value associated to a filedInfo.
 boolean isApplied()
          This method may be used at the end of the action to know if the user pushed Apply or Validate button.
 boolean isConsult(LyFieldInfo fieldInfo)
          Checks if the specified fieldInfo is currently being shown as a 'read-only' field in the form.
 boolean isCreation()
          Returns a boolean indicating if the action is or not a creation.
 boolean isDisplayed(LyFieldInfo fieldInfo)
          Checks if the specified fieldInfo is currently being shown in the form.
 boolean isEditable()
          Boolean indicating if the controlled form is editable or not.
 boolean isEditable(LyFieldInfo fieldInfo)
          Accessor to the editable/ non editable status for a field in the form.
 boolean isEnabled(LyFieldInfo fieldInfo)
          Accessor to the enabled/disabled status for a field in the form.
 boolean isHidden(LyFieldInfo fieldInfo)
          Accessor to the hidden status of a field in the form.
 boolean isOptional(LyFieldInfo fieldInfo)
          Accessor to the optional status for a field in the form.
 boolean isValid(LyFieldInfo fieldInfo)
          Accessor to the valid status for a field in the form.
 boolean needUpdate()
          Checks if this controller needs update.
 void notifyFormResult(LyObject object, LyRelationFieldInfo relationField)
          Internal use.
 boolean objectChanged(LyWorkSpaceEvent event)
          Called when an object has changed in the dynamic object list.
 void questionAnswer(boolean result, java.lang.Object clientData)
          Answer to a askQuestion request.
 void reset(LyFieldInfo fieldInfo)
          Resets specified fieldInfo value : the default value is fetched from the associated behavior.
 void resetFieldInfoErrors(LyFieldInfo fieldInfo)
          Reset fieldInfo errors on _object for fieldInfo.
 boolean restore(LyFormSave formSave)
          Restore form inputs.
 LyFormSave save(boolean full)
          Save form inputs.
 void setContextInternal()
          Sets composition relation : this method is invoked when this form manages a relation in another form.
 void setEditable(boolean editable)
          Set boolean indicating if the controlled form is editable or not.
 void setEditable(LyFieldInfo fieldInfo, boolean editable)
          Changes current field status to (non-)editable.
 void setEnabled(boolean enabled)
          Set boolean indicating if the controlled form is enabled or not.
 void setEnabled(LyFieldInfo fieldInfo, boolean enabled)
          Changes current field status to (non-)enabled.
 boolean setFastEditedField(LyFieldInfo fieldInfo)
          Set the fast edited field info.
 void setFieldValue(LyFieldInfo fieldInfo, LyValue newValue, boolean propagate)
          Sets the value of a fieldInfo.
 void setFieldValue(LyFieldInfo fieldInfo, java.lang.Object value)
          Sets the value of a fieldInfo Shortcut for setFieldValue(fieldInfo, value, true).
 void setFieldValue(LyFieldInfo fieldInfo, java.lang.Object value, boolean propagate)
          Sets the value of a fieldInfo.
 void setHidden(LyFieldInfo fieldInfo, boolean hidden)
          Changes current field status to (non-)hidden.
 void setLabel(LyFieldInfo fieldInfo, LyInfoLabel label, boolean labelSet)
          Changes the label for the specified fieldinfo.
 boolean setObject(LyObject object)
          Sets current object being modified.
 void setObjectInternal(LyObject object)
          Accessor to the _object parameter (with no control) Applications should use setObject(object) and not invoke this method directly.
 void setOptional(LyFieldInfo fieldInfo, boolean optional)
          Changes current field status to (non-)optional.
 void setRelationParent(LyFormResultInterface client, LyRelationFieldInfo relation)
          Sets relation parent : this method is invoked when this form is a child of another form (dynamic popup creation of an object in a relation field).
 void setValid(LyFieldInfo fieldInfo, boolean valid)
          Sets the valid status of a field in the form.
 void showError(LyObject object, LyError error)
          Show an error for the specified object.
 void showError(java.lang.String message)
          Show a popup message error box with the specified message.
 short startValidate()
          Start validation of the form.
 void subFormsCancel()
          Cancel sub-forms.
 void subFormsCommit()
          Commit sub-forms.
 boolean update()
          This method is called by the view controller when this area is shown to update its content.
 void update(LyFieldInfo fieldInfo, LyFieldInfo origin, boolean propagate)
          Utility method (internal use for behavior) to calculate formulas of fieldInfos.
 void updateObject(LyValueSet oldValues)
          Called when current object has changed .
 void updateValues()
          Update all values...
 void updateViewContent()
          Check (when it makes sense) the graphical components 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 (internal use) .
 short validate(boolean free)
          The form is closing and we check the values typed in by the user.
 void valueChanged(LyFieldInfo fieldInfo)
          Internal method for control and propagate a value change.
 
Methods inherited from class leon.control.LyConsultController
getConsultBehavior, menuDemand, setIdle, updateObjectFromCompositionRelation
 
Methods inherited from class leon.control.LyFormController
contains, findFormField, getAreaController, getClassInfo, getCompositionRelation, getContent, getDefaultFieldUnit, getEnvironment, getFieldController, getFieldMarks, getFieldValue, getFormField, getImage, getImage, getKeyValue, getObject, getObjectList, getSelection, getState, getTabs, isChangingObject, isComposition, isViewResizable, objectAdded, objectRemoved, objectStateChanged, objectUserEvent, reset, resetFormContent, resetFromObject, setActiveField, setCompositionRelation, setContext, setFieldMarks, setObjects, setState, workSpaceEventsGrouped
 
Methods inherited from class leon.control.LyMultiAreaController
addAreaController, addAreaControllerStack, getAreaController, getAreaController, getAreaControllersCount, getAreaControllerStack, getAreaControllerStackCount, getFinalAreaControllers, getLastModified, openSubAreaController, removeAreaController, removeAreaControllerStack, setAction, setContextClient, setViewController
 
Methods inherited from class leon.control.LyAreaController
completeMenuBar, completeMessages, free, getAction, getAreaStackController, getBehavior, getBuilder, getContext, getContextClient, getContextTitle, getDefaultAction, getFastEditionAction, getHelpFile, getImageTooltip, getInfoLabel, getInfoLabel, getLabel, getMenuItemImage, getName, getParameter, getParameter, getParameterMarks, getParent, getParent, getParentAreaController, getRefreshTime, getShortLabel, getTarget, getTitle, getViewController, getViewController, hasMark, hasNotMark, hasViewController, hideView, infoEvent, initialize, isInitialized, isOutlined, reset, selectFileDemand, setContext, setPreference, showView, showView, testParameter, toString, updateTitleBar
 
Methods inherited from class leon.control.LyController
activateViewDemand, demandPerformed, dragDropDemand, getApplication, getClassInfo, getComponent, getId, getImage, getImage, getImage, getImageFromPrefix, getImageFromPrefix, getImageFromPrefix, getName, getObjectId, getSession, getUserData, getView, getViewManager, helpDemand, hideView, isFreed, isIdle, selectionDemand, setBuilder, setBuilderClass, setLastModified, setName, setUserData, showWarning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface leon.control.LyContextInterface
getContext, setContext
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File Version

See Also:
Constant Field Values

_valueChange

public boolean _valueChange
Indicate if propagation is caused by a value change or not.

Constructor Detail

LySetController

public LySetController(LySession session,
                       LyController parent,
                       LyAction action,
                       LyClassInfo classInfo,
                       LyObjectList objects)
Constructor. Modification form for a list of objects. ClassInfo parameter is ignored, kept for compatibility and introspection capabilities.

Parameters:
session - current session associated to the controller. The controller automatically registers on the specified session.
parent - parent controller (or null for 'root' controller).
action - related action. If an action is specified, the controller uses action parameters (action name, action specific XML view description ...)
classInfo - this parameter is kept for introspection and compatibility. not used.
objects - list of objects currently being modified.
Method Detail

getBehaviorInterface

public java.lang.Class<?> getBehaviorInterface()
Method that gives the interface that must be implemented by the behavior associated to this controller.

Overrides:
getBehaviorInterface in class LyFormController
Returns:
Class representing the behavior interface of this controller.

fieldControllerFactory

public LyFieldController fieldControllerFactory(LyFieldInfo fieldInfo,
                                                boolean forceConsult)
Factory for constructing the field controller of a field info.

Overrides:
fieldControllerFactory in class LyConsultController
Parameters:
fieldInfo - Field info for which a controller is built.
forceConsult - indicates if the given field is forced in consult mode
Returns:
The field controller of the given field.

updateViewFromValues

public void updateViewFromValues(LyDemand demand)
Update the view of the controller with the specified values from the demand (internal use) .

Overrides:
updateViewFromValues in class LyController
Parameters:
demand - demand parameters sent by the view 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 LyFormController
Parameters:
demand - the action demand
See Also:
LyController.demandPerformed(leon.view.event.LyDemand)

setFieldValue

public void setFieldValue(LyFieldInfo fieldInfo,
                          LyValue newValue,
                          boolean propagate)
Sets the value of a fieldInfo.

Parameters:
fieldInfo - the field which should be modified
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(leon.info.LyFieldInfo)

computeFieldValue

public LyValue computeFieldValue(LyFieldInfo fieldInfo)
Method to recompute the field value of a field.

Parameters:
fieldInfo - Field to compute.
Returns:
Computed field value.

setFieldValue

public void setFieldValue(LyFieldInfo fieldInfo,
                          java.lang.Object value)
Sets the value of a fieldInfo Shortcut for setFieldValue(fieldInfo, value, true).

Parameters:
fieldInfo - the field which should be modified
value - the new value of the field. This value may be null (to set the value to blank (empty)), a primitive object type (String, Integer...) or a LyValue
See Also:
setFieldValue(LyFieldInfo, Object, boolean)

setFieldValue

public void setFieldValue(LyFieldInfo fieldInfo,
                          java.lang.Object value,
                          boolean propagate)
Sets the value of a fieldInfo.

Parameters:
fieldInfo - the field which should be modified
value - the new value of the field. This value may be null, a LyValue instance or the internal value associated to the 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:
getFieldValue(leon.info.LyFieldInfo), LyValue.getValue()

getFieldValue

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

Specified by:
getFieldValue in interface LyFormInterface
Overrides:
getFieldValue in class LyFormController
Parameters:
fieldInfo - fieldInfo associated to the requested value
Returns:
current value, or null if not found or field is disabled.

showError

public void showError(LyObject object,
                      LyError error)
Show an error for the specified object.

Overrides:
showError in class LyFormController
Parameters:
object - The object in error
error - The error to show
See Also:
LyController.showError(String)

showError

public void showError(java.lang.String message)
Show a popup message error box with the specified message. The message may be a text message, or the key to a String in the application dictionnary. (stringsXXX.properties files) This is a shortcut to getViewManager().showError()

Overrides:
showError in class LyController
Parameters:
message - the message to show
See Also:
LyViewManager, LyStrings

updateObject

public void updateObject(LyValueSet oldValues)
Called when current object has changed . Overriden to avoid refresh of the view when the form is validated.

Parameters:
oldValues - set of former values, or null if not specified.

execRule

public void execRule(LyRule rule,
                     boolean checked)
Exec given rule inside this controller.

Overrides:
execRule in class LyConsultController
Parameters:
rule - Rule to apply.
checked - True if the rule is checked, false if unchecked.

valueChanged

public void valueChanged(LyFieldInfo fieldInfo)
Internal method for control and propagate a value change. This methods is called when the field has been changed by the user and checks current value validity.

This validity is called for possible specific application implementation on the LyClassBehavior instance.

The LySetController additionaly impact the view using the setValid method.

Parameters:
fieldInfo - fieldInfo which was modified by the user.
See Also:
LyClassBehavior.controlNewValue(leon.control.LySetController, leon.data.LyFieldInfoValue), setValid(leon.info.LyFieldInfo, boolean)

apply

public short apply()
Apply form.

Returns:
Result status.

validate

public short validate(boolean free)
The form is closing and we check the values typed in by the user.

This method is using the LyClassBehavior (LySetBehaviorInterface) to complete and validate the form.

When closing the validate method is following these steps :

Parameters:
free - indicates if the form is closed and freed after a successful validation.
Returns:
the status of the validation
See Also:
LyClassBehavior.addExtraValues(leon.control.LySetController, leon.data.LyValueSet), LyClassBehavior.controlNewValues(leon.control.LySetController, leon.data.LyValueSet), LyClassBehavior.endSet(leon.control.LySetController, leon.data.LyValueSet), LyFormInterface

subFormsCommit

public void subFormsCommit()
Commit sub-forms.


subFormsCancel

public void subFormsCancel()
Cancel sub-forms.


updateValues

public void updateValues()
Update all values...


startValidate

public short startValidate()
Start validation of the form. The form is closing and we check the values typed in by the user.

When closing the validate method is following these steps :

Specified by:
startValidate in interface LyFormInterface
Returns:
the status of this operation
See Also:
LyClassBehavior.addExtraValues(leon.control.LySetController, leon.data.LyValueSet), LyClassBehavior.controlNewValues(leon.control.LySetController, leon.data.LyValueSet), LyFormInterface

endValidate

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

Specified by:
endValidate in interface LyFormInterface
Returns:
the status of the validation
See Also:
LyFormInterface

commit

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

Specified by:
commit in interface LyFormInterface

cancel

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

Specified by:
cancel in interface LyFormInterface

notifyFormResult

public void notifyFormResult(LyObject object,
                             LyRelationFieldInfo relationField)
Internal use. When an object is created in a popup creation form for a relation, the child controller invokes this method to set the newly created object as the current value of the relation (if a new object is created we automatically select this value). This method is never used by the application : use setFieldValue instead

Specified by:
notifyFormResult in interface LyFormResultInterface
Parameters:
object - newly created object. The new value of the relation fieldInfo.
relationField - the relation

getSetBehavior

public LySetBehaviorInterface getSetBehavior()
Accessor to controler behavior : shortcut to (LySetBehaviorInterface)getBehavior().

Returns:
associated behavior
See Also:
LyAreaController.getBehavior()

setEditable

public void setEditable(boolean editable)
Set boolean indicating if the controlled form is editable or not. Current implementation is *not * dynamic. This method must be called before showing the view.

Specified by:
setEditable in interface LyFormInterface
Parameters:
editable - new editable status.

setEnabled

public void setEnabled(boolean enabled)
Set boolean indicating if the controlled form is enabled or not.

Specified by:
setEnabled in interface LyFormInterface
Parameters:
enabled - new enabled status.

isEditable

public boolean isEditable()
Boolean indicating if the controlled form is editable or not.

Returns:
true if the form is editable, false otherwise

setFastEditedField

public boolean setFastEditedField(LyFieldInfo fieldInfo)
Set the fast edited field info.
If a field info is set for fast edition, it will be displayed in the form with fields depending on this field. This method must be called before the view is built.

Parameters:
fieldInfo - the field info that must be edited in fast edition mode.
Returns:
true if the field may be edited in fast edition mode, false otherwise.

getFields

public LyInfoList<LyFieldInfo> getFields()
Gets the list of fields being displayed in the form.

Overrides:
getFields in class LyFormController
Returns:
Fast edited field infos if set, otherwise return the result of the super method.
See Also:
LyFormController.getFields()

getValue

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

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

setObject

public boolean setObject(LyObject object)
Sets current object being modified.

If changes have been made, this method asks the user for confirmation that changes on former object will be lost.

The the method updates all fields for the new object.

Parameters:
object - new object being modified.
Returns:
true if the object change was successful, false otherwise.
See Also:
questionAnswer(boolean, java.lang.Object)

questionAnswer

public void questionAnswer(boolean result,
                           java.lang.Object clientData)
Answer to a askQuestion request. Current implementation proceed the setObject method after user confirmation that changes may be lost.

Specified by:
questionAnswer in interface LyQuestionAnswerInterface
Parameters:
result - true if the user has clicked on Yes or Ok
clientData - data specified in the askQuestion method
See Also:
LyQuestionAnswerInterface.questionAnswer(boolean, java.lang.Object), setObject(leon.data.LyObject)

isDisplayed

public boolean isDisplayed(LyFieldInfo fieldInfo)
Checks if the specified fieldInfo is currently being shown in the form.

Overrides:
isDisplayed in class LyFormController
Parameters:
fieldInfo - the fieldInfo we want to find
Returns:
true if the fieldInfo is present (modification/consultation), false otherwise.

isConsult

public boolean isConsult(LyFieldInfo fieldInfo)
Checks if the specified fieldInfo is currently being shown as a 'read-only' field in the form.

Parameters:
fieldInfo - the fieldInfo we want to find
Returns:
true if the fieldInfo is present (consultation), false otherwise.

isCreation

public boolean isCreation()
Returns a boolean indicating if the action is or not a creation.

Returns:
true if the form is a creation form. Always return FALSE.

isApplied

public boolean isApplied()
This method may be used at the end of the action to know if the user pushed Apply or Validate button.

Returns:
Returns true if Apply was requested, false otherwise.

clear

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

Parameters:
fieldInfo - fieldInfo which is being cleared

reset

public void reset(LyFieldInfo fieldInfo)
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.

Parameters:
fieldInfo - fieldInfo which is being restored

update

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

Parameters:
fieldInfo - the field which was modified
origin - the field that propagates the modification
propagate - Indicates whether the change is notified (propagated) to other fields or not.
See Also:
setFieldValue(leon.info.LyFieldInfo, leon.data.LyValue, boolean)

setOptional

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

Parameters:
fieldInfo - the field which should be marked optional
optional - new fieldInfo status. (default is from the view description)

isOptional

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

Parameters:
fieldInfo - the specified field
Returns:
current field status

setEditable

public void setEditable(LyFieldInfo fieldInfo,
                        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:
fieldInfo - the field which should be marked editable
editable - new fieldInfo status. (default is true or obtained from the view description)

isEditable

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

Parameters:
fieldInfo - the specified field
Returns:
current field status

setEnabled

public void setEnabled(LyFieldInfo fieldInfo,
                       boolean enabled)
Changes current field status to (non-)enabled. A non-enabled field is not submitted with all other values and it's value is ignored even if it was modified during the edition.

Parameters:
fieldInfo - the field which should be marked enabled
enabled - new fieldInfo status. (default is true or obtained from the view description)

isEnabled

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

Parameters:
fieldInfo - the specified field
Returns:
current field status

setHidden

public void setHidden(LyFieldInfo fieldInfo,
                      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 LyConsultController
Parameters:
fieldInfo - the field which should be set hidden
hidden - new fieldInfo visibility. (default is true)

isHidden

public boolean isHidden(LyFieldInfo fieldInfo)
Accessor to the hidden status of a field in the form.

Overrides:
isHidden in class LyConsultController
Parameters:
fieldInfo - the specified field
Returns:
current field visibility

setLabel

public void setLabel(LyFieldInfo fieldInfo,
                     LyInfoLabel label,
                     boolean labelSet)
Changes the label for the specified fieldinfo.

Overrides:
setLabel in class LyConsultController
Parameters:
fieldInfo - the fieldInfo
label - the new label
labelSet - indicates if the label apply to set form

setValid

public void setValid(LyFieldInfo fieldInfo,
                     boolean valid)
Sets the valid status of a field in the form.

Parameters:
fieldInfo - the specified field
valid - current validity status

isValid

public boolean isValid(LyFieldInfo fieldInfo)
Accessor to the valid status for a field in the form.

Parameters:
fieldInfo - the specified field
Returns:
current field status

clearViewCache

public void clearViewCache()
Clears all cached data for this controller (especially the view and the component).

This method may be invoked for memory optimization, but the controller is still valid and may be used. (Unlike free) Further usage, needs to rebuild internal component & view which may be time consuming.

Overrides:
clearViewCache in class LyFormController

free

public void free(LyController controller)
Free this controller on request of the specified controller.

Overrides:
free in class LyFormController
Parameters:
controller - controller instance which requested the freeing of this controller. If the controller is the parent, this controller is freed with all its sub-controllers (relationControllers) otherwise the method does nothing.
See Also:
LyAreaController.free()

objectChanged

public boolean objectChanged(LyWorkSpaceEvent event)
Called when an object has changed in the dynamic object list. This method is overriden for tabactions

Specified by:
objectChanged in interface LyWorkSpaceListener
Overrides:
objectChanged in class LyFormController
Parameters:
event - event of changing object
Returns:
the event is used by the listener

getState

public short getState()
Get the state of the set controller.

Returns:
current state

getUnit

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

Parameters:
fieldInfo - fieldInfo associated to the requested unit relation
Returns:
current unit, or null if not found or field is disabled.

resetFieldInfoErrors

public void resetFieldInfoErrors(LyFieldInfo fieldInfo)
Reset fieldInfo errors on _object for fieldInfo.

Parameters:
fieldInfo -

getControllerContext

public LyContext getControllerContext()
Gets the controller context.

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

getModel

public LyObject getModel()
Get the model of the current form

Returns:
the model object

setContextInternal

public void setContextInternal()
Sets composition relation : this method is invoked when this form manages a relation in another form.


control

public short control()
Controls current edition.

Specified by:
control in interface LyFormInterface
Returns:
The error status.

contextEnded

public void contextEnded(LyContext context,
                         LyContext brother)
Method called when a context is ended by a brother context.

Specified by:
contextEnded in interface LyContextListener
Parameters:
context - Context ended.
brother - Brother context that ended the given context.

updateViewContent

public void updateViewContent()
Check (when it makes sense) the graphical components 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.


canFree

public boolean canFree(boolean showMessage)
Check if the area controller may be freed. This method may be overriden by subclasses. The current implementation always returns true

Overrides:
canFree in class LyAreaController
Parameters:
showMessage - indicates if the controller can show an warning message or not
Returns:
true if the free method can be called immediately, false otherwise.

canClose

public boolean canClose(boolean showMessage)
Check if the area controller may be freed. This method may be overriden by subclasses. The current implementation always returns true

Overrides:
canClose in class LyMultiAreaController
Parameters:
showMessage - indicates if the controller can show an warning message or not
Returns:
true if the free method can be called immediately, false otherwise.

checkIfModified

public boolean checkIfModified()
Check if the form content has been modified and if the object need to be created.

Specified by:
checkIfModified in interface LyFormInterface
Returns:
true if the form was modified

setRelationParent

public void setRelationParent(LyFormResultInterface client,
                              LyRelationFieldInfo relation)
Sets relation parent : this method is invoked when this form is a child of another form (dynamic popup creation of an object in a relation field).

Specified by:
setRelationParent in interface LyTransverseInterface
Parameters:
client - the client for the resulting operation
relation - the relation fieldInfo which is updated as the result of the current action (usually dynamic popup creation)

needUpdate

public boolean needUpdate()
Checks if this controller needs update.

Returns:
true if the controller needs to be updated

update

public boolean update()
This method is called by the view controller when this area is shown to update its content.

Overrides:
update in class LyMultiAreaController
Returns:
True if updated, false otherwise.

setObjectInternal

public void setObjectInternal(LyObject object)
Accessor to the _object parameter (with no control) Applications should use setObject(object) and not invoke this method directly.

Parameters:
object - new object being created.

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 LyFormSave save(boolean full)
Save form inputs.


restore

public boolean restore(LyFormSave formSave)
Restore form inputs.


getFormSave

public LyFormSave getFormSave()
Gets form save associated to this set controller.

Returns:
The current form save, can be null.

cancelChanges

public void cancelChanges()
Cancel all changes done in the form.


(c) January 2013 - W4 S.A.

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