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

public class StandardDetailView<T> extends StandardView implements DetailView<T>, ReadOnlyAwareView
Base class of entity detail views.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • onDetachInternal

      protected void onDetachInternal()
      Overrides:
      onDetachInternal in class View<ViewLayout>
    • getSaveNotificationText

      protected String getSaveNotificationText()
    • beforeEnter

      public void beforeEnter(com.vaadin.flow.router.BeforeEnterEvent event)
      Specified by:
      beforeEnter in interface com.vaadin.flow.router.internal.BeforeEnterHandler
      Overrides:
      beforeEnter in class View<ViewLayout>
    • findEntityId

      protected void findEntityId(com.vaadin.flow.router.BeforeEnterEvent event)
    • getRouteParamName

      protected String getRouteParamName()
    • validateView

      protected ValidationErrors validateView()
    • isSaveActionPerformed

      protected boolean isSaveActionPerformed()
    • save

      public OperationResult save()
      Description copied from interface: DetailView
      Saves changes.
      Specified by:
      save in interface DetailView<T>
    • closeWithSave

      public OperationResult closeWithSave()
      Description copied from interface: DetailView
      Saves changes and closes the view.
      Specified by:
      closeWithSave in interface DetailView<T>
    • closeWithDiscard

      public OperationResult closeWithDiscard()
      Description copied from interface: DetailView
      Discards changes and closes the view.
      Specified by:
      closeWithDiscard in interface DetailView<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 is true.
      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 is true.
      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 uses UiCrossFieldChecks constraint group to validate bean instance. The default value is true.
      Parameters:
      crossFieldValidationEnabled - true if cross-field should be enabled, false otherwise
    • isReadOnly

      public boolean isReadOnly()
      Specified by:
      isReadOnly in interface ReadOnlyAwareView
      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 interface ReadOnlyAwareView
      Parameters:
      readOnly - true to enable the read-only mode, false otherwise
    • hasUnsavedChanges

      public boolean hasUnsavedChanges()
      Specified by:
      hasUnsavedChanges in interface ChangeTracker
      Returns:
      true if the view has unsaved changes
    • getEditedEntityContainer

      protected InstanceContainer<T> getEditedEntityContainer()
    • getEditedEntityLoader

      protected InstanceLoader<T> getEditedEntityLoader()
    • getEditedEntity

      public T getEditedEntity()
      Specified by:
      getEditedEntity in interface DetailView<T>
      Returns:
      currently edited entity instance
    • setEntityToEdit

      public void setEntityToEdit(T entity)
      Description copied from interface: DetailView
      Sets entity instance to the view.
      Specified by:
      setEntityToEdit in interface DetailView<T>
      Parameters:
      entity - entity to edit
    • setupEntityToEdit

      protected void setupEntityToEdit()
      Invoked on View.BeforeShowEvent both when the view is opened by navigation and in dialog window.
    • setupEntityToEdit

      protected void setupEntityToEdit(String serializedEntityId)
      Invoked when the view is opened by navigation.
      Parameters:
      serializedEntityId - serialized id of the edited entity or NEW_ENTITY_ID when creating new entity
    • initNewEntity

      protected void initNewEntity(Class<T> entityClass)
    • initExistingEntity

      protected void initExistingEntity(String serializedEntityId)
    • setupEntityToEdit

      protected void setupEntityToEdit(T entityToEdit)
      Invoked when the view is opened in dialog window or when the view is opened by navigation and setEntityToEdit(Object) method is called in AfterViewNavigationEvent handler.
      Parameters:
      entityToEdit - entity instance to edit. Can be a new instance when the entity is being created, see EntityStates.isNew(Object).
    • getLockStatus

      public LockStatus getLockStatus()
      Specified by:
      getLockStatus in interface DetailView<T>
      Returns:
      lock status of the currently edited entity instance. Possible variants:
    • addInitEntityListener

      protected com.vaadin.flow.shared.Registration addInitEntityListener(com.vaadin.flow.component.ComponentEventListener<StandardDetailView.InitEntityEvent<T>> listener)
      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)
      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)
      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)
      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 interface DetailView<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 interface DetailView<T>
      Parameters:
      reloadSaved - flag indicating whether edited entity should be reloaded after closeWithSave action