Package io.jmix.flowui.screen
Class StandardEditor<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<T>
io.jmix.flowui.screen.Screen<ScreenLayout>
io.jmix.flowui.screen.StandardScreen
io.jmix.flowui.screen.StandardEditor<T>
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.router.AfterNavigationObserver
,com.vaadin.flow.router.BeforeEnterObserver
,com.vaadin.flow.router.BeforeLeaveObserver
,com.vaadin.flow.router.internal.AfterNavigationHandler
,com.vaadin.flow.router.internal.BeforeEnterHandler
,com.vaadin.flow.router.internal.BeforeLeaveHandler
,ChangeTracker
,EditorScreen<T>
,ReadOnlyAwareScreen
,Serializable
public class StandardEditor<T>
extends StandardScreen
implements EditorScreen<T>, ReadOnlyAwareScreen
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Event sent after commit of data context fromcommitChanges()
call.static class
Event sent before commit of data context fromcommitChanges()
call.static class
Event sent before the new entity instance is set to edited entity container.static class
Event sent when screen is validated fromvalidateAdditionalRules()
call.Nested classes/interfaces inherited from class io.jmix.flowui.screen.Screen
Screen.AfterCloseEvent, Screen.AfterShowEvent, Screen.BeforeCloseEvent, Screen.BeforeShowEvent, Screen.InitEvent
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected com.vaadin.flow.shared.Registration
addAfterCommitChangesListener
(com.vaadin.flow.component.ComponentEventListener<StandardEditor.AfterCommitChangesEvent> listener) protected com.vaadin.flow.shared.Registration
addBeforeCommitChangesListener
(com.vaadin.flow.component.ComponentEventListener<StandardEditor.BeforeCommitChangesEvent> listener) protected com.vaadin.flow.shared.Registration
addInitEntityListener
(com.vaadin.flow.component.ComponentEventListener<StandardEditor.InitEntityEvent<T>> listener) void
beforeEnter
(com.vaadin.flow.router.BeforeEnterEvent event) commit()
protected OperationResult
protected boolean
protected void
findEntityId
(com.vaadin.flow.router.BeforeEnterEvent event) protected InstanceContainer<T>
protected InstanceLoader<T>
protected String
boolean
protected void
initExistingEntity
(String serializedEntityId) protected void
initNewEntity
(Class<T> entityClass) protected boolean
boolean
protected boolean
protected boolean
isEntityModifiedRecursive
(Object entity, DataContext dataContext, HashSet<Object> visited) protected boolean
isLocked()
protected boolean
boolean
protected boolean
boolean
boolean
protected void
onChangeEvent
(DataContext.ChangeEvent changeEvent) protected void
onPostCommitEvent
(DataContext.PostCommitEvent postCommitEvent) protected void
protected void
void
setCrossFieldValidationEnabled
(boolean crossFieldValidationEnabled) Sets whether cross-field validation should be performed before commit changes.void
setEntityToEdit
(T entity) Sets entity instance to editor.protected void
setModifiedAfterOpen
(boolean entityModified) void
setReadOnly
(boolean readOnly) Changes the read-only mode.void
setShowSaveNotification
(boolean showSaveNotification) Sets whether a notification will be shown in case of successful commit.void
setShowValidationErrors
(boolean showValidationErrors) Sets whether to indicate about errors after components validation.protected void
protected void
setupEntityToEdit
(String serializedEntityId) protected void
setupEntityToEdit
(T entityToEdit) protected void
protected void
protected ValidationErrors
protected ValidationErrors
protected ValidationErrors
Methods inherited from class io.jmix.flowui.screen.StandardScreen
initContent
Methods inherited from class io.jmix.flowui.screen.Screen
addAfterCloseListener, addAfterShowListener, addBeforeCloseListener, addBeforeShowListener, addInitListener, afterNavigation, beforeLeave, close, close, closeWithDefaultAction, getApplicationContext, getId, getScreenActions, getScreenData, getScreenFacets, removeApplicationListeners, setApplicationContext, setId, setScreenActions, setScreenData, setScreenFacets, unregisterBackNavigation, updatePageTitle
Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getEventBus, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
Field Details
-
NEW_ENTITY_ID
- See Also:
-
showSaveNotification
protected boolean showSaveNotification -
commitActionPerformed
protected boolean commitActionPerformed
-
-
Constructor Details
-
StandardEditor
public StandardEditor()
-
-
Method Details
-
setupModifiedTracking
protected void setupModifiedTracking() -
onChangeEvent
-
onPostCommitEvent
-
getSaveNotificationText
-
beforeEnter
public void beforeEnter(com.vaadin.flow.router.BeforeEnterEvent event) - Specified by:
beforeEnter
in interfacecom.vaadin.flow.router.internal.BeforeEnterHandler
- Overrides:
beforeEnter
in classScreen<ScreenLayout>
-
findEntityId
protected void findEntityId(com.vaadin.flow.router.BeforeEnterEvent event) -
commitChanges
-
validateScreen
-
validateUiComponents
-
validateAdditionalRules
-
isCommitActionPerformed
protected boolean isCommitActionPerformed() -
commit
- Specified by:
commit
in interfaceEditorScreen<T>
-
closeWithCommit
- Specified by:
closeWithCommit
in interfaceEditorScreen<T>
-
closeWithDiscard
- Specified by:
closeWithDiscard
in interfaceEditorScreen<T>
-
isShowSaveNotification
public boolean isShowSaveNotification()- Returns:
- whether a notification will be shown in case of successful commit
-
setShowSaveNotification
public void setShowSaveNotification(boolean showSaveNotification) Sets whether a notification will be shown in case of successful commit.- Parameters:
showSaveNotification
-true
if a notification needs to be shown,false
otherwise
-
isShowValidationErrors
public boolean isShowValidationErrors()- Returns:
- whether to indicate about errors after components validation
-
setShowValidationErrors
public void setShowValidationErrors(boolean showValidationErrors) Sets whether to indicate about errors after components validation. The default value istrue
.- Parameters:
showValidationErrors
-true
if notification needs to be shown,false
otherwise
-
isCrossFieldValidationEnabled
public boolean isCrossFieldValidationEnabled()- Returns:
true
if cross-field validation is enabled
-
setCrossFieldValidationEnabled
public void setCrossFieldValidationEnabled(boolean crossFieldValidationEnabled) Sets whether cross-field validation should be performed before commit changes. It usesUiCrossFieldChecks
constraint group to validate bean instance. The default value istrue
.- Parameters:
crossFieldValidationEnabled
-true
if cross-field should be enabled,false
otherwise
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnly
in interfaceReadOnlyAwareScreen
- Returns:
- whether a screen controller in read-only mode.
-
setReadOnly
public void setReadOnly(boolean readOnly) Description copied from interface:ReadOnlyAwareScreen
Changes the read-only mode.- Specified by:
setReadOnly
in interfaceReadOnlyAwareScreen
- Parameters:
readOnly
-true
to enable the read-only mode,false
otherwise
-
preventUnsavedChanges
-
hasUnsavedChanges
public boolean hasUnsavedChanges()- Specified by:
hasUnsavedChanges
in interfaceChangeTracker
- Returns:
true
if screen has unsaved changes
-
getEditedEntityContainer
-
getEditedEntityLoader
-
getEditedEntity
- Specified by:
getEditedEntity
in interfaceEditorScreen<T>
- Returns:
- currently edited entity instance
-
setEntityToEdit
Description copied from interface:EditorScreen
Sets entity instance to editor.- Specified by:
setEntityToEdit
in interfaceEditorScreen<T>
- Parameters:
entity
- entity
-
setupEntityToEdit
protected void setupEntityToEdit() -
setupEntityToEdit
-
initNewEntity
-
initExistingEntity
-
setupEntityToEdit
-
doNotReloadEditedEntity
protected boolean doNotReloadEditedEntity() -
isEntityModifiedInParentContext
protected boolean isEntityModifiedInParentContext() -
isEntityModifiedRecursive
protected boolean isEntityModifiedRecursive(Object entity, DataContext dataContext, HashSet<Object> visited) -
setupLock
protected void setupLock() -
releaseLock
protected void releaseLock() -
getPessimisticLockStatus
- Specified by:
getPessimisticLockStatus
in interfaceEditorScreen<T>
- Returns:
- lock status of currently edited entity instance. Possible variants:
PessimisticLockStatus.NOT_SUPPORTED
- if the entity does not support pessimistic lock.PessimisticLockStatus.LOCKED
- if the entity instance is successfully locked.PessimisticLockStatus.FAILED
- if the entity instance has been locked when the screen is opened.
- See Also:
-
isReadOnlyDueToLock
protected boolean isReadOnlyDueToLock()- Returns:
true
if the editor switched to read-only mode because the entity is locked by another user
-
isLocked
protected boolean isLocked()- Returns:
true
if the entity instance has been pessimistically locked when the screen is opened
-
setModifiedAfterOpen
protected void setModifiedAfterOpen(boolean entityModified) -
isModifiedAfterOpen
protected boolean isModifiedAfterOpen()- Returns:
true
if data is modified after screen opening
-
addInitEntityListener
protected com.vaadin.flow.shared.Registration addInitEntityListener(com.vaadin.flow.component.ComponentEventListener<StandardEditor.InitEntityEvent<T>> listener) -
addBeforeCommitChangesListener
protected com.vaadin.flow.shared.Registration addBeforeCommitChangesListener(com.vaadin.flow.component.ComponentEventListener<StandardEditor.BeforeCommitChangesEvent> listener) -
addAfterCommitChangesListener
protected com.vaadin.flow.shared.Registration addAfterCommitChangesListener(com.vaadin.flow.component.ComponentEventListener<StandardEditor.AfterCommitChangesEvent> listener)
-