public static void prepareForConversion ( @ Nonnull final IHCNode aStartNode , @ Nonnull final IHCHasChildrenMutable < ? , ? super IHCNode > aGlobalTargetNode , @ Nonnull final IHCConversionSettingsToNode aConversionSettings ) { ValueEnforcer . notNull ( aStartNode , "NodeToBeCustomized" ) ; ValueEnforcer . notNull ( aGlobalTargetNode , "TargetNode" ) ; ValueEnforcer . notNull ( aConversionSettings , "ConversionSettings" ) ; final IHCCustomizer aCustomizer = aConversionSettings . getCustomizer ( ) ; final EHTMLVersion eHTMLVersion = aConversionSettings . getHTMLVersion ( ) ; // Customize all elements before extracting out-of-band nodes, in case the // customizer adds some out-of-band nodes as well // Than finalize and register external resources final IHCIteratorNonBreakableCallback aCB = ( aParentNode , aChildNode ) -> { // If the parent node is suitable, use it, else use the global target // node IHCHasChildrenMutable < ? , ? super IHCNode > aRealTargetNode ; if ( aParentNode instanceof IHCHasChildrenMutable < ? , ? > ) { // Unchecked conversion aRealTargetNode = GenericReflection . uncheckedCast ( aParentNode ) ; } else aRealTargetNode = aGlobalTargetNode ; final int nTargetNodeChildren = aRealTargetNode . getChildCount ( ) ; // Run the global customizer aChildNode . customizeNode ( aCustomizer , eHTMLVersion , aRealTargetNode ) ; // finalize the node aChildNode . finalizeNodeState ( aConversionSettings , aRealTargetNode ) ; // Consistency check aChildNode . consistencyCheck ( aConversionSettings ) ; // No forced registration here final boolean bForcedResourceRegistration = false ; aChildNode . registerExternalResources ( aConversionSettings , bForcedResourceRegistration ) ; // Something was added? if ( aRealTargetNode . getChildCount ( ) > nTargetNodeChildren ) { // Recursive call on the target node only. // It's important to scan the whole tree, as a hierarchy of nodes may // have been added! prepareForConversion ( aRealTargetNode , aRealTargetNode , aConversionSettings ) ; } } ; HCHelper . iterateTreeNonBreakable ( aStartNode , aCB ) ; }
Customize the passed base node and all child nodes recursively .