Class FragmentExtensions
- java.lang.Object
-
- nz.net.ultraq.thymeleaf.layoutdialect.fragments.extensions.FragmentExtensions
-
public class FragmentExtensions extends Object
Holds the layout fragments encountered across layout/decorator and content templates for use later.- Author:
- zhanhb, Emanuel Rabina
-
-
Field Summary
Fields Modifier and Type Field Description static String
FRAGMENT_COLLECTION_KEY
-
Constructor Summary
Constructors Constructor Description FragmentExtensions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,List<IModel>>
getFragmentCollection(ITemplateContext self)
static Map<String,List<IModel>>
getFragmentCollection(ITemplateContext self, boolean fromDecorator)
Retrieves the fragment collection for the current context.static void
setLocalFragmentCollection(IElementModelStructureHandler self, ITemplateContext context, Map<String,List<IModel>> fragments)
static void
setLocalFragmentCollection(IElementModelStructureHandler self, ITemplateContext context, Map<String,List<IModel>> fragments, boolean fromDecorator)
Set a fragment cache to contain any existing fragments, plus the given new fragments, with the same scope as setting a local variable.
-
-
-
Field Detail
-
FRAGMENT_COLLECTION_KEY
public static final String FRAGMENT_COLLECTION_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFragmentCollection
public static Map<String,List<IModel>> getFragmentCollection(ITemplateContext self, boolean fromDecorator)
Retrieves the fragment collection for the current context.- Parameters:
self
-fromDecorator
-- Returns:
- A new or existing fragment collection.
-
setLocalFragmentCollection
public static void setLocalFragmentCollection(IElementModelStructureHandler self, ITemplateContext context, Map<String,List<IModel>> fragments, boolean fromDecorator)
Set a fragment cache to contain any existing fragments, plus the given new fragments, with the same scope as setting a local variable.- Parameters:
self
-context
-fragments
- The new fragments to add to the cache.fromDecorator
- Whether the call was fromDecorateProcessor
, used for determining if a new fragment collection should be used and the order of collected fragments.
-
getFragmentCollection
public static Map<String,List<IModel>> getFragmentCollection(ITemplateContext self)
-
setLocalFragmentCollection
public static void setLocalFragmentCollection(IElementModelStructureHandler self, ITemplateContext context, Map<String,List<IModel>> fragments)
-
-