Package io.jmix.flowui.view
Class StandardDetailView<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<T>
io.jmix.flowui.view.View<ViewLayout>
io.jmix.flowui.view.StandardView
io.jmix.flowui.view.StandardDetailView<T>
- Type Parameters:
T- entity class
- 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.HasDynamicTitle,com.vaadin.flow.router.internal.AfterNavigationHandler,com.vaadin.flow.router.internal.BeforeEnterHandler,com.vaadin.flow.router.internal.BeforeLeaveHandler,ChangeTracker,DetailView<T>,ReadOnlyAwareView,Serializable
- Direct Known Subclasses:
EntityAttributeResourcePolicyModelDetailView,EntityInspectorDetailView,EntityResourcePolicyModelDetailView,GraphQLResourcePolicyModelDetailView,JobModelDetailView,MenuResourcePolicyModelDetailView,ResourcePolicyModelDetailView,ResourceRoleModelDetailView,RowLevelPolicyModelDetailView,RowLevelRoleModelDetailView,SpecificResourcePolicyModelDetailView,TenantDetailView,TriggerModelDetailView,ViewResourcePolicyModelDetailView
Base class of entity detail views.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent sent after saving the view data context.static classEvent sent before saving the view data context.static classEvent sent before the new entity instance is set to edited entity container.static classEvent sent when the view is validated on saving the view data context.Nested classes/interfaces inherited from class io.jmix.flowui.view.View
View.AfterCloseEvent, View.BeforeCloseEvent, View.BeforeShowEvent, View.InitEvent, View.QueryParametersChangeEvent, View.ReadyEvent -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.vaadin.flow.shared.RegistrationaddAfterSaveListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.AfterSaveEvent> listener) Adds a listener toStandardDetailView.AfterSaveEvent.protected com.vaadin.flow.shared.RegistrationaddBeforeSaveListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.BeforeSaveEvent> listener) Adds a listener toStandardDetailView.BeforeSaveEvent.protected com.vaadin.flow.shared.RegistrationaddInitEntityListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.InitEntityEvent<T>> listener) Adds a listener toStandardDetailView.InitEntityEvent.protected com.vaadin.flow.shared.RegistrationaddValidationEventListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.ValidationEvent> listener) Adds a listener toStandardDetailView.ValidationEvent.voidbeforeEnter(com.vaadin.flow.router.BeforeEnterEvent event) Discards changes and closes the view.Saves changes and closes the view.protected booleanprotected voidfindEntityId(com.vaadin.flow.router.BeforeEnterEvent event) protected InstanceContainer<T>protected InstanceLoader<T>protected Stringbooleanprotected voidinitExistingEntity(String serializedEntityId) protected voidinitNewEntity(Class<T> entityClass) booleanbooleanprotected booleanbooleanbooleansave()Saves changes.voidsetCrossFieldValidationEnabled(boolean crossFieldValidationEnabled) Sets whether cross-field validation should be performed before saving changes.voidsetEntityToEdit(T entity) Sets entity instance to the view.voidsetReadOnly(boolean readOnly) Changes the read-only mode.voidsetShowSaveNotification(boolean showSaveNotification) Sets whether a notification should be shown in case of successful save.voidsetShowValidationErrors(boolean showValidationErrors) Sets whether to indicate about errors after components validation.protected voidprotected voidsetupEntityToEdit(String serializedEntityId) protected voidsetupEntityToEdit(T entityToEdit) Methods inherited from class io.jmix.flowui.view.StandardView
initContentMethods inherited from class io.jmix.flowui.view.View
addAfterCloseListener, addBeforeCloseListener, addBeforeShowListener, addInitListener, addReadyListener, afterNavigation, beforeLeave, close, close, closeWithDefaultAction, getApplicationContext, getId, getPageTitle, getReturnParameters, getViewActions, getViewAttributes, getViewData, getViewFacets, getViewSupport, onDetach, setApplicationContext, setId, setViewActions, setViewData, setViewFacetsMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElementMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onEnabledStateChanged, scrollIntoView, set, setElement, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
Field Details
-
NEW_ENTITY_ID
- See Also:
-
DEFAULT_ROUTE_PARAM
- See Also:
-
MODE_PARAM
- See Also:
-
MODE_READONLY
- See Also:
-
LOCKED_BEFORE_REFRESH_ATTR_NAME
- See Also:
-
READ_ONLY_BEFORE_REFRESH_ATTR_NAME
- See Also:
-
-
Constructor Details
-
StandardDetailView
public StandardDetailView()Create views usingViewNavigatorsorDialogWindows.
-
-
Method Details
-
beforeEnter
public void beforeEnter(com.vaadin.flow.router.BeforeEnterEvent event) - Specified by:
beforeEnterin interfacecom.vaadin.flow.router.internal.BeforeEnterHandler- Overrides:
beforeEnterin classView<ViewLayout>
-
findEntityId
protected void findEntityId(com.vaadin.flow.router.BeforeEnterEvent event) -
getRouteParamName
-
isSaveActionPerformed
protected boolean isSaveActionPerformed() -
save
Description copied from interface:DetailViewSaves changes.- Specified by:
savein interfaceDetailView<T>
-
closeWithSave
Description copied from interface:DetailViewSaves changes and closes the view.- Specified by:
closeWithSavein interfaceDetailView<T>
-
closeWithDiscard
Description copied from interface:DetailViewDiscards changes and closes the view.- Specified by:
closeWithDiscardin interfaceDetailView<T>
-
isShowSaveNotification
public boolean isShowSaveNotification()- Returns:
- whether a notification will be shown in case of successful save
-
setShowSaveNotification
public void setShowSaveNotification(boolean showSaveNotification) Sets whether a notification should be shown in case of successful save. The default value istrue.- Parameters:
showSaveNotification-trueif a notification should be shown,falseotherwise
-
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-trueif notification needs to be shown,falseotherwise
-
isCrossFieldValidationEnabled
public boolean isCrossFieldValidationEnabled()- Returns:
trueif cross-field validation is enabled
-
setCrossFieldValidationEnabled
public void setCrossFieldValidationEnabled(boolean crossFieldValidationEnabled) Sets whether cross-field validation should be performed before saving changes. It usesUiCrossFieldChecksconstraint group to validate bean instance. The default value istrue.- Parameters:
crossFieldValidationEnabled-trueif cross-field should be enabled,falseotherwise
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnlyin interfaceReadOnlyAwareView- Returns:
- whether a view is in read-only mode.
-
setReadOnly
public void setReadOnly(boolean readOnly) Description copied from interface:ReadOnlyAwareViewChanges the read-only mode.- Specified by:
setReadOnlyin interfaceReadOnlyAwareView- Parameters:
readOnly-trueto enable the read-only mode,falseotherwise
-
hasUnsavedChanges
public boolean hasUnsavedChanges()- Specified by:
hasUnsavedChangesin interfaceChangeTracker- Returns:
trueif the view has unsaved changes
-
getEditedEntityContainer
-
getEditedEntityLoader
-
getEditedEntity
- Specified by:
getEditedEntityin interfaceDetailView<T>- Returns:
- currently edited entity instance
-
setEntityToEdit
Description copied from interface:DetailViewSets entity instance to the view.- Specified by:
setEntityToEditin interfaceDetailView<T>- Parameters:
entity- entity to edit
-
setupEntityToEdit
protected void setupEntityToEdit() -
setupEntityToEdit
-
initNewEntity
-
initExistingEntity
-
entityCanBeLoaded
protected boolean entityCanBeLoaded() -
setupEntityToEdit
-
getPessimisticLockStatus
- Specified by:
getPessimisticLockStatusin interfaceDetailView<T>- Returns:
- lock status of the 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 view is opened.
- See Also:
-
addInitEntityListener
protected com.vaadin.flow.shared.Registration addInitEntityListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.InitEntityEvent<T>> listener) Adds a listener toStandardDetailView.InitEntityEvent.- Parameters:
listener- listener- Returns:
- registration object for removing the listener
-
addBeforeSaveListener
protected com.vaadin.flow.shared.Registration addBeforeSaveListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.BeforeSaveEvent> listener) Adds a listener toStandardDetailView.BeforeSaveEvent.- Parameters:
listener- listener- Returns:
- registration object for removing the listener
-
addAfterSaveListener
protected com.vaadin.flow.shared.Registration addAfterSaveListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.AfterSaveEvent> listener) Adds a listener toStandardDetailView.AfterSaveEvent.- Parameters:
listener- listener- Returns:
- registration object for removing the listener
-
addValidationEventListener
protected com.vaadin.flow.shared.Registration addValidationEventListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.ValidationEvent> listener) Adds a listener toStandardDetailView.ValidationEvent.- Parameters:
listener- listener- Returns:
- registration object for removing the listener
-