Class RenderingVisitor
- java.lang.Object
-
- com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
-
- com.composum.sling.clientlibs.processor.RenderingVisitor
-
- All Implemented Interfaces:
ClientlibVisitor
public class RenderingVisitor extends AbstractClientlibVisitor
Visitor that realizes the rendering process for a client library. The visit functions return true if the processed element embedded some files.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.composum.sling.clientlibs.handle.ClientlibVisitor
ClientlibVisitor.VisitorMode
-
-
Field Summary
Fields Modifier and Type Field Description protected RendererContext
context
protected List<ClientlibLink>
linksToRender
protected boolean
ownerWasAlreadyRendered
-
Fields inherited from class com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
embeddedHash, hasEmbeddedFiles, HASH_PATTERN, owner, processedElements, resolver, service
-
-
Constructor Summary
Constructors Modifier Constructor Description RenderingVisitor(ClientlibElement owner, RendererContext context)
protected
RenderingVisitor(ClientlibElement owner, RendererContext context, List<ClientlibLink> linksToRender, LinkedHashSet<ClientlibLink> processedElements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
action(ClientlibCategory clientlibCategory, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Optional action to take after visiting the element.void
action(ClientlibExternalUri externalUri, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Optional action to take after visiting the element.void
action(ClientlibFile file, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Optional action to take after visiting the element.void
action(Clientlib clientlib, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Optional action to take after visiting the element.protected ClientlibVisitor
createVisitorFor(ClientlibElement element)
Creates a new visitor for the given clientlib or category as owner.RenderingVisitor
execute()
Triggers the processing of theClientlibVisitor.getOwner()
by callingClientlibElement.accept(ClientlibVisitor, VisitorMode, ClientlibResourceFolder)
.List<ClientlibLink>
getLinksToRender()
protected void
notPresent(ClientlibRef ref, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Hook for additional checks about an element referenced but not present.protected void
render(ClientlibVisitor.VisitorMode mode, ClientlibElement element, ClientlibResourceFolder parent)
-
Methods inherited from class com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
action, alreadyProcessed, getHash, getOwner, getProcessedElements, getVisitorFor, isNotProcessed, markAsProcessed, removeMinificationDuplicates, resolveAndAccept, supportsEmbedding, updateHash, visit, visit, visit, visit, visit
-
-
-
-
Field Detail
-
context
protected final RendererContext context
-
linksToRender
protected final List<ClientlibLink> linksToRender
-
ownerWasAlreadyRendered
protected final boolean ownerWasAlreadyRendered
-
-
Constructor Detail
-
RenderingVisitor
public RenderingVisitor(ClientlibElement owner, RendererContext context)
-
RenderingVisitor
protected RenderingVisitor(ClientlibElement owner, RendererContext context, List<ClientlibLink> linksToRender, LinkedHashSet<ClientlibLink> processedElements)
-
-
Method Detail
-
execute
public RenderingVisitor execute() throws IOException, javax.jcr.RepositoryException
Description copied from interface:ClientlibVisitor
Triggers the processing of theClientlibVisitor.getOwner()
by callingClientlibElement.accept(ClientlibVisitor, VisitorMode, ClientlibResourceFolder)
.- Specified by:
execute
in interfaceClientlibVisitor
- Overrides:
execute
in classAbstractClientlibVisitor
- Returns:
- this
- Throws:
IOException
javax.jcr.RepositoryException
-
createVisitorFor
protected ClientlibVisitor createVisitorFor(ClientlibElement element)
Description copied from class:AbstractClientlibVisitor
Creates a new visitor for the given clientlib or category as owner. That'll usually be of the same type as ourselves. Caution: they have to share the sameAbstractClientlibVisitor.processedElements
set!- Specified by:
createVisitorFor
in classAbstractClientlibVisitor
-
action
public void action(ClientlibCategory clientlibCategory, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Description copied from class:AbstractClientlibVisitor
Optional action to take after visiting the element. Default : empty.- Overrides:
action
in classAbstractClientlibVisitor
-
action
public void action(Clientlib clientlib, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Description copied from class:AbstractClientlibVisitor
Optional action to take after visiting the element. Default : empty.- Overrides:
action
in classAbstractClientlibVisitor
-
action
public void action(ClientlibFile file, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Description copied from class:AbstractClientlibVisitor
Optional action to take after visiting the element. Default : empty.- Overrides:
action
in classAbstractClientlibVisitor
-
render
protected void render(ClientlibVisitor.VisitorMode mode, ClientlibElement element, ClientlibResourceFolder parent)
-
action
public void action(ClientlibExternalUri externalUri, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Description copied from class:AbstractClientlibVisitor
Optional action to take after visiting the element. Default : empty.- Overrides:
action
in classAbstractClientlibVisitor
-
getLinksToRender
public List<ClientlibLink> getLinksToRender()
-
notPresent
protected void notPresent(ClientlibRef ref, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Description copied from class:AbstractClientlibVisitor
Hook for additional checks about an element referenced but not present. Default: debuglog.- Overrides:
notPresent
in classAbstractClientlibVisitor
-
-