Class HtmlIdStore

java.lang.Object
com.foreach.across.modules.web.thymeleaf.HtmlIdStore

public class HtmlIdStore extends Object
Helper that keeps track of the generated html ids for HtmlViewElement instance (simple nodes). This ensures that other elements (eg. labels) can retrieve the render time generated id.
Since:
2.0.0
Author:
Arne Vandamme
  • Constructor Details

    • HtmlIdStore

      public HtmlIdStore()
  • Method Details

    • retrieveHtmlId

      public String retrieveHtmlId(org.thymeleaf.context.ITemplateContext context, ViewElement control)
      Retrieve the generated id for a ViewElement. If the instance does not implement HtmlViewElement null will be returned.

      If an id is configured on the element, a unique id will be generated and stored for subsequent retrieval.

      Parameters:
      control - element for which to retrieve the id
      Returns:
      id or null if no id is available
    • increaseLevel

      public void increaseLevel()
      Increase the level of element id caching. This will copy the currently cached ids into a new collection. Any ids after will only be kept until a call to decreaseLevel(). When that happens, the previous collection will be reset.
    • decreaseLevel

      public void decreaseLevel()
      Decrease the level. This resets the cached element ids to the version that was present before the last call to increaseLevel(). If the level has never been increased, this method will remove all cached element ids.
    • fetch

      public static HtmlIdStore fetch(org.thymeleaf.context.ITemplateContext context)
      Fetch the store from the current template context.
      Parameters:
      context - to get the store from
      Returns:
      id store instance