Class DefaultDecorationModelInheritanceAssembler
java.lang.Object
org.apache.maven.doxia.site.decoration.inheritance.DefaultDecorationModelInheritanceAssembler
- All Implemented Interfaces:
DecorationModelInheritanceAssembler
@Component(role=DecorationModelInheritanceAssembler.class)
public class DefaultDecorationModelInheritanceAssembler
extends Object
implements DecorationModelInheritanceAssembler
Manage inheritance of the decoration model.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
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. -
Field Summary
Fields inherited from interface org.apache.maven.doxia.site.decoration.inheritance.DecorationModelInheritanceAssembler
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
assembleBodyInheritance
(String name, DecorationModel child, DecorationModel parent, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) private void
assembleCustomInheritance
(DecorationModel child, DecorationModel parent) void
assembleModelInheritance
(String name, DecorationModel child, DecorationModel parent, String childBaseUrl, String parentBaseUrl) Manage inheritance of the decoration model between a parent and child.mergeLinkItemLists
(List<LinkItem> childList, List<LinkItem> parentList, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer, boolean cutParentAfterDuplicate) mergeMenus
(List<Menu> childMenus, List<Menu> parentMenus, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) mergePoweredByLists
(List<Logo> childList, 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
(List<MenuItem> items, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) private void
relativizeBannerPaths
(Banner banner, String baseUrl) Resolves all relative paths between the elements in a banner.private String
relativizeLink
(String link, String baseUri) private void
relativizeLinkItemPaths
(LinkItem item, String baseUrl) private void
relativizeLogoPaths
(Logo logo, String baseUrl) private void
relativizeMenuPaths
(List<MenuItem> items, String baseUrl) void
resolvePaths
(DecorationModel decoration, String baseUrl) Resolve relative paths for a DecorationModel given a base URL.
-
Constructor Details
-
DefaultDecorationModelInheritanceAssembler
public DefaultDecorationModelInheritanceAssembler()
-
-
Method Details
-
assembleModelInheritance
public void assembleModelInheritance(String name, DecorationModel child, DecorationModel parent, String childBaseUrl, String parentBaseUrl) Manage inheritance of the decoration model between a parent and child. Any relative links in the parent model will be re-based to work from the merged child model, otherwise no content from either the parent or child model should be modified.- Specified by:
assembleModelInheritance
in interfaceDecorationModelInheritanceAssembler
- Parameters:
name
- 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.
-
resolvePaths
Resolve relative paths for a DecorationModel given a base URL. Note that 'resolve' here means 'relativize' in the sense ofURI.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.- Specified by:
resolvePaths
in interfaceDecorationModelInheritanceAssembler
- Parameters:
decoration
- the DecorationModel. Not null.baseUrl
- the base URL. May be null in which case the decoration model is unchanged.
-
relativizeBannerPaths
Resolves all relative paths between the elements in a banner. The banner element might contain relative paths to the oldBaseUrl, these are changed to the newBannerUrl.- Parameters:
banner
-baseUrl
-
-
rebaseBannerPaths
private void rebaseBannerPaths(Banner banner, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) -
assembleCustomInheritance
-
assembleBodyInheritance
private void assembleBodyInheritance(String name, DecorationModel child, DecorationModel parent, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) -
mergeMenus
-
relativizeMenuPaths
-
rebaseMenuPaths
private void rebaseMenuPaths(List<MenuItem> items, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) -
relativizeLinkItemPaths
-
rebaseLinkItemPaths
private void rebaseLinkItemPaths(LinkItem item, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) -
relativizeLogoPaths
-
rebaseLogoPaths
private void rebaseLogoPaths(Logo logo, DefaultDecorationModelInheritanceAssembler.URLRebaser urlContainer) -
mergeLinkItemLists
-
mergePoweredByLists
-
relativizeLink
-