@Component(role=DecorationModelInheritanceAssembler.class) public class DefaultDecorationModelInheritanceAssembler extends java.lang.Object implements DecorationModelInheritanceAssembler
| Modifier and Type | Class and Description |
|---|---|
private static class |
DefaultDecorationModelInheritanceAssembler.URLRebaser
URL rebaser: based on an old and a new path, can rebase a link based on old path to a value based on the new
path.
|
ROLE| Constructor and Description |
|---|
DefaultDecorationModelInheritanceAssembler() |
| Modifier and Type | Method and Description |
|---|---|
private void |
assembleBodyInheritance(java.lang.String name,
DecorationModel child,
DecorationModel parent,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) |
private void |
assembleCustomInheritance(DecorationModel child,
DecorationModel parent) |
void |
assembleModelInheritance(java.lang.String name,
DecorationModel child,
DecorationModel parent,
java.lang.String childBaseUrl,
java.lang.String parentBaseUrl)
Manage inheritance of the decoration model between a parent and child.
|
private java.util.List<LinkItem> |
mergeLinkItemLists(java.util.List<LinkItem> childList,
java.util.List<LinkItem> parentList,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer,
boolean cutParentAfterDuplicate) |
private java.util.List<Menu> |
mergeMenus(java.util.List<Menu> childMenus,
java.util.List<Menu> parentMenus,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) |
private java.util.List<Logo> |
mergePoweredByLists(java.util.List<Logo> childList,
java.util.List<Logo> parentList,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) |
private void |
rebaseBannerPaths(Banner banner,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) |
private void |
rebaseLinkItemPaths(LinkItem item,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) |
private void |
rebaseLogoPaths(Logo logo,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) |
private void |
rebaseMenuPaths(java.util.List<MenuItem> items,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) |
private void |
relativizeBannerPaths(Banner banner,
java.lang.String baseUrl)
Resolves all relative paths between the elements in a banner.
|
private java.lang.String |
relativizeLink(java.lang.String link,
java.lang.String baseUri) |
private void |
relativizeLinkItemPaths(LinkItem item,
java.lang.String baseUrl) |
private void |
relativizeLogoPaths(Logo logo,
java.lang.String baseUrl) |
private void |
relativizeMenuPaths(java.util.List<MenuItem> items,
java.lang.String baseUrl) |
void |
resolvePaths(DecorationModel decoration,
java.lang.String baseUrl)
Resolve relative paths for a DecorationModel given a base URL.
|
public DefaultDecorationModelInheritanceAssembler()
public void assembleModelInheritance(java.lang.String name,
DecorationModel child,
DecorationModel parent,
java.lang.String childBaseUrl,
java.lang.String parentBaseUrl)
assembleModelInheritance in interface DecorationModelInheritanceAssemblername - a name, used for breadcrumb.
If the parent model contains breadcrumbs and the child doesn't,
a child breadcrumb will be added to the merged model with this name. Not null.child - the child DecorationModel to be merged with parent.
Not null. If parent == null, the child is unchanged, otherwise
child will contain the merged model upon exit.parent - the parent DecorationModel. Unchanged upon exit.
May be null in which case the child is not changed.childBaseUrl - the child base URL.
May be null, in which case relative links inherited from the parent
will not be resolved in the merged child.parentBaseUrl - the parent base URL.
May be null, in which case relative links inherited from the parent
will not be resolved in the merged child.public void resolvePaths(DecorationModel decoration, java.lang.String baseUrl)
URI.relativize(java.net.URI), ie if any link in the decoration model
has a base URL that is equal to the given baseUrl, it is replaced by a relative link
with respect to that base.resolvePaths in interface DecorationModelInheritanceAssemblerdecoration - the DecorationModel.
Not null.baseUrl - the base URL.
May be null in which case the decoration model is unchanged.private void relativizeBannerPaths(Banner banner, java.lang.String baseUrl)
banner - baseUrl - private void rebaseBannerPaths(Banner banner, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer)
private void assembleCustomInheritance(DecorationModel child, DecorationModel parent)
private void assembleBodyInheritance(java.lang.String name,
DecorationModel child,
DecorationModel parent,
DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer)
private java.util.List<Menu> mergeMenus(java.util.List<Menu> childMenus, java.util.List<Menu> parentMenus, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer)
private void relativizeMenuPaths(java.util.List<MenuItem> items, java.lang.String baseUrl)
private void rebaseMenuPaths(java.util.List<MenuItem> items, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer)
private void relativizeLinkItemPaths(LinkItem item, java.lang.String baseUrl)
private void rebaseLinkItemPaths(LinkItem item, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer)
private void relativizeLogoPaths(Logo logo, java.lang.String baseUrl)
private void rebaseLogoPaths(Logo logo, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer)
private java.util.List<LinkItem> mergeLinkItemLists(java.util.List<LinkItem> childList, java.util.List<LinkItem> parentList, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer, boolean cutParentAfterDuplicate)
private java.util.List<Logo> mergePoweredByLists(java.util.List<Logo> childList, java.util.List<Logo> parentList, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer)
private java.lang.String relativizeLink(java.lang.String link,
java.lang.String baseUri)