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,FragmentOwner,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
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 requests an external lock, if one is defined.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 voidfindEntityId(com.vaadin.flow.router.BeforeEnterEvent event) protected InstanceContainer<T>protected InstanceLoader<T>protected Stringprotected Stringbooleanprotected voidinitExistingEntity(String serializedEntityId) protected voidinitNewEntity(Class<T> entityClass) booleanbooleanprotected booleanbooleanprotected booleanbooleanbooleanprotected voidsave()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.protected voidsetReloadEdited(boolean reloadEdited) Sets whether the edited entity should be reloaded before setting to the data container.voidsetReloadSaved(boolean reloadSaved) Sets whether edited entity should be reloaded after closeWithSave action.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 voidInvoked onView.BeforeShowEventboth when the view is opened by navigation and in dialog window.protected voidsetupEntityToEdit(String serializedEntityId) Invoked when the view is opened by navigation.protected voidsetupEntityToEdit(T entityToEdit) Invoked when the view is opened in dialog window or when the view is opened by navigation andsetEntityToEdit(Object)method is called inAfterViewNavigationEventhandler.protected ValidationErrorsMethods inherited from class io.jmix.flowui.view.StandardView
initContentMethods 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, removeApplicationListeners, removeViewAttributes, setApplicationContext, setId, setMeterRegistry, setPreventBrowserTabClosing, setViewActions, setViewData, setViewFacets, unregisterBackNavigationMethods 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, onEnabledStateChanged, removeFromParent, scrollIntoView, 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
addDetachListenerMethods 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 usingViewNavigatorsorDialogWindows.
-
-
Method Details
-
onDetachInternal
protected void onDetachInternal()- Overrides:
onDetachInternalin classView<ViewLayout>
-
getSaveNotificationText
-
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
-
validateView
-
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()Invoked onView.BeforeShowEventboth 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_IDwhen 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 inAfterViewNavigationEventhandler.- Parameters:
entityToEdit- entity instance to edit. Can be a new instance when the entity is being created, seeEntityStates.isNew(Object).
-
getLockStatus
- Specified by:
getLockStatusin 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
InitEventhandler 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:
isReloadSavedin 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:DetailViewSets whether edited entity should be reloaded after closeWithSave action.- Specified by:
setReloadSavedin interfaceDetailView<T>- Parameters:
reloadSaved- flag indicating whether edited entity should be reloaded after closeWithSave action
-