LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control
Class LyCreateController

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
                          extended by leon.control.LyCreateController
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:
LyCreateOrSetController

public class LyCreateController
extends LySetController

This class describes the controller associated to a creation form.

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

This form controller may have an object as a model (in that case the action is a creation ('clone') keeping some current values of the model. (Creation by copy).

Usually the creation form is not associated with any object but specified a LyClassInfo parameter : the object will be created in this application class.

Services supported by the LyCreateController :

See Also:
LyClassBehavior, LyConsultController, LySetBuilder, LyCreateBuilder, LyCreateBehaviorInterface

Field Summary
static java.lang.String __VERSION
          File version
 
Fields inherited from class leon.control.LySetController
_valueChange
 
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
LyCreateController(LySession session, LyController parent, LyAction action, LyClassInfo classInfo, LyObjectList objects)
          Constructor.
 
Method Summary
 boolean checkIfModified()
          Check if the form content has been modified and if the object need to be created.
 void commit()
          Method called when all modifications are committed.
 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 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.
 LyObject getLastCreatedObject()
          Last Object (if any) that was created by this controller.
 LyObject getModel()
          Accessor to the model for a clone operation.
 LyObjectList getObjectList()
          Accessor to the list of objects associated with this form.
 LyController getParent()
          Accessor to the reference to the parent controller.
 boolean isCreateIfModified()
          The creation is requested only if at least one field has been modified.
 boolean isCreation()
          Returns a boolean indicating if the action is or not a creation.
 boolean objectRemoved(LyWorkSpaceEvent event)
          Called when an object is removed from the dynamic object list.
 void resetFieldInfoErrors(LyFieldInfo fieldInfo)
          Reset fieldInfo errors on _object for fieldInfo.
 void resetFromObject(LyObject object, boolean freeOldValue, boolean createNewValue)
          Sets the form content from the specified object : all field controllers and form fields take the specified value.
 boolean setContext(LyWorkSpace context)
          Set current controller context.
 void setCreateIfModified(boolean b)
          The creation is requested only if at least one field has been modified.
 boolean setObject(LyObject object)
          Sets current model for the creation.
 void showError(LyObject object, LyError error)
          Show an error for the specified object.
 short startValidate()
          Start validation of the form.
 void subFormsCommit()
          Commit sub-forms.
 void updateObject(LyValueSet oldValues)
          Called when current object has changed .
 short validate(boolean free)
          The form is closing and we check the values typed in by the user.
 
Methods inherited from class leon.control.LySetController
actionDemand, addTempFilePath, apply, cancel, cancelChanges, canClose, canFree, clear, clearViewCache, computeFieldValue, execRule, fieldControllerFactory, getControllerContext, getFields, getFieldValue, getFormSave, getSetBehavior, getState, getUnit, getValue, isApplied, isConsult, isDisplayed, isEditable, isEditable, isEnabled, isHidden, isOptional, isValid, needUpdate, notifyFormResult, objectChanged, questionAnswer, reset, restore, save, setContextInternal, setEditable, setEditable, setEnabled, setEnabled, setFastEditedField, setFieldValue, setFieldValue, setFieldValue, setHidden, setLabel, setObjectInternal, setOptional, setRelationParent, setValid, showError, subFormsCancel, update, update, updateValues, updateViewContent, updateViewFromValues, valueChanged
 
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, getSelection, getState, getTabs, isChangingObject, isComposition, isViewResizable, objectAdded, objectStateChanged, objectUserEvent, reset, resetFormContent, setActiveField, setCompositionRelation, 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, 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
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version

See Also:
Constant Field Values
Constructor Detail

LyCreateController

public LyCreateController(LySession session,
                          LyController parent,
                          LyAction action,
                          LyClassInfo classInfo,
                          LyObjectList objects)
Constructor.

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 not used (introspection mechanisms).
objects - model used as the base of the creation form. Only the first object in the list is considered. (creation by copy)
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 LySetController
Returns:
Class representing the behavior interface of this controller.

free

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

Overrides:
free in class LySetController
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()

getParent

public LyController getParent()
Accessor to the reference to the parent controller.

Overrides:
getParent in class LyAreaController
Returns:
the parent controller instance or null for root controllers.

setObject

public boolean setObject(LyObject object)
Sets current model for the creation.

Reset default values of the form.

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

updateObject

public void updateObject(LyValueSet oldValues)
Called when current object has changed . Keep the overall content consistent.

Overrides:
updateObject in class LySetController
Parameters:
oldValues - set of former values, or null if not specified.

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
Overrides:
startValidate in class LySetController
Returns:
the status of the controller
See Also:
LyClassBehavior.addExtraValues(leon.control.LySetController, leon.data.LyValueSet), LyClassBehavior.controlNewValues(leon.control.LySetController, leon.data.LyValueSet)

endValidate

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

Specified by:
endValidate in interface LyFormInterface
Overrides:
endValidate in class LySetController
Returns:
The status of the controller
See Also:
LyFormInterface

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
Overrides:
checkIfModified in class LySetController
Returns:
true if the form content was modified

commit

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

Specified by:
commit in interface LyFormInterface
Overrides:
commit in class LySetController

subFormsCommit

public void subFormsCommit()
Commit sub-forms.

Overrides:
subFormsCommit in class LySetController

isCreation

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

Overrides:
isCreation in class LySetController
Returns:
true if the form is a creation form. Always return TRUE.

getObjectList

public LyObjectList getObjectList()
Accessor to the list of objects associated with this form. This list may be null.

Overrides:
getObjectList in class LyFormController
Returns:
the list of objects for this controller

isCreateIfModified

public boolean isCreateIfModified()
The creation is requested only if at least one field has been modified.

Returns:
current status

setCreateIfModified

public void setCreateIfModified(boolean b)
The creation is requested only if at least one field has been modified.

Parameters:
b - new status

setContext

public boolean setContext(LyWorkSpace context)
Set current controller context.

Specified by:
setContext in interface LyContextInterface
Overrides:
setContext in class LyFormController
Parameters:
context - context or null if none is specified
Returns:
true if successfull
See Also:
LyContextInterface.getContext()

getModel

public LyObject getModel()
Accessor to the model for a clone operation.

Overrides:
getModel in class LySetController
Returns:
the model object

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 :

Overrides:
validate in class LySetController
Parameters:
free - indicates if the form is closed and freed after a successful validation.
Returns:
the status of the controller
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)

