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

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

  • Constructor Details

  • Method Details

    • 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()
    • 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()
    • setupEntityToEdit

      protected void setupEntityToEdit(String serializedEntityId)
    • initNewEntity

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

      protected void initExistingEntity(String serializedEntityId)
    • entityCanBeLoaded

      protected boolean entityCanBeLoaded()
    • setupEntityToEdit

      protected void setupEntityToEdit(T entityToEdit)
    • getPessimisticLockStatus

      public PessimisticLockStatus getPessimisticLockStatus()
      Specified by:
      getPessimisticLockStatus in interface DetailView<T>
      Returns:
      lock status of the currently edited entity instance. Possible variants:
      See Also:
    • 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