Class EntityViewElementBatch<T>

java.lang.Object
com.foreach.across.core.support.AttributeSupport
com.foreach.across.core.support.AttributeOverridingSupport
com.foreach.across.modules.web.ui.DefaultViewElementBuilderContext
com.foreach.across.modules.entity.views.helpers.EntityViewElementBatch<T>
All Implemented Interfaces:
com.foreach.across.core.support.ReadableAttributes, com.foreach.across.core.support.WritableAttributes, com.foreach.across.modules.web.support.LocalizedTextResolver, com.foreach.across.modules.web.ui.ViewElementBuilderContext, org.springframework.core.AttributeAccessor

@NotThreadSafe public class EntityViewElementBatch<T> extends com.foreach.across.modules.web.ui.DefaultViewElementBuilderContext
Helper to quickly generate ViewElement instances for a number of properties of a certain EntityPropertyRegistry.

The properties are determined by the selector assigned through setPropertySelector(EntityPropertySelector). Behind the scenes a getPropertiesBinder() will be used for fetching the values.

Note: this class is not thread safe.

Author:
Arne Vandamme
  • Field Summary

    Fields inherited from class com.foreach.across.modules.web.ui.DefaultViewElementBuilderContext

    FALLBACK_LINK_BUILDER, FALLBACK_MESSAGE_SOURCE, FALLBACK_TEXT_RESOLVER
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<String,com.foreach.across.modules.web.ui.ViewElement>
    Generates the final elements.
    Map<String,com.foreach.across.modules.web.ui.ViewElement>
    build(com.foreach.across.modules.web.ui.ViewElementBuilderContext parentBuilderContext)
    Generates the final elements using the specified builder context as parent.
    protected com.foreach.across.modules.web.ui.ViewElementBuilderContext
     
     
    void
    setBuilderHints(@NonNull Map<String,Object> builderHints)
    Set a map of property builder hints.
    void
    setEntity(T entity)
    Set the entity that should be used for the next build.
    void
    setParentViewElementBuilderContext(com.foreach.across.modules.web.ui.ViewElementBuilderContext viewElementBuilderContext)
     
    void
     
    void
     
    void
     

    Methods inherited from class com.foreach.across.modules.web.ui.DefaultViewElementBuilderContext

    buildLink, getLocalizedTextResolver, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessageSource, getWebAppLinkBuilder, getWebResourceRegistry, registerMissingDefaultAttributes, resolveText, resolveText, resolveText, resolveText, setLocalizedTextResolver, setMessageSource, setWebAppLinkBuilder, setWebResourceRegistry

    Methods inherited from class com.foreach.across.core.support.AttributeOverridingSupport

    attributeMap, attributeNames, findAttribute, findAttribute, findAttribute, getAttribute, getAttribute, getAttribute, hasAttribute, hasAttribute, setParent

    Methods inherited from class com.foreach.across.core.support.AttributeSupport

    removeAttribute, removeAttribute, setAttribute, setAttribute, setAttributes

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.core.AttributeAccessor

    attributeNames, computeAttribute, getAttribute, hasAttribute, removeAttribute, setAttribute

    Methods inherited from interface com.foreach.across.core.support.ReadableAttributes

    attributeMap, attributeNames, getAttribute, getAttribute, getAttribute, hasAttribute, hasAttribute

    Methods inherited from interface com.foreach.across.modules.web.ui.ViewElementBuilderContext

    findAttribute, findAttribute, findAttribute, withAttributeOverride, withAttributeOverride

    Methods inherited from interface com.foreach.across.core.support.WritableAttributes

    removeAttribute, setAttribute, setAttributes
  • Constructor Details

  • Method Details

    • setPropertyRegistry

      public void setPropertyRegistry(EntityPropertyRegistry propertyRegistry)
    • setParentViewElementBuilderContext

      public void setParentViewElementBuilderContext(com.foreach.across.modules.web.ui.ViewElementBuilderContext viewElementBuilderContext)
    • getParent

      protected com.foreach.across.modules.web.ui.ViewElementBuilderContext getParent()
      Overrides:
      getParent in class com.foreach.across.core.support.AttributeOverridingSupport
    • setPropertySelector

      public void setPropertySelector(EntityPropertySelector propertySelector)
    • setViewElementMode

      public void setViewElementMode(ViewElementMode viewElementMode)
    • setEntity

      public void setEntity(T entity)
      Set the entity that should be used for the next build.
      Parameters:
      entity - instance
    • setBuilderHints

      public void setBuilderHints(@NonNull @NonNull Map<String,Object> builderHints)
      Set a map of property builder hints. The keys are the property names, the value should be one of the following:
      • ViewElementMode: for which specific mode the builder should be retrieved
      • String: which element type should be generated for the property
      • ViewElementBuilder: element builder that should be used for building the element
      • ViewElement: fixed element that should be returned
      Parameters:
      builderHints - map instance, should not be null
    • build

      public Map<String,com.foreach.across.modules.web.ui.ViewElement> build()
      Generates the final elements.
      Returns:
      map of property name/ element
    • build

      public Map<String,com.foreach.across.modules.web.ui.ViewElement> build(com.foreach.across.modules.web.ui.ViewElementBuilderContext parentBuilderContext)
      Generates the final elements using the specified builder context as parent. This will override the default parent context set with setParentViewElementBuilderContext(ViewElementBuilderContext).
      Parameters:
      parentBuilderContext - to use
      Returns:
      map of property name/element
    • getPropertiesBinder

      public EntityPropertiesBinder getPropertiesBinder()