Interface NTxEngine
public interface NTxEngine
- Author:
- vpc
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcompileNode(NTxNode node, NTxDocument document, NTxCompiledDocument compiledDocument, NTxCompiledPage compiledPage, NTxResolutionContext context, CompileNodeVisitor visitor) voidcompileNode(NTxResolutionContext ctx, CompileNodeVisitor visitor) computeDeclaredStyles(NTxNode node) <T> net.thevpc.nuts.util.NOptional<T> computeIfAbsent(String name, Function<String, T> fct) computeProperties(NTxNode node) net.thevpc.nuts.util.NOptional<NTxProp> computeProperty(NTxNode node, String... propertyNames) <T> net.thevpc.nuts.util.NOptional<T> computePropertyValue(NTxNode node, String... propertyNames) computeStyles(NTxNode node) createFunctionArgs(String functionName, net.thevpc.nuts.elem.NElement[] callArgs, NTxResolutionContext context) createGraphics(Graphics2D g2d) voidcreateProject(net.thevpc.nuts.io.NPath path, net.thevpc.nuts.io.NPath templateUrl, Function<String, String> vars) voiddefaultCompileNodeChildren(NTxNode node, NTxResolutionContext context) voiddefaultCompileNodeProperties(NTxNode node, NTxResolutionContext context) voiddump()voidnet.thevpc.nuts.util.NOptional<NTxFunction> findFunction(String name) net.thevpc.nuts.util.NOptional<NTxNode> findNodeByProperty(String propertyName, Predicate<net.thevpc.nuts.elem.NElement> propertyValueFilter, NTxResolutionContext context) Resolves a node within the document tree using an Ancestral-First Radial Search.net.thevpc.nuts.reflect.NMutableClassLoader<T> net.thevpc.nuts.util.NOptional<T> net.thevpc.nuts.util.NOptional<NTxNodeRenderer> getRenderer(String type) importDependencies(String... deps) booleanisNtxProject(net.thevpc.nuts.io.NPath path) loadDocument(net.thevpc.nuts.io.NPath of) net.thevpc.nuts.util.NOptional<NTxItem> loadNode(NTxNode into, net.thevpc.nuts.io.NPath of, NTxCompiledDocument document) <S> List<S> loadServices(Class<S> serviceClass) log()newContext(NTxNode node, NTxDocument document, NTxCompiledDocument compiledDocument, NTxCompiledPage compiledPage, NTxResolutionContext parentContext) newDefaultNode(String id) net.thevpc.nuts.util.NOptional<NTxDocumentStreamRenderer> net.thevpc.nuts.util.NOptional<NTxDocumentStreamRenderer> net.thevpc.nuts.util.NOptional<NTxDocumentStreamRenderer> net.thevpc.nuts.util.NOptional<NTxDocumentRenderer> newRenderer(String type) net.thevpc.nuts.util.NOptional<NTxDocumentScreenRenderer> net.thevpc.nuts.util.NOptional<NTxDocumentStreamRenderer> newStreamRenderer(String type) net.thevpc.nuts.util.NOptional<NTxNodeParser> nodeTypeParser(String id) parseNode(net.thevpc.nuts.elem.NElement element, NTxResolutionContext ctx, Consumer<net.thevpc.nuts.util.NOptional<NTxItem>> consumer) renderImage(NTxCompiledPage page, NTxNodeRendererConfig config) byte[]renderImageBytes(NTxCompiledPage page, NTxNodeRendererConfig config) voidrenderPage(NTxCompiledPage page, NTxNodeRendererConfig config, Graphics2D g, ImageObserver imageObserver, Runnable repainter) setAuthorEmail(String authorEmail) setAuthorKey(KeyPair authorPublicKey) setAuthorName(String authorName) setAuthorUrl(String authorUrl) net.thevpc.nuts.util.NOptional<NTxTextRendererFlavor> net.thevpc.nuts.elem.NElementnet.thevpc.nuts.elem.NElementtoElement(NTxDocument doc, boolean semantic) tools()booleanvalidateNode(NTxNode node)
-
Field Details
-
CURRENT_VERSION
- See Also:
-
FILE_EXT
- See Also:
-
FILE_DOT_EXT
- See Also:
-
-
Method Details
-
log
NTxLogger log() -
imageTypeRendererFactories
List<NTxImageTypeRendererFactory> imageTypeRendererFactories() -
importDefaultDependencies
ImportDependencyResults importDefaultDependencies() -
importDependencies
-
getEngineClassLoader
net.thevpc.nuts.reflect.NMutableClassLoader getEngineClassLoader() -
loadServices
-
addDependencyLoadedListener
-
dump
void dump() -
dump
-
tools
NTxEngineTools tools() -
addLog
-
findFunction
-
removeLog
-
nodeTypeFactories
List<NTxNodeParser> nodeTypeFactories() -
itemParser
NTxItemParser itemParser() -
newDefaultNode
-
nodeTypeParser
-
documentFactory
NTxDocumentFactory documentFactory() -
parseNode
NTxEngine parseNode(net.thevpc.nuts.elem.NElement element, NTxResolutionContext ctx, Consumer<net.thevpc.nuts.util.NOptional<NTxItem>> consumer) -
newStreamRenderer
-
newPdfRenderer
net.thevpc.nuts.util.NOptional<NTxDocumentStreamRenderer> newPdfRenderer() -
newHtmlRenderer
net.thevpc.nuts.util.NOptional<NTxDocumentStreamRenderer> newHtmlRenderer() -
newImageRenderer
net.thevpc.nuts.util.NOptional<NTxDocumentStreamRenderer> newImageRenderer() -
newScreenRenderer
net.thevpc.nuts.util.NOptional<NTxDocumentScreenRenderer> newScreenRenderer() -
newRenderer
-
newContext
NTxResolutionContext newContext(NTxNode node, NTxDocument document, NTxCompiledDocument compiledDocument, NTxCompiledPage compiledPage, NTxResolutionContext parentContext) -
validateNode
-
loadDocument
-
asCompiledDocument
-
loadNode
net.thevpc.nuts.util.NOptional<NTxItem> loadNode(NTxNode into, net.thevpc.nuts.io.NPath of, NTxCompiledDocument document) -
loadDocument
-
toElement
-
toElement
-
computeProperty
-
computeStyles
-
computeDeclaredStyles
-
computeDeclaredStylesClasses
-
computeInheritedProperties
-
computeProperties
-
computePropertyValue
-
createGraphics
-
isNtxProject
boolean isNtxProject(net.thevpc.nuts.io.NPath path) -
createProject
-
getTemplates
NTxTemplateInfo[] getTemplates() -
textRendererFlavor
-
textRendererFlavors
List<NTxTextRendererFlavor> textRendererFlavors() -
renderImage
-
renderPage
void renderPage(NTxCompiledPage page, NTxNodeRendererConfig config, Graphics2D g, ImageObserver imageObserver, Runnable repainter) -
renderImageBytes
-
getRenderer
-
setAuthorKey
-
getEnv
-
computeIfAbsent
-
getDefaultStyles
List<NTxStyleRule> getDefaultStyles() -
setEnv
-
compileNode
void compileNode(NTxNode node, NTxDocument document, NTxCompiledDocument compiledDocument, NTxCompiledPage compiledPage, NTxResolutionContext context, CompileNodeVisitor visitor) -
compileNode
-
defaultCompileNodeProperties
-
defaultCompileNodeChildren
-
findNodeByProperty
net.thevpc.nuts.util.NOptional<NTxNode> findNodeByProperty(String propertyName, Predicate<net.thevpc.nuts.elem.NElement> propertyValueFilter, NTxResolutionContext context) Resolves a node within the document tree using an Ancestral-First Radial Search.This resolution strategy is designed for document-centric architectures (NTexUp) where visual and hierarchical proximity dictates logical relationships. It prioritizes the direct lineage of the node before expanding to siblings and distant branches.
* The Search Protocol:- Phase 1: Ancestral Spine (The "Climb"): Traverses vertically from the
startNodeto the root. Only nodes on this direct path are checked. This facilitates "Property Inheritance," where a parent can provide a configuration override for its entire subtree. - Phase 2: Radial Expansion (The "Ripple"): If the spine yields no results,
the search re-initiates from the
startNodeand moves upward. At each level, it performs a Deep-Scan (DFS) of all sibling subtrees. Branches already processed in previous steps are skipped to ensure each node is visited only once.
- Complexity: O(N), where N is the total number of nodes in the document tree.
- Determinism: The search is deterministic and respects "Scoped Shadowing," ensuring that local definitions in the same branch are found before global ones of the same name.
- Fail-Never: Returns a
NOptional.ofNamedEmpty(String)if no match is found, allowing the compiler to continue execution for logging or UI hints.
- Parameters:
propertyValueFilter- A predicate to validate the property value (e.g., matching a specific ID).- Returns:
- An
NOptionalcontaining the first matchingNTxNode, or a named empty optional if the search is exhausted.
- Phase 1: Ancestral Spine (The "Climb"): Traverses vertically from the
-
createFunctionArgs
NTxFunctionCallContext createFunctionArgs(String functionName, net.thevpc.nuts.elem.NElement[] callArgs, NTxResolutionContext context) -
setAuthorEmail
-
getAuthorName
String getAuthorName() -
getAuthorEmail
String getAuthorEmail() -
setAuthorName
-
getAuthorUrl
String getAuthorUrl() -
getAuthorOrcid
String getAuthorOrcid() -
setAuthorUrl
-
getAuthorKey
KeyPair getAuthorKey()
-