Class BasicEntityViewSettings

java.lang.Object
com.foreach.across.modules.entity.views.settings.BasicEntityViewSettings
All Implemented Interfaces:
Consumer<EntityViewFactoryBuilder>

public class BasicEntityViewSettings extends Object implements Consumer<EntityViewFactoryBuilder>
Basic consumer that allows addition of view processors, setting the admin menu attribute and adding a custom access validation predicate.

It supports configuration of the following processors:

Since:
3.0.0
Author:
Arne Vandamme
  • Constructor Details

    • BasicEntityViewSettings

      public BasicEntityViewSettings()
  • Method Details

    • adminMenu

      public BasicEntityViewSettings adminMenu(@NonNull @NonNull String menuPath)
      Register a default view menu item with the registered path.
      Parameters:
      menuPath - for the item
      Returns:
      current consumer
    • adminMenu

      public BasicEntityViewSettings adminMenu(@NonNull @NonNull String menuPath, Consumer<com.foreach.across.modules.web.menu.PathBasedMenuBuilder.PathBasedMenuItemBuilder> itemCustomizer)
      Register a default view menu item with the registered path.
      Parameters:
      menuPath - for the item
      itemCustomizer - for additional customization of the menu item
      Returns:
      current consumer
    • adminMenu

      public <S> BasicEntityViewSettings adminMenu(@NonNull @NonNull Consumer<EntityAdminMenuEvent<S>> menuEventConsumer)
      Register a custom menu event consumer.
      Type Parameters:
      S - entity type
      Parameters:
      menuEventConsumer - for handling the menu
      Returns:
      current consumer
    • accept

      public void accept(EntityViewFactoryBuilder builder)
      Apply the configuration to the view factory builder.
      Specified by:
      accept in interface Consumer<EntityViewFactoryBuilder>
      Parameters:
      builder - for the view factory
    • renderAdminMenu

      public BasicEntityViewSettings renderAdminMenu(Boolean renderAdminMenu)
      Should this view render the admin menu.
      Returns:
      this.
    • titleMessageCode

      public BasicEntityViewSettings titleMessageCode(String titleMessageCode)
      Set the message code that should be used as title for the view.
      Returns:
      this.
    • accessValidator

      public BasicEntityViewSettings accessValidator(@NonNull @NonNull BiPredicate<EntityViewFactory,EntityViewContext> accessValidator)
      Attach a custom access validator that should be used for this view.

      Note that if you want to keep the default access validation as well, you should combine with EntityViewFactoryAttributes.defaultAccessValidator().

      Returns:
      this.