Class TextBlockBuilderImpl

    • Field Detail

      • NO_SINGLE_LINE_CHARS

        protected static final java.lang.String NO_SINGLE_LINE_CHARS
    • Constructor Detail

      • TextBlockBuilderImpl

        public TextBlockBuilderImpl()
    • Method Detail

      • withColumnWidth

        public TextBlockBuilder withColumnWidth​(int aColumnWidth)
        Specified by:
        withColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<TextBlockBuilder>
      • setColumnWidth

        public void setColumnWidth​(int aColumnWidth)
        Specified by:
        setColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
      • getColumnWidth

        public int getColumnWidth()
        Specified by:
        getColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor
      • getHorizAlignTextMode

        public HorizAlignTextMode getHorizAlignTextMode()
        Retrieves the horizontal align text mode from the horizontal align text mode property.
        Specified by:
        getHorizAlignTextMode in interface HorizAlignTextModeAccessor
        Returns:
        The horizontal align text mode stored by the horizontal align text mode property.
      • getSplitTextMode

        public SplitTextMode getSplitTextMode()
        Retrieves the split text mode from the split text mode property.
        Specified by:
        getSplitTextMode in interface TextBlockBuilder
        Returns:
        The split text mode stored by the split text mode property.
      • setSplitTextMode

        public void setSplitTextMode​(SplitTextMode aSplitTextMode)
        Sets the split text mode for the split text mode property.
        Specified by:
        setSplitTextMode in interface TextBlockBuilder
        Parameters:
        aSplitTextMode - The split text mode to be stored by the align text mode property.
      • toStrings

        public java.lang.String[] toStrings()
        The Strings being build by the builder upon the settings of the attributes.
        Specified by:
        toStrings in interface TextAccessor.TextProvider
        Returns:
        The according resulting String array
      • toTextBlock

        protected static java.lang.String[] toTextBlock​(java.lang.String aText,
                                                        int aLength)
        Cuts the String into subString instances with the maximum given length. The array of the resulting String instances is returned.
        Parameters:
        aText - The String text line to be cut into sub String instances ( String array).
        aLength - The maximum length of a line returned in the String array.
        Returns:
        A String array with the subString instances.
      • toTextBlock

        protected static java.lang.String[] toTextBlock​(java.lang.String aText,
                                                        int aLength,
                                                        SplitTextMode aLineSplitMode)
        Cuts the String into subString instances with the maximum given length. The array of the resulting String instances is returned.
        Parameters:
        aText - The String text line to be cut into sub String instances ( String array).
        aLength - The maximum length of a line returned in the String array.
        aLineSplitMode - Depending on which value is passed, a line is split into subString instances preferably reckoning an end of a line ( SplitTextMode.AT_END_OF_LINE), preferably reckoning the spaces (SplitTextMode.AT_SPACE) or exactly reckoning a given width (SplitTextMode.AT_FIXED_WIDTH).
        Returns:
        A String array with the subString instances.
      • toTextBlock

        protected static java.lang.String[] toTextBlock​(java.lang.String aText,
                                                        int aLength,
                                                        HorizAlignTextMode aHorizAlignTextMode)
        Cuts the String into subString instances with the maximum given length. The array of the resulting String instances is returned.
        Parameters:
        aText - The String text line to be cut into sub String instances ( String array).
        aLength - The maximum length of a line returned in the String array.
        aHorizAlignTextMode - The HorizAlignTextMode specifies on how a line is to be aligned in the result.
        Returns:
        A String array with the subString instances.
      • toTextBlock

        protected static java.lang.String[] toTextBlock​(java.lang.String aText,
                                                        int aLength,
                                                        HorizAlignTextMode aHorizAlignTextMode,
                                                        SplitTextMode aLineSplitMode)
        Cuts the String into subString instances with the maximum given length. The array of the resulting String instances is returned.
        Parameters:
        aText - The String text line to be cut into sub String instances ( String array).
        aLength - The maximum length of a line returned in the String array.
        aHorizAlignTextMode - The HorizAlignTextMode specifies on how a line is to be aligned in the result.
        aLineSplitMode - Depending on which value is passed, a line is split into subString instances preferably reckoning an end of a line ( SplitTextMode.AT_END_OF_LINE), preferably reckoning the spaces (SplitTextMode.AT_SPACE) or exactly reckoning a given width (SplitTextMode.AT_FIXED_WIDTH).
        Returns:
        A String array with the subString instances.
      • toNonBreakingLine

        protected static java.lang.String toNonBreakingLine​(java.lang.String aText)
        Creates a single line by replacing all new lines, line feeds and tabulators from the given String by full stops or spaces (heuristic) so that it is displayed in one single line.
        Parameters:
        aText - The String from which to replace all characters responsible for line wrapping and stuff.
        Returns:
        A String which will render in a single line.
      • getText

        public java.lang.String[] getText()
        Retrieves the text from the text property.
        Specified by:
        getText in interface TextAccessor
        Returns:
        The text stored by the text property.
      • setText

        public void setText​(java.lang.String... aText)
        Sets the text for the text property.
        Specified by:
        setText in interface TextAccessor.TextMutator
        Parameters:
        aText - The text to be stored by the text property.
      • withText

        public B withText​(java.lang.String... aText)
        With text.
        Specified by:
        withText in interface Text<B extends Text<B>>
        Specified by:
        withText in interface TextAccessor.TextBuilder<B extends Text<B>>
        Parameters:
        aText - the text
        Returns:
        the b
      • withText

        public B withText​(java.util.Collection<java.lang.String> aText)
        With text.
        Specified by:
        withText in interface TextAccessor.TextBuilder<B extends Text<B>>
        Parameters:
        aText - the text
        Returns:
        the b
      • toString

        public java.lang.String toString()
        The String being build by the builder upon the settings of the attributes. In case more then one line has been set as input and the functionality of the builder is applied to each line in separate, then this method returns all of them lines concatenated with a line break between each of them (implementation depended).
        Specified by:
        toString in interface TextAccessor.TextProvider
        Overrides:
        toString in class java.lang.Object
        Returns:
        The according resulting String