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.component.HasStyle
,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:
AdditionalBusinessDayDetailView
,AssignmentDetailsPropertiesFragment
,BusinessCalendarDetailView
,CandidateGroupsEditView
,CandidateUsersEditView
,CategoryAttributesDetailView
,CategoryDetailView
,ContentStorageDetailView
,DmnDecisionTableDetailView
,EmailAttachmentEdit
,EntityAttributeEdit
,EntityAttributeResourcePolicyModelDetailView
,EntityInspectorDetailView
,EntityResourcePolicyModelDetailView
,ErrorDefinitionEdit
,ErrorRefPropertiesFragment
,EventListenerEdit
,ExecutionListenerEdit
,ExtensionPropertyEdit
,FieldEdit
,FilterConditionDetailView
,FormFieldEdit
,FormOutcomeEdit
,FormParamEdit
,GraphQLResourcePolicyModelDetailView
,HitPolicySelectView
,HolidayDetailView
,InAppNotificationDetailView
,InOutBindingModelEdit
,InputDefinitionDetailView
,InputEntryDetailView
,JobDataDetailView
,JobModelDetailView
,JpqlParameterEdit
,MBeanAttributeDetailView
,MBeanInfoDetailView
,MenuResourcePolicyModelDetailView
,MessageDefinitionEdit
,MultiInstanceLoopCharacteristicsPropertiesFragment
,OutputDefinitionDetailView
,ProcessDefinitionDetailView
,ProcessInstanceDetailView
,ProcessVariableEdit
,QueryParameterDetailView
,ReportDetailView
,ReportGroupDetailView
,ReportParameterDetailView
,ReportRegionWizardDetailView
,ReportTemplateDetailView
,ReportValueFormatDetailView
,ResourcePolicyModelDetailView
,ResourceRoleModelDetailView
,RowLevelPolicyModelDetailView
,RowLevelRoleModelDetailView
,ScheduledBusinessDayDetailView
,ScriptEditor
,SignalDefinitionEdit
,SpecificResourcePolicyModelDetailView
,TaskListenerEdit
,TenantDetailView
,TriggerModelDetailView
,UserGroupDetailView
,UserSubstitutionDetailView
,VariableInstanceDataDetail
,ViewResourcePolicyModelDetailView
,WebdavDocumentCollectionDetailView
,WebdavShowDocumentVersionsDetailView
Base class of entity detail views.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Event sent after saving the view data context.static class
Event sent before saving the view data context.static class
Event sent before the new entity instance is set to edited entity container.static class
Event 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected com.vaadin.flow.shared.Registration
addAfterSaveListener
(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.AfterSaveEvent> listener) Adds a listener toStandardDetailView.AfterSaveEvent
.protected com.vaadin.flow.shared.Registration
addBeforeSaveListener
(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.BeforeSaveEvent> listener) Adds a listener toStandardDetailView.BeforeSaveEvent
.protected com.vaadin.flow.shared.Registration
addInitEntityListener
(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.InitEntityEvent<T>> listener) Adds a listener toStandardDetailView.InitEntityEvent
.protected com.vaadin.flow.shared.Registration
addValidationEventListener
(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.ValidationEvent> listener) Adds a listener toStandardDetailView.ValidationEvent
.void
beforeEnter
(com.vaadin.flow.router.BeforeEnterEvent event) Discards changes and closes the view.Saves changes and closes the view.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) boolean
boolean
protected boolean
boolean
boolean
save()
Saves changes.void
setCrossFieldValidationEnabled
(boolean crossFieldValidationEnabled) Sets whether cross-field validation should be performed before saving changes.void
setEntityToEdit
(T entity) Sets entity instance to the view.void
setReadOnly
(boolean readOnly) Changes the read-only mode.void
setShowSaveNotification
(boolean showSaveNotification) Sets whether a notification should be shown in case of successful save.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) Methods inherited from class io.jmix.flowui.view.StandardView
initContent
Methods inherited from class io.jmix.flowui.view.View
addAfterCloseListener, addBeforeCloseListener, addBeforeShowListener, addInitListener, addQueryParametersChangeListener, addReadyListener, afterNavigation, beforeLeave, close, close, closeWithDefaultAction, getApplicationContext, getId, getPageTitle, getReturnParameters, getViewActions, getViewAttributes, getViewData, getViewFacets, getViewSupport, isPreventBrowserTabClosing, onAttach, onDetach, setApplicationContext, setId, setPreventBrowserTabClosing, setViewActions, setViewData, setViewFacets
Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement
Methods 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, onEnabledStateChanged, removeFromParent, scrollIntoView, 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
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
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 usingViewNavigators
orDialogWindows
.
-
-
Method Details
-
beforeEnter
public void beforeEnter(com.vaadin.flow.router.BeforeEnterEvent event) - Specified by:
beforeEnter
in interfacecom.vaadin.flow.router.internal.BeforeEnterHandler
- Overrides:
beforeEnter
in classView<ViewLayout>
-
findEntityId
protected void findEntityId(com.vaadin.flow.router.BeforeEnterEvent event) -
getRouteParamName
-
isSaveActionPerformed
protected boolean isSaveActionPerformed() -
save
Description copied from interface:DetailView
Saves changes.- Specified by:
save
in interfaceDetailView<T>
-
closeWithSave
Description copied from interface:DetailView
Saves changes and closes the view.- Specified by:
closeWithSave
in interfaceDetailView<T>
-
closeWithDiscard
Description copied from interface:DetailView
Discards changes and closes the view.- Specified by:
closeWithDiscard
in 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
-true
if a notification should 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 saving 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 interfaceReadOnlyAwareView
- Returns:
- whether a view is in read-only mode.
-
setReadOnly
public void setReadOnly(boolean readOnly) Description copied from interface:ReadOnlyAwareView
Changes the read-only mode.- Specified by:
setReadOnly
in interfaceReadOnlyAwareView
- Parameters:
readOnly
-true
to enable the read-only mode,false
otherwise
-
hasUnsavedChanges
public boolean hasUnsavedChanges()- Specified by:
hasUnsavedChanges
in interfaceChangeTracker
- Returns:
true
if the view has unsaved changes
-
getEditedEntityContainer
-
getEditedEntityLoader
-
getEditedEntity
- Specified by:
getEditedEntity
in interfaceDetailView<T>
- Returns:
- currently edited entity instance
-
setEntityToEdit
Description copied from interface:DetailView
Sets entity instance to the view.- Specified by:
setEntityToEdit
in interfaceDetailView<T>
- Parameters:
entity
- entity to edit
-
setupEntityToEdit
protected void setupEntityToEdit() -
setupEntityToEdit
-
initNewEntity
-
initExistingEntity
-
entityCanBeLoaded
protected boolean entityCanBeLoaded() -
setupEntityToEdit
-
getPessimisticLockStatus
- Specified by:
getPessimisticLockStatus
in 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
-