Class ViewValidation

java.lang.Object
io.jmix.flowui.view.ViewValidation

@Component("flowui_ViewValidation") public class ViewValidation extends Object
  • Field Details

    • messages

      protected Messages messages
    • validator

      protected jakarta.validation.Validator validator
    • dialogs

      protected Dialogs dialogs
    • notifications

      protected Notifications notifications
    • viewProperties

      protected UiViewProperties viewProperties
  • Constructor Details

  • Method Details

    • validateUiComponents

      public ValidationErrors validateUiComponents(com.vaadin.flow.component.Component container)
      Validates UI components located inside the given container by invoking their SupportsValidation.executeValidators().
      Parameters:
      container - a component that can contain other components
      Returns:
      validation errors
    • validateUiComponents

      public ValidationErrors validateUiComponents(Collection<com.vaadin.flow.component.Component> components)
      Validates UI components by invoking their SupportsValidation.executeValidators().
      Parameters:
      components - components collection
      Returns:
      validation errors
    • validateUiComponent

      public ValidationErrors validateUiComponent(com.vaadin.flow.component.Component component)
      Validates UI component by invoking their SupportsValidation.executeValidators().
      Parameters:
      component - UI component
      Returns:
      validation errors
    • validateBeanGroup

      public ValidationErrors validateBeanGroup(Class<?> groupClass, Object item)
      Performs Java Bean Validation of the given object.
      Parameters:
      groupClass - the group or list of groups targeted for validation
      item - object to validate
      Returns:
      validation errors
    • showValidationErrors

      public void showValidationErrors(ValidationErrors errors)
      Shows a notification with validation errors.
      Parameters:
      errors - validation errors
    • showValidationErrorsNotification

      protected void showValidationErrorsNotification(ValidationErrors errors, int duration, com.vaadin.flow.component.notification.Notification.Position position, Notifications.Type type)
    • focusProblemComponent

      public void focusProblemComponent(ValidationErrors errors)
      Focuses a component corresponding to the first validation error, if there is one.
      Parameters:
      errors - validation errors
    • getValidationErrorsMessage

      public static String getValidationErrorsMessage(ValidationErrors errors)
      Creates a message explaining the given validation errors.
      Parameters:
      errors - validation errors
      Returns:
      error messsage
    • validate

      protected Collection<ValidationErrors.Item> validate(SupportsValidation<?> component)
    • collectValidationErrorItems

      protected Collection<ValidationErrors.Item> collectValidationErrorItems(ValidationException e, com.vaadin.flow.component.Component component)
    • showUnsavedChangesDialog

      public ViewValidation.UnsavedChangesDialogResult showUnsavedChangesDialog(View<?> origin)
      Shows confirmation dialog about discarding unsaved changes.

      The options invoke the callback methods of the returned ViewValidation.UnsavedChangesDialogResult object.

      Parameters:
      origin - view controller
      Returns:
      object that contains "discard" and "cancel" callbacks to be assigned by the caller.
    • showSaveConfirmationDialog

      public ViewValidation.SaveChangesDialogResult showSaveConfirmationDialog(View<?> origin)
      Shows confirmation dialog about saving or discarding unsaved changes.

      The options invoke the callback methods of the returned ViewValidation.SaveChangesDialogResult object.

      Parameters:
      origin - view controller
      Returns:
      object that contains "save", "discard" and "cancel" callbacks to be assigned by the caller.