EditAction
is an action with edit identifier, intended to open an edit screen for a selected entity instance. If the edit screen successfully commits the instance
to the database, then EditAction
updates this instance in the table data source.
The following specific methods are defined in the EditAction
class:
-
setOpenType()
allows you to specify entity edit screen open mode.THIS_TAB
by default.Since it is quite often required to open edit screens in another mode (typically
DIALOG
), you can specifyopenType
attribute with desired value in theaction
element when creating the action declaratively. This eliminates the need to obtain action reference in the controller and set this property programmatically. For example:<table id="usersTable"> <actions> <action id="edit" openType="DIALOG"/>
-
setWindowId()
allows you to specify entity edit screen identifier.{entity_name}.edit
is used by default, for example,sales$Customer.edit
. -
setWindowParams()
allows you to set edit screen parameters, passed to itsinit()
method. -
afterCommit()
is invoked by the action after the entity has been successfully committed and the edit screen has been closed. This method does not have implementation and can be overridden in inheritors to handle this event. -
setAfterCommitHandler()
allows you to provide a handler which will be called after the new entity has been successfully committed and the edit screen has been closed. This handler can be used instead of overridingafterCommit()
to avoid creating the action subclass. For example:@Named("customersTable.edit") private EditAction customersTableEdit; @Override public void init(Map<String, Object> params) { customersTableEdit.setAfterCommitHandler(new EditAction.AfterCommitHandler() { @Override public void handle(Entity entity) { showNotification("Committed", NotificationType.HUMANIZED); } }); }
-
afterWindowClosed()
is the last method invoked by the action after closing the edit screen regardless of whether the edited entity has been committed or not. This method does not have implementation and can be overridden in inheritors to handle this event. -
setAfterWindowClosedHandler()
allows you to provide a handler which will be called after closing the edit screen regardless of whether the new entity has been committed or not. This handler can be used instead of overridingafterWindowClosed()
to avoid creating the action subclass.