objectRemoved

public boolean objectRemoved(LyWorkSpaceEvent event)
Called when an object is removed from the dynamic object list. Keep content consistent : go to next available object if any or close the view.

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

showError

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

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

resetFieldInfoErrors

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

Overrides:
resetFieldInfoErrors in class LySetController
Parameters:
fieldInfo -

control

public short control()
Controls current edition.

Specified by:
control in interface LyFormInterface
Overrides:
control in class LySetController
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
Overrides:
contextEnded in class LySetController
Parameters:
context - Context ended.
brother - Brother context that ended the given context.

resetFromObject

public void resetFromObject(LyObject object,
                            boolean freeOldValue,
                            boolean createNewValue)
Sets the form content from the specified object : all field controllers and form fields take the specified value. Any value modified by the user is the form is lost. Unlike setObject() and updateFielditem(), no control is done to prevent overriding existing values.

Overrides:
resetFromObject in class LyFormController
Parameters:
object - new object used to reset the view content. If the param is null, a clone of the object is created.
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

getLastCreatedObject

public LyObject getLastCreatedObject()
Last Object (if any) that was created by this controller. This is used for multiple creation to get last creation. unlike, _object and _newObject, the last created object is no longer used by this controller and is available until this controller is freed.

Returns:
the last created object (by this controller)

(c) January 2013 - W4 S.A.

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