Class ProfilingConditionalTextProvider


  • @API(type=EXTENDABLE,
         src=PUBLIC)
    public class ProfilingConditionalTextProvider
    extends java.lang.Object
    Profiling/Conditional Text is a way to mark elements meant to appear in some renditions of the document, but not in others. It differs from one variant of the document to another, while unconditional elements appear in all document versions.
    This class provides custom support for Profiling/Conditional Text.
    Since:
    13.2
    • Constructor Detail

      • ProfilingConditionalTextProvider

        public ProfilingConditionalTextProvider()
    • Method Detail

      • getXMLFragmentForContentProfiling

        public java.lang.String getXMLFragmentForContentProfiling​(int startOffset,
                                                                  int endOffset,
                                                                  AuthorAccess authorAccess)
        This method is used when the document content between startOffset and endOffset must be profiled. The returned XML fragment is used to wrap the content included in the given offset interval.
        The first leaf of the XML fragment will be the destination of the text to surround. The profiling attributes will be set on the first element of the XML fragment.
        Parameters:
        startOffset - The start offset of the document content that must be profiled.
        endOffset - The end offset of the document content that must be profiled.
        authorAccess - Access class to the author functions.
        Returns:
        The XML fragment to wrap the profiled document content with. If this fragment is null the interval will not be profiled.
        Since:
        13.2
      • shouldAddProfilingDirectlyOnElement

        public boolean shouldAddProfilingDirectlyOnElement​(AuthorElement element)
        This method is used to decide if the profiling attributes will be set directly on the element. If this method returns false, the selected contetn will be wrapped in an XML fragment given by getXMLFragmentForContentProfiling(int, int, AuthorAccess).
        Parameters:
        element - The element to be analyzed.
        Returns:
        true to set the profiling attributes directly on the element, false to set the profiling on an XML fragment that will wrap the content of the element.
        Since:
        22