Class FormatedTextParser


  • public class FormatedTextParser
    extends java.lang.Object
    Parse looking for formated text (bold, italic, ...)
    Version:
    $Id$
    • Field Detail

      • textParser

        private TextParser textParser
        parser used to parse text...
      • FACTORY_MAP

        private static final java.util.Map<java.lang.String,​FormatBlockFactory> FACTORY_MAP
        map used to create blocks dependening on the text format
      • ITALIC_FACTORY

        private static final FormatBlockFactory ITALIC_FACTORY
        creates italic blocks
      • MONOSPACED_FACTORY

        private static final FormatBlockFactory MONOSPACED_FACTORY
        creates monospaced blocks
      • BOLDITALIC_FACTORY

        private static final FormatBlockFactory BOLDITALIC_FACTORY
        creates bold italic blocks
      • BOLDMONO_FACTORY

        private static final FormatBlockFactory BOLDMONO_FACTORY
        creates bold monospace blocks
      • SPECIAL_CHAR

        private static final java.lang.String[] SPECIAL_CHAR
        format characters
    • Constructor Detail

      • FormatedTextParser

        public FormatedTextParser()
    • Method Detail

      • parse

        final Block[] parse​(java.lang.String line)
        Parameters:
        line - line to parse
        Returns:
        TextBlock, ItalicBlock, BoldBlock, MonospacedBlock, ...
      • isSpace

        static boolean isSpace​(char c)
        Parameters:
        c - character to test
        Returns:
        true if c is a space character
      • isSpecial

        static boolean isSpecial​(char c)
        Parameters:
        c - character to test
        Returns:
        true if c is a character that limits the formats
      • parseFormat

        private java.util.List<Block> parseFormat​(java.lang.String line)
        Parse text format (bold, italic...)

        TODO too many lines!!

        Parameters:
        line - line to parse
        Returns:
        list of blocks
      • isParenthesis

        private boolean isParenthesis​(char c)
        Parameters:
        c - character to test
        Returns:
        true if c is a parenthesis
      • setTextParser

        public final void setTextParser​(TextParser textParser)
        Sets the formatTextParser.
        Parameters:
        textParser - text parser to use TextParser with the formatTextParser.