Class LightFormattedText

  • All Implemented Interfaces:
    IEditable, ILightControl

    public class LightFormattedText
    extends LightText
    Light formatted text control. User can set formatters for text input/output.
    This control uses Nebula FormattedText as overlay control. As formatter it also uses Nebula ITextFormatter formatter. For more information on how to use formatter see ITextFormatter and its implementations.
    This control does not support password mode, multiline mode. Visible line count is always one as control does not support multiline mode. Text limit can't be set via setTextLimit(int), because text limit is determined by formatter.
    • Constructor Detail

      • LightFormattedText

        public LightFormattedText()
        Default constructor.
      • LightFormattedText

        public LightFormattedText​(org.eclipse.nebula.widgets.formattedtext.ITextFormatter formatter)
        Constructor.
        Parameters:
        formatter - - formatter to use. Can be null.
    • Method Detail

      • setPasswordMode

        public void setPasswordMode​(boolean passwordMode)
        Formatted text does not support password mode.
        Overrides:
        setPasswordMode in class LightText
        Parameters:
        passwordMode - true to turn password mode on, false to turn it off.
      • isPasswordMode

        public boolean isPasswordMode()
        Description copied from class: LightText
        Checks whether password mode is on or off.
        Overrides:
        isPasswordMode in class LightText
        Returns:
        true if text is in password mode, false otherwise.
      • setMultiline

        public void setMultiline​(boolean multiline)
        Formatted text does not support multiline mode.
        Overrides:
        setMultiline in class LightText
        Parameters:
        multiline - true to turn the multiline mode on, false to turn off.
      • isMultiline

        public boolean isMultiline()
        Description copied from class: LightText
        Checks if this text is multiline.
        Overrides:
        isMultiline in class LightText
        Returns:
        true if it is multiline, false otherwise.
      • setText

        public void setText​(String text)
        Description copied from class: LightText
        Sets the text.
        Overrides:
        setText in class LightText
        Parameters:
        text - the new text.
      • setTextLimit

        public void setTextLimit​(int textLimit)
        Formatted text does not support text limit. Text limit is determined by formatter. Formatter can be set via setFormatter(ITextFormatter) method.
        Overrides:
        setTextLimit in class LightText
        Parameters:
        textLimit - the new text limit.
      • getTextLimit

        public int getTextLimit()
        Description copied from class: LightText
        Returns the maximum number of characters that the light text control is capable of holding.
        Overrides:
        getTextLimit in class LightText
        Returns:
        the textLimit the text limit
      • setVisibleLineCount

        public void setVisibleLineCount​(int visibleLineCount)
        Formatted text visible line counts is always one as it does not support multiline mode.
        Overrides:
        setVisibleLineCount in class LightText
        Parameters:
        visibleLineCount - the new visible line count, -1 to clear the limit.
      • getVisibleLineCount

        public int getVisibleLineCount()
        Description copied from class: LightText
        Gets the visible line count.
        Overrides:
        getVisibleLineCount in class LightText
        Returns:
        the visible line count, -1 if no limit set.
      • clearSelection

        public void clearSelection()
        Description copied from class: LightText
        Clears the selection of this text box.
        Overrides:
        clearSelection in class LightText
      • setFormatter

        public void setFormatter​(org.eclipse.nebula.widgets.formattedtext.ITextFormatter formatter)
        Sets formatter used to format text. Formatted text resets when formatter is set.
        Parameters:
        formatter - - formatter to set. Can be null.
      • getFormatter

        public org.eclipse.nebula.widgets.formattedtext.ITextFormatter getFormatter()
        Returns formatter used to format text.
        Returns:
        formatter used to format text. Can return null.
      • getOverlayTextControl

        protected org.eclipse.swt.widgets.Control getOverlayTextControl()
        Description copied from class: LightText
        Returns overlay text control.
        Overrides:
        getOverlayTextControl in class LightText
        Returns:
        overlay text control. Returns null if there is no overlay at the moment.
      • createOverlay

        protected void createOverlay​(org.eclipse.swt.widgets.Composite parent)
        Description copied from class: LightText
        Creates overlay
        Overrides:
        createOverlay in class LightText
        Parameters:
        parent - - overlay parent. can't be null.
      • setOverlayText

        protected void setOverlayText​(String text)
        Description copied from class: LightText
        Sets overlay text.
        Overrides:
        setOverlayText in class LightText
        Parameters:
        text - - text to set. Can't be null.
      • getOverlayText

        protected String getOverlayText()
        Description copied from class: LightText
        Returns overlay text.
        Overrides:
        getOverlayText in class LightText
        Returns:
        overlay text. Can't return null.