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 requests an external lock, if one is defined.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 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
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.protected void
setReloadEdited
(boolean reloadEdited) Sets whether the edited entity should be reloaded before setting to the data container.void
setReloadSaved
(boolean reloadSaved) Sets whether edited entity should be reloaded after closeWithSave action.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
Invoked onView.BeforeShowEvent
both when the view is opened by navigation and in dialog window.protected void
setupEntityToEdit
(String serializedEntityId) Invoked when the view is opened by navigation.protected void
setupEntityToEdit
(T entityToEdit) Invoked when the view is opened in dialog window or when the view is opened by navigation andsetEntityToEdit(Object)
method is called inAfterViewNavigationEvent
handler.protected ValidationErrors
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, setMeterRegistry, 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:
-
reloadSaved
protected boolean reloadSaved
-
-
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
-
validateView
-
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()Invoked onView.BeforeShowEvent
both when the view is opened by navigation and in dialog window. -
setupEntityToEdit
Invoked when the view is opened by navigation.- Parameters:
serializedEntityId
- serialized id of the edited entity orNEW_ENTITY_ID
when creating new entity
-
initNewEntity
-
initExistingEntity
-
setupEntityToEdit
Invoked when the view is opened in dialog window or when the view is opened by navigation andsetEntityToEdit(Object)
method is called inAfterViewNavigationEvent
handler.- Parameters:
entityToEdit
- entity instance to edit. Can be a new instance when the entity is being created, seeEntityStates.isNew(Object)
.
-
getLockStatus
- Specified by:
getLockStatus
in interfaceDetailView<T>
- Returns:
- lock status of the currently edited entity instance. Possible variants:
LockStatus.NOT_SUPPORTED
- if the entity does not support lock.LockStatus.LOCKED
- if the entity instance is successfully locked.LockStatus.FAILED
- if the entity instance has been locked when the view is opened.
-
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
-
isReloadEdited
protected boolean isReloadEdited()- Returns:
- true if the edited entity should be reloaded before setting to the data container.
-
setReloadEdited
protected void setReloadEdited(boolean reloadEdited) Sets whether the edited entity should be reloaded before setting to the data container. True by default.Set to false in the view constructor or
InitEvent
handler if the view is opened in dialog mode and the entity should not be loaded by ID from a data storage. -
isReloadSaved
public boolean isReloadSaved()- Specified by:
isReloadSaved
in interfaceDetailView<T>
- Returns:
- true if edited entity should be reloaded after closeWithSave action, false otherwise
-
setReloadSaved
public void setReloadSaved(boolean reloadSaved) Description copied from interface:DetailView
Sets whether edited entity should be reloaded after closeWithSave action.- Specified by:
setReloadSaved
in interfaceDetailView<T>
- Parameters:
reloadSaved
- flag indicating whether edited entity should be reloaded after closeWithSave action
-