184.108.40.206.4. Edit Screen
This is a legacy API. For new data API available since release 7.0, see Screen Controllers.
Edit screen is designed to display and edit entity instances. It initializes the instance being edited and contains actions for committing changes to the database. Edit screen should be opened by the
openEditor() method accepting an entity instance as an argument.
Edit screen controller must be inherited from the AbstractEditor class.
You can create an edit screen for an entity in Studio using the Entity editor template.
datasource attribute of a screen’s XML should refer to a datasource containing the edited entity instance. The following standard button frames in the XML can be used to display actions that commit or cancel changes:
com/haulmont/cuba/gui/edit-window.actions.xml) – contains OK and Cancel buttons
com/haulmont/cuba/gui/extended-edit-window.actions.xml) – contains OK & Close, OK and Cancel
The following actions are implicitly initialized in the edit screen:
windowCommitAndClose(corresponds to the
Window.Editor.WINDOW_COMMIT_AND_CLOSEconstant) – an action committing changes to the database and closing the screen. The action is initialized if the screen has a visual component with
windowCommitAndCloseidentifier. The action is displayed as an OK & Close button when the mentioned above standard
extendedEditWindowActionsframe is used.
windowCommit(corresponds to the
Window.Editor.WINDOW_COMMITconstant) – an action which commits changes to the database. In absence of
windowCommitAndCloseaction, closes the screen after committing. The action is always displayed as an OK button if the screen has the abovementioned standard frames.
windowClose(corresponds to the
Window.Editor.WINDOW_CLOSEconstant) – which closes the screen without committing any changes. The action is always initialized. If the screen has the abovementioned standard frames, it is displayed as Cancel button.
Thus, if the screen contains an
editWindowActions frame, the OK button commits the changes and closes the screen, and the Cancel button – closes the screen without committing the changes. If the screen contains an
extendedEditWindowActions frame, the OK button only commits the changes, OK & Close button commits the changes and closes the screen, and the Cancel button closes the screen without committing the changes.
Instead of standard frames, the actions can be visualized using arbitrary components, for example, LinkButton.