Class MoreTextBuilderImpl

    • Constructor Detail

      • MoreTextBuilderImpl

        public MoreTextBuilderImpl()
    • Method Detail

      • getMoreText

        public java.lang.String getMoreText()
        Retrieves the more text from the more text property.
        Specified by:
        getMoreText in interface MoreTextBuilder
        Returns:
        The more text stored by the more text property.
      • setMoreText

        public void setMoreText​(java.lang.String aMoreText)
        Sets the more text for the more text property.
        Specified by:
        setMoreText in interface MoreTextBuilder
        Parameters:
        aMoreText - The more text to be stored by the more text mode property.
      • getColumnWidth

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

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

        public MoreTextMode getMoreTextMode()
        Retrieves the more text mode from the more text mode property.
        Specified by:
        getMoreTextMode in interface MoreTextBuilder
        Returns:
        The more text mode stored by the more text mode property.
      • setMoreTextMode

        public void setMoreTextMode​(MoreTextMode aMoreTextMode)
        Sets the more text mode for the more text mode property.
        Specified by:
        setMoreTextMode in interface MoreTextBuilder
        Parameters:
        aMoreTextMode - The more text mode to be stored by the more 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 MoreTextBuilder
        Specified by:
        toStrings in interface TextAccessor.TextProvider
        Returns:
        The according resulting String array
      • toMore

        protected static java.lang.String[] toMore​(java.lang.String[] aText,
                                                   int aLength,
                                                   java.lang.String aMore,
                                                   MoreTextMode aMoreTextMode)
        To more.
        Parameters:
        aText - the text
        aLength - the length
        aMore - the more
        aMoreTextMode - the more text mode
        Returns:
        the string[]
      • toMore

        protected static java.lang.String toMore​(java.lang.String aText,
                                                 int aLength,
                                                 java.lang.String aMore,
                                                 MoreTextMode aMoreTextMode)
        the text is "mored" depending on the provided MoreTextMode. In case it is MoreTextMode.NONE, then the text is returned untouched. In case it is MoreTextMode.LEFT, then the text is "mored" by the toMoreLeft(String, int, String) method. In case it is MoreTextMode.RIGHT, then the text is "mored" by the toMoreRight(String, int, String) method.
        Parameters:
        aText - The text to be truncated.
        aLength - The length to be reached.
        aMore - The text to be prepended to the left in case the text was longer than the required length.
        aMoreTextMode - The MoreTextMode specifying on how to truncate the text.
        Returns:
        The accordingly "mored" text.
      • toMoreLeft

        protected static java.lang.String toMoreLeft​(java.lang.String aText,
                                                     int aLength,
                                                     java.lang.String aMore)
        Truncates a text by cutting the text from left to the right to reach the given length. If the text is shorter, then the text is returned. In case the text is longer than the required length, then the more text (e.g. "...") is prepended to indicate that text has been cut off, altogether being of the required length.
        Parameters:
        aText - The text to be truncated.
        aLength - The length to be reached.
        aMore - The text to be prepended to the left in case the text was longer than the required length.
        Returns:
        A String, when being longer than the provided length, which is being truncated and prepended with the given more (e.g. "...") text, altogether being of the required length.
      • toMoreRight

        protected static java.lang.String toMoreRight​(java.lang.String aText,
                                                      int aLength,
                                                      java.lang.String aMore)
        Truncates a text by cutting the text from left to the right to reach the given length. If the text is shorter, then the text is returned. In case the text is longer than the required length, then the more text (e.g. "...") is prepended to indicate that text has been cut off, altogether being of the required length.
        Parameters:
        aText - The text to be truncated.
        aLength - The length to be reached.
        aMore - The text to be prepended to the left in case the text was longer than the required length.
        Returns:
        A String, when being longer than the provided length, which is being truncated and prepended with the given more (e.g. "...") text, altogether being of the required length.
      • toMoreCenter

        protected static java.lang.String toMoreCenter​(java.lang.String aText,
                                                       int aLength,
                                                       java.lang.String aMore)
        Truncates a text by cutting the text from left to the right and from right to left one by one to reach the given length. If the text is shorter, then the text is returned. In case the text is longer than the required length, then the more text (e.g. "...") is prepended to indicate that text has been cut off, altogether being of the required length.
        Parameters:
        aText - The text to be truncated.
        aLength - The length to be reached.
        aMore - The text to be prepended to the left in case the text was longer than the required length.
        Returns:
        A String, when being longer than the provided length, which is being truncated and prepended with the given more (e.g. "...") text, altogether being of the required length.
      • 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