Interface BroadleafTemplateContext


public interface BroadleafTemplateContext
Utility class to be used to do various functions on and around the template
Author:
Jay Aisenbrey (cja769)
  • Method Details

    • parseExpression

      <T> T parseExpression(String value)
      Returns:
      The object that the value evaluates to using the underlying template language
    • getAssignationSequence

      List<BroadleafAssignation> getAssignationSequence(String value, boolean allowParametersWithoutValue)
      Parameters:
      allowParametersWithoutValue - true if assignations where the key has no value assigning to it is valid
      Returns:
      The list of BroadleafAssignations that were evaluated from value
    • createNonVoidElement

      BroadleafTemplateNonVoidElement createNonVoidElement(String tagName, Map<String,String> attributes, boolean useDoubleQuotes)
      Parameters:
      tagName - The name of the tag that is being created
      attributes - The attributes that should be added to the tag
      useDoubleQuotes - True if the attribute values should be surrounded by double quotes and false if they should use single quotes
    • createNonVoidElement

      BroadleafTemplateNonVoidElement createNonVoidElement(String tagName)
      Parameters:
      tagName - The name of the tag that is being created
    • createStandaloneElement

      BroadleafTemplateElement createStandaloneElement(String tagName, Map<String,String> attributes, boolean useDoubleQuotes)
      Parameters:
      tagName - The name of the tag that is being created
      attributes - The attributes that should be added to the tag
      useDoubleQuotes - True if the attribute values should be surrounded by double quotes and false if they should use single quotes
    • createStandaloneElement

      BroadleafTemplateElement createStandaloneElement(String tagName)
      Parameters:
      tagName - The name of the tag that is being created
    • createTextElement

      BroadleafTemplateElement createTextElement(String text)
      Parameters:
      text - The text that the BroadleafTemplateElement should represent
    • createModel

      BroadleafTemplateModel createModel()
      Returns:
      A new BroadleafTemplateModel that can have elements added to it to make a snippet of markup
    • setNodeLocalVariable

      void setNodeLocalVariable(BroadleafTemplateElement element, String key, Object value)
      Sets a variable on the given element
    • setNodeLocalVariables

      void setNodeLocalVariables(BroadleafTemplateElement element, Map<String,Object> variableMap)
      Sets a map of variables on the give element
    • getVariable

      Object getVariable(String name)
      Returns:
      The object on the current variable model whose key was name
    • getBindStatus

      BroadleafBindStatus getBindStatus(String attributeValue)
      Returns:
      Gets the current Spring BindStatus for attributeValue
    • getRequest

      jakarta.servlet.http.HttpServletRequest getRequest()
      Returns:
      The current HttpServletRequest if it exists or null otherwise