Class HtmlIdStore
java.lang.Object
com.foreach.across.modules.web.thymeleaf.HtmlIdStore
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Decrease the level.static HtmlIdStore
fetch
(org.thymeleaf.context.ITemplateContext context) Fetch the store from the current template context.void
Increase the level of element id caching.retrieveHtmlId
(org.thymeleaf.context.ITemplateContext context, ViewElement control) Retrieve the generated id for aViewElement
.
-
Constructor Details
-
HtmlIdStore
public HtmlIdStore()
-
-
Method Details
-
retrieveHtmlId
Retrieve the generated id for aViewElement
. If the instance does not implementHtmlViewElement
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 todecreaseLevel()
. 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 toincreaseLevel()
. If the level has never been increased, this method will remove all cached element ids. -
fetch
Fetch the store from the current template context.- Parameters:
context
- to get the store from- Returns:
- id store instance
-