Class GeneratorUtils.MojoParserCallback

  • Enclosing class:
    GeneratorUtils

    private static class GeneratorUtils.MojoParserCallback
    extends javax.swing.text.html.HTMLEditorKit.ParserCallback
    ParserCallback implementation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean body
      A flag whether the parser is currently in the body element.
      private int depth
      The current indentation depth for the output.
      private java.util.Stack<GeneratorUtils.MojoParserCallback.Counter> numbering
      A stack of GeneratorUtils.MojoParserCallback.Counter objects corresponding to the nesting of (un-)ordered lists.
      private boolean pendingNewline
      A flag whether an implicit line break is pending in the output buffer.
      private int preformatted
      A flag whether the parser is currently processing preformatted text, actually a counter to track nesting.
      private java.lang.StringBuilder sb
      The current buffer.
      private boolean simpleTag
      A flag whether we have just parsed a simple tag.
      • Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback

        IMPLIED
    • Constructor Summary

      Constructors 
      Constructor Description
      MojoParserCallback​(java.lang.StringBuilder sb)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void flush()
      private void flushPendingNewline()
      Flushes a pending newline (if any).
      void handleEndTag​(javax.swing.text.html.HTML.Tag t, int pos)
      void handleSimpleTag​(javax.swing.text.html.HTML.Tag t, javax.swing.text.MutableAttributeSet a, int pos)
      void handleStartTag​(javax.swing.text.html.HTML.Tag t, javax.swing.text.MutableAttributeSet a, int pos)
      void handleText​(char[] data, int pos)
      private void newline​(boolean implicit)
      Writes a line break to the plain text output.
      private void text​(java.lang.String data)
      Writes the specified character data to the plain text output.
      • Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback

        handleComment, handleEndOfLineString, handleError
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • body

        private boolean body
        A flag whether the parser is currently in the body element.
      • preformatted

        private int preformatted
        A flag whether the parser is currently processing preformatted text, actually a counter to track nesting.
      • depth

        private int depth
        The current indentation depth for the output.
      • pendingNewline

        private boolean pendingNewline
        A flag whether an implicit line break is pending in the output buffer. This flag is used to postpone the output of implicit line breaks until we are sure that are not to be merged with other implicit line breaks.
      • simpleTag

        private boolean simpleTag
        A flag whether we have just parsed a simple tag.
      • sb

        private final java.lang.StringBuilder sb
        The current buffer.
    • Constructor Detail

      • MojoParserCallback

        MojoParserCallback​(java.lang.StringBuilder sb)
        Parameters:
        sb - not null
    • Method Detail

      • handleSimpleTag

        public void handleSimpleTag​(javax.swing.text.html.HTML.Tag t,
                                    javax.swing.text.MutableAttributeSet a,
                                    int pos)
        Overrides:
        handleSimpleTag in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • handleStartTag

        public void handleStartTag​(javax.swing.text.html.HTML.Tag t,
                                   javax.swing.text.MutableAttributeSet a,
                                   int pos)
        Overrides:
        handleStartTag in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • handleEndTag

        public void handleEndTag​(javax.swing.text.html.HTML.Tag t,
                                 int pos)
        Overrides:
        handleEndTag in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • handleText

        public void handleText​(char[] data,
                               int pos)
        Overrides:
        handleText in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • flush

        public void flush()
        Overrides:
        flush in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • newline

        private void newline​(boolean implicit)
        Writes a line break to the plain text output.
        Parameters:
        implicit - A flag whether this is an explicit or implicit line break. Explicit line breaks are always written to the output whereas consecutive implicit line breaks are merged into a single line break.
      • flushPendingNewline

        private void flushPendingNewline()
        Flushes a pending newline (if any).
      • text

        private void text​(java.lang.String data)
        Writes the specified character data to the plain text output. If the last output was a line break, the character data will automatically be prefixed with the current indent.
        Parameters:
        data - The character data, must not be null.