public class OutputCSSContentModelElement extends DependencyDeferredContentTargetModelElement
This is a DeferredContentTargetModelElement that is used as a place holder in the ExtensibilityModel so
that other directives can add CSS dependencies into the <head> element. This allows us to disable the double-pass
WebScript processing (which can be done through Surf configuration) which will enable WebScripts to add CSS dependencies
without needing to rely on head.ftl files.
| Constructor and Description |
|---|
OutputCSSContentModelElement(String id,
String directiveName,
DependencyAggregator dependencyAggregator) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCssDependency(String fileName,
String mediaType,
String group,
boolean forAggregation)
Adds a new CSS dependency.
|
void |
addCssDependency(String fileName,
String mediaType,
String group,
LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> cssGroupToDependencyMap)
Adds a new CSS dependency.
|
void |
addDojoCssDependency(String fileName,
String mediaType,
String group)
The Dojo generated CSS dependencies need to be handled separately from the those provided by the <
@link> directive. |
protected LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> |
filterCssDependencies(LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> dependencies)
Filters CSS dependencies that have already been requested from the supplied map.
|
String |
flushContent()
This method will be called when the
ExtensibilityModel containing
this ContentModelElement is closed. |
LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> |
getAggCssGroupToDependencyMap() |
LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> |
getCssGroupToDependencyMap() |
LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> |
getDojoCssGroupToDependencyMap() |
protected String |
getResourceControllerMapping()
This method must be implemented to return the mapping to the resource controller, e.g.
|
String |
getType() |
dependencyAlreadyRequested, enterEditMode, exitEditMode, getSourceElements, markDependencyAsRequested, normaliseDependency, registerDeferredSourceElementequals, getNextContentBufferElement, hashCode, parseContent, validateContentgetDirectiveName, getId, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic OutputCSSContentModelElement(String id, String directiveName, DependencyAggregator dependencyAggregator)
protected String getResourceControllerMapping()
DependencyDeferredContentTargetModelElementThis method must be implemented to return the mapping to the resource controller, e.g. "/share/res/"
getResourceControllerMapping in class DependencyDeferredContentTargetModelElementpublic String getType()
getType in interface org.springframework.extensions.surf.extensibility.ExtensibilityModelElementgetType in class org.springframework.extensions.surf.extensibility.impl.DefaultContentModelElementpublic LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> getCssGroupToDependencyMap()
public LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> getAggCssGroupToDependencyMap()
public LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> getDojoCssGroupToDependencyMap()
public void addCssDependency(String fileName, String mediaType, String group, boolean forAggregation)
Adds a new CSS dependency. These are organised into groups, where each group is map of media type to resource. This ensures that when the CSS dependencies are requested the HTML elements are defined correctly. The grouping allows merges to be made logically.
fileName - The name of the dependencymediaType - The media type for the dependency (e.g. "screen", etc)group - The id of the group to add the dependency to (if null will go into the default group)public void addCssDependency(String fileName, String mediaType, String group, LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> cssGroupToDependencyMap)
fileName - StringmediaType - Stringgroup - StringvvvcssGroupToDependencyMap - LinkedHashMappublic void addDojoCssDependency(String fileName, String mediaType, String group)
@link> directive.
The reason for this is that Dojo dependencies get added as soon as they are encountered but the <@link> directive
dependencies only get added after all extensions have finished processing (this is so that the DeferredContentSourceModelElement
instances can be manipulated to add/remove/change dependency requests). However, we want to only output Dojo dependencies
if they have not requested via a <@link> directive.fileName - StringmediaType - Stringgroup - Stringprotected LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> filterCssDependencies(LinkedHashMap<String,HashMap<String,LinkedHashSet<String>>> dependencies)
dependencies - The dependency map to filter duplicates from.public String flushContent()
This method will be called when the ExtensibilityModel containing
this ContentModelElement is closed. At this point any nested
models will have already added their required JavaScript and CSS
dependencies. The lists of dependencies will be iterated over to generate
the list of import statements. If we're in debug mode then each
JavaScript and CSS file will be requested separately. In production mode
we will aim to generate the minimum set of files to improve clientside
performance.
flushContent in interface org.springframework.extensions.surf.extensibility.ContentModelElementflushContent in class org.springframework.extensions.surf.extensibility.impl.DefaultContentModelElementCopyright © 2005–2016 Alfresco Software. All rights reserved.