Class DynamicRegionalFormProcessor

java.lang.Object
org.broadleafcommerce.presentation.dialect.AbstractBroadleafModelModifierProcessor
org.broadleafcommerce.common.web.processor.FormProcessor
com.broadleafcommerce.i18n.enterprise.web.processor.DynamicRegionalFormProcessor
All Implemented Interfaces:
org.broadleafcommerce.presentation.dialect.BroadleafModelModifierProcessor, org.broadleafcommerce.presentation.dialect.BroadleafProcessor

@Component("blDynamicRegionalFormProcessor") @ConditionalOnTemplating public class DynamicRegionalFormProcessor extends org.broadleafcommerce.common.web.processor.FormProcessor

The following Thymeleaf processor will place the appropriate Dynamic Form Fields given a valid ISOCountry that is passed in through RedirectAttributes from a controller. If one cannot be found, it will default to the override ISOCountry passed in, or the Default Locale on the request if available.

This billing form should also add the CSRF token as a hidden param to the end of the form

Here is an example:

 
      <blc:dynamic_regional_form th:object="${billingInfoForm}"
          th:action="@{/checkout/billing}"
          th:country="${billingInfoForm.address.isoCountryAlpha2?.alpha2}"
          name="BILLING_FORM"
          method="post" id="billing_info"
          novalidate="novalidate">

          ...
          
          ...

     </blc:dynamic_regional_form>
 
 
Author:
Elbert Bautista (elbertbautista), reginaldccole
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.broadleafcommerce.profile.core.service.CountryService
     
     
    protected org.broadleafcommerce.common.security.service.ExploitProtectionService
     
    protected org.broadleafcommerce.common.i18n.service.ISOService
     
    protected org.broadleafcommerce.common.security.service.StaleStateProtectionService
     

    Fields inherited from interface org.broadleafcommerce.presentation.dialect.BroadleafProcessor

    DEFAULT_PRECEDENCE, DEFAULT_PREFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
     
    org.broadleafcommerce.presentation.model.BroadleafTemplateModelModifierDTO
    getInjectedModelAndTagAttributes(String rootTagName, Map<String,String> rootTagAttributes, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
     
     
    protected void
    Create a variable 'countries' for the element that contains a list of all the available countries
    protected void
    populateFormElement(Map<String,Object> localVariables, org.broadleafcommerce.common.i18n.domain.ISOCountry country, org.broadleafcommerce.common.web.form.BroadleafFormType formType)
     

    Methods inherited from class org.broadleafcommerce.common.web.processor.FormProcessor

    getPrecedence, reprocessModel

    Methods inherited from class org.broadleafcommerce.presentation.dialect.AbstractBroadleafModelModifierProcessor

    getPrefix, useSingleQuotes

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • eps

      protected org.broadleafcommerce.common.security.service.ExploitProtectionService eps
    • spps

      protected org.broadleafcommerce.common.security.service.StaleStateProtectionService spps
    • dynamicRegionalFormService

      protected DynamicRegionalFormService dynamicRegionalFormService
    • isoService

      protected org.broadleafcommerce.common.i18n.service.ISOService isoService
    • countryService

      protected org.broadleafcommerce.profile.core.service.CountryService countryService
  • Constructor Details

    • DynamicRegionalFormProcessor

      public DynamicRegionalFormProcessor()
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface org.broadleafcommerce.presentation.dialect.BroadleafProcessor
      Overrides:
      getName in class org.broadleafcommerce.common.web.processor.FormProcessor
    • getInjectedModelAndTagAttributes

      public org.broadleafcommerce.presentation.model.BroadleafTemplateModelModifierDTO getInjectedModelAndTagAttributes(String rootTagName, Map<String,String> rootTagAttributes, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
      Specified by:
      getInjectedModelAndTagAttributes in interface org.broadleafcommerce.presentation.dialect.BroadleafModelModifierProcessor
      Overrides:
      getInjectedModelAndTagAttributes in class org.broadleafcommerce.common.web.processor.FormProcessor
    • populateElementCountryVarialbe

      protected void populateElementCountryVarialbe(Map<String,Object> localVariables)
      Create a variable 'countries' for the element that contains a list of all the available countries
      Parameters:
      localVariables -
    • populateFormElement

      protected void populateFormElement(Map<String,Object> localVariables, org.broadleafcommerce.common.i18n.domain.ISOCountry country, org.broadleafcommerce.common.web.form.BroadleafFormType formType)
      Parameters:
      localVariables -
      country -
      formType -
    • getCountryFromLocale

      protected String getCountryFromLocale(Locale defaultLocale)
      Parameters:
      defaultLocale -
      Returns: