public abstract class AbstractResourceProcessor
extends org.broadleafcommerce.presentation.dialect.AbstractBroadleafTagReplacementProcessor
| Modifier and Type | Field and Description |
|---|---|
protected ResourceBundlingService |
bundlingService |
protected org.springframework.core.env.Environment |
environment |
protected ResourcesRequest |
resourcesRequest |
| Constructor and Description |
|---|
AbstractResourceProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected List<String> |
buildBundledFilesList(ResourceTagAttributes tagAttributes)
Gets all the files that should be included in the bundle
|
protected abstract org.broadleafcommerce.presentation.model.BroadleafTemplateModel |
buildModelBundled(List<String> attributeFiles,
ResourceTagAttributes attributes,
org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
Builds the model that contains the bundled resources the tag should be replaced with
|
protected abstract org.broadleafcommerce.presentation.model.BroadleafTemplateModel |
buildModelUnbundled(List<String> attributeFiles,
ResourceTagAttributes attributes,
org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
Builds the model that contains the unbundled resources the tag should be replaced with
|
protected ResourceTagAttributes |
buildResourceTagAttributes(Map<String,String> tagAttributes)
Builds the tag attributes of the bundle tag
|
protected String |
getBundleAppendText(ResourceTagAttributes attributes)
Gets the bundle append text, text that will be appended to the end of a bundle
|
protected String |
getBundleCompleteEventJavaScript(ResourceTagAttributes attributes)
Gets the JavaScript that fires an event when a bundle is completed
|
protected boolean |
getBundleEnabled()
Tells if bundling is enabled
|
protected String |
getBundlePath(ResourceTagAttributes attributes,
List<String> files)
Gets the bundle path.
|
protected String |
getBundleUrl(String bundleName,
org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
Adds the context path to the bundleUrl.
|
protected String |
getFullUnbundledFileName(String fileName,
ResourceTagAttributes resourceTagAttributes,
org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
Gets the full path of an unbundled file.
|
org.broadleafcommerce.presentation.model.BroadleafTemplateModel |
getReplacementModel(String tagName,
Map<String,String> tagAttributes,
org.broadleafcommerce.presentation.model.BroadleafTemplateContext context) |
protected List<String> |
getRequestedFileNames(String rawFileNames)
Gets a list of the requested files for bundling
|
protected List<String> |
postProcessUnbundledFileList(List<String> attributeFiles,
ResourceTagAttributes resourceTagAttributes,
org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
Performs post processing on an unbundled file list to either grab the file list stored on the request (see
ResourcesRequest) or use the files from the tag attributes and save them so they can be used
again later without the files attribute. |
protected void |
validateTagAttributes(ResourceTagAttributes resourceTagAttributes)
Validates the requested tag attributes
|
getPrecedence, getPrefix, replacementNeedsProcessingprotected org.springframework.core.env.Environment environment
protected ResourceBundlingService bundlingService
protected ResourcesRequest resourcesRequest
protected boolean getBundleEnabled()
public org.broadleafcommerce.presentation.model.BroadleafTemplateModel getReplacementModel(String tagName, Map<String,String> tagAttributes, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
protected abstract org.broadleafcommerce.presentation.model.BroadleafTemplateModel buildModelUnbundled(List<String> attributeFiles, ResourceTagAttributes attributes, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
attributeFiles - list of files that are to be includedattributes - the attributes of the original tag this processor replacescontext - the context of the original tagprotected abstract org.broadleafcommerce.presentation.model.BroadleafTemplateModel buildModelBundled(List<String> attributeFiles, ResourceTagAttributes attributes, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
attributeFiles - list of files that are to be bundledattributes - the attributes of the original tag this processor replacescontext - the context of the original tagprotected List<String> getRequestedFileNames(String rawFileNames)
rawFileNames - comma separated list of filesprotected ResourceTagAttributes buildResourceTagAttributes(Map<String,String> tagAttributes)
tagAttributes - the original attributes of the bundle tagResourceTagAttributes containing the original bundle tag attributesprotected String getFullUnbundledFileName(String fileName, ResourceTagAttributes resourceTagAttributes, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
fileName - the file name to parseresourceTagAttributes - the tag attributes of the original bundle tag (fileName will be used instead of src)context - the template contextprotected String getBundleUrl(String bundleName, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
bundleName - the path of the bundle to addcontext - the context of the original bundle tagprotected List<String> buildBundledFilesList(ResourceTagAttributes tagAttributes)
tagAttributes - the tag attributes of the resource tag to replaceprotected String getBundlePath(ResourceTagAttributes attributes, List<String> files)
getBundleUrl(String, BroadleafTemplateContext)
to get the href/src appropriate for the HTML.attributes - the attributes on the original resource tagfiles - the files requested with the bundle or null if not includedprotected List<String> postProcessUnbundledFileList(List<String> attributeFiles, ResourceTagAttributes resourceTagAttributes, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
ResourcesRequest) or use the files from the tag attributes and save them so they can be used
again later without the files attribute.attributeFiles - the files that were on the attribute (and any additional files to include)resourceTagAttributes - the attributes that were on the original resource tagcontext - the context of the original resource tagprotected String getBundleAppendText(ResourceTagAttributes attributes)
attributes - the original resource tag attributesprotected String getBundleCompleteEventJavaScript(ResourceTagAttributes attributes)
attributes - the attributes to build the event off ofprotected void validateTagAttributes(ResourceTagAttributes resourceTagAttributes)
resourceTagAttributes - the tag attributes from the original resource tagCopyright © 2018. All rights reserved.