Class NTxHighlights
java.lang.Object
net.thevpc.ntexup.api.document.node.NTxHighlights
Access + helpers for the MVC search-highlight model (
NTxNodeHighlight).
Highlights are stored in the node's user-object map (survives render-cache
invalidation and node cloning, never serialized with the document). All
matching goes through normalize(String) so that case, diacritics,
markup separators (\ _ [[...]]), punctuation and whitespace never
prevent a hit (\lambda_0 and lambda both normalize into
space-separated words).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidRemoves every highlight bound to the node.static List<int[]> findMatches(String raw, String needle) static List<NTxNodeHighlight> static booleanhasHighlights(NTxNode node) True when the node carries at least one highlight.Needles used for a user query: the whole normalized (trimmed) query first, then its whitespace-separated words.static StringCanonical normalization used by search, indexing and painting: NFD decomposition, combining marks dropped (diacritic insensitive:schéma → schema); letters/digits kept, lowercased; everything else (whitespace, punctuation, backslashes, underscores, brackets...) becomes a single space, so\lambda_0 → " lambda 0"and the wordlambdastill matches inside it.static voidpaintWholeNode(NTxNode node, NTxRendererContext ctx) Paints everywhole-nodespan of the node over its layout bounds.static voidset(NTxNode node, List<NTxNodeHighlight> highlights) Binds (or replaces) the highlight list of a node.
-
Method Details
-
get
- Returns:
- the mutable list of highlights bound to the node (never null, may be empty)
-
set
Binds (or replaces) the highlight list of a node. A null or empty list removes the entry entirely. -
clear
Removes every highlight bound to the node. -
hasHighlights
True when the node carries at least one highlight. -
normalize
Canonical normalization used by search, indexing and painting:- NFD decomposition, combining marks dropped (diacritic
insensitive:
schéma → schema); - letters/digits kept, lowercased;
- everything else (whitespace, punctuation, backslashes,
underscores, brackets...) becomes a single space, so
\lambda_0 → " lambda 0"and the wordlambdastill matches inside it.
- Returns:
- normalized text, never null
- NFD decomposition, combining marks dropped (diacritic
insensitive:
-
needlesOf
-
findMatches
Finds every raw[start,end)range ofrawwhose text matchesneedleundernormalize(String). Indexes map back to the raw (non-normalized) string so callers can slice it directly.- Returns:
- list of
int[]{start,end}ranges (possibly empty)
-
paintWholeNode
Paints everywhole-nodespan of the node over its layout bounds. Called bynet.thevpc.ntexup.engine.renderer.NTxNodeRendererBaseafter the node content is drawn; does nothing unless the host enabled theNTxRendererContext.CAPABILITY_SEARCH_HIGHLIGHTScapability (the screen viewer), so PDF/HTML/image renders stay clean.
-