5.5.1.1.4. Edit Screen
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.
By default, the standard CreateAction and EditAction open a screen, registered in screens.xml with the {entity_name}.edit
identifier, for example, sales$Customer.edit
.
Edit screen controller must be inherited from the AbstractEditor class.
Tip
|
You can create an edit screen for an entity in Studio using the Entity editor template. |
The 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:
-
editWindowActions
(filecom/haulmont/cuba/gui/edit-window.actions.xml
) – contains OK and Cancel buttons -
extendedEditWindowActions
(filecom/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 theWindow.Editor.WINDOW_COMMIT_AND_CLOSE
constant) – an action committing changes to the database and closing the screen. The action is initialized if the screen has a visual component withwindowCommitAndClose
identifier. The action is displayed as an OK & Close button when the mentioned above standardextendedEditWindowActions
frame is used. -
windowCommit
(corresponds to theWindow.Editor.WINDOW_COMMIT
constant) – an action which commits changes to the database. In absence ofwindowCommitAndClose
action, 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 theWindow.Editor.WINDOW_CLOSE
constant) – 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.