Class LightText

    • Constructor Detail

      • LightText

        public LightText()
        Instantiates a new light text.
    • Method Detail

      • isMultiline

        public boolean isMultiline()
        Checks if this text is multiline.
        Returns:
        true if it is multiline, false otherwise.
      • setMultiline

        public void setMultiline​(boolean multiline)
        Sets the multiline mode on or off.
        Parameters:
        multiline - true to turn the multiline mode on, false to turn off.
      • getVisibleLineCount

        public int getVisibleLineCount()
        Gets the visible line count.
        Returns:
        the visible line count, -1 if no limit set.
      • setVisibleLineCount

        public void setVisibleLineCount​(int visibleLineCount)
        Sets the visible line count.
        Parameters:
        visibleLineCount - the new visible line count, -1 to clear the limit.
      • isLiveEditing

        public boolean isLiveEditing()
        Checks if this text is in live editing mode or not. In live editing mode text change listeners are notified immediately after the change. If live editing mode is off, change listeners are notified when a user hits the return key or this text box losses the focus.
        Returns:
        true if live editing is on, false otherwise.
      • setLiveEditing

        public void setLiveEditing​(boolean liveEditing)
        Sets the live editing mode on or off.
        Parameters:
        liveEditing - true to turn the live editing mode on, false otherwise.
        See Also:
        isLiveEditing()
      • isBorderVisible

        public boolean isBorderVisible()
        Checks if the border is visible.
        Returns:
        true if border is visible, false if not.
      • setBorderVisible

        public void setBorderVisible​(boolean borderVisible)
        Sets the border visibility.
        Parameters:
        borderVisible - true to show the border, false to hide it.
      • setEditable

        public void setEditable​(boolean isEditable)
        Description copied from interface: IEditable
        Sets control editable state.
        Specified by:
        setEditable in interface IEditable
        Parameters:
        isEditable - - true if control can be edited.
      • isEditable

        public boolean isEditable()
        Description copied from interface: IEditable
        Returns control editable state.
        Specified by:
        isEditable in interface IEditable
        Returns:
        true if control can be edited.
      • isReadOnly

        @Deprecated
        public boolean isReadOnly()
        Deprecated.
        use isEditable() instead.
        Checks if this text is read only or not.
        Returns:
        true if text is in read-only mode, false otherwise.
      • setReadOnly

        @Deprecated
        public void setReadOnly​(boolean readOnly)
        Deprecated.
        Sets the read only mode on or off.
        Parameters:
        readOnly - true to turn read-only mode on, false to turn it off.
      • isPasswordMode

        public boolean isPasswordMode()
        Checks whether password mode is on or off.
        Returns:
        true if text is in password mode, false otherwise.
      • setPasswordMode

        public void setPasswordMode​(boolean passwordMode)
        Sets password mode on or off. If password mode is set, text will hide all entered chars.
        Parameters:
        passwordMode - true to turn password mode on, false to turn it off.
      • setBorderColor

        public void setBorderColor​(org.eclipse.swt.graphics.Color borderColor)
        Sets the border color.
        Parameters:
        borderColor - the new border color.
      • setTextColor

        public void setTextColor​(org.eclipse.swt.graphics.Color textColor)
        Sets the text color.
        Parameters:
        textColor - the new text color.
      • setBackgroundColor

        public void setBackgroundColor​(org.eclipse.swt.graphics.Color backgroundColor)
        Sets the background color.
        Parameters:
        backgroundColor - the new background color.
      • setHintColor

        public void setHintColor​(org.eclipse.swt.graphics.Color hintColor)
        Sets the hint text color.
        Parameters:
        hintColor - the new hint text color, cannot be null
      • getText

        public String getText()
        Gets the current text value.
        Returns:
        the text.
      • getHintText

        public String getHintText()
        Returns the hint text of the text. Can return null if none hint is set.
        Returns:
        the hint text of the text or null if none hint is set.
      • setHintText

        public void setHintText​(String hintText)
        Set the hint text of the text. Hint will be displayed when no text is entered.
        Parameters:
        hintText - - the hint text, cannote be null
      • setText

        public void setText​(String text)
        Sets the text.
        Parameters:
        text - the new text.
      • setTextLimit

        public void setTextLimit​(int textLimit)
        Sets the text limit to the specified number of characters.
        The text limit specifies the amount of text that the user can type into the light text control.
        Parameters:
        textLimit - the new text limit.
      • getTextLimit

        public int getTextLimit()
        Returns the maximum number of characters that the light text control is capable of holding.
        Returns:
        the textLimit the text limit
      • addTextChangedListener

        public void addTextChangedListener​(IChangedListener<LightText,​String> listener)
        Adds the text changed listener.
        Parameters:
        listener - the listener.
      • removeTextChangedListener

        public void removeTextChangedListener​(IChangedListener<LightText,​String> listener)
        Removes the text changed listener.
        Parameters:
        listener - the listener.
      • addTextChangingListener

        public void addTextChangingListener​(IChangingListener<LightText,​String> listener)
        Adds the text changing listener.
        Parameters:
        listener - the listener.
      • removeTextChangingListener

        public void removeTextChangingListener​(IChangingListener<LightText,​String> listener)
        Removes the text changing listener.
        Parameters:
        listener - the listener.
      • clearSelection

        public void clearSelection()
        Clears the selection of this text box.
      • paint

        public void paint​(org.eclipse.swt.graphics.GC gc,
                          org.eclipse.swt.graphics.Rectangle rectangle)
        Description copied from interface: ILightControl
        Paints the given rectangle of this control.
        Specified by:
        paint in interface ILightControl
        Parameters:
        gc - the GC to paint on.
        rectangle - the rectangle to paint.
      • computeSize

        public org.eclipse.swt.graphics.Point computeSize​(org.eclipse.swt.graphics.GC gc,
                                                          int width,
                                                          int height,
                                                          boolean flushCache)
        Description copied from interface: ILightControl
        Computes the size of this control.
        Specified by:
        computeSize in interface ILightControl
        Overrides:
        computeSize in class AbstractLightControl
        Parameters:
        gc - the GC to do measurements with.
        width - the width hint, SWT.DEFAULT to compute the preferred width.
        height - the height hint, SWT.DEFAULT to compute the preferred height.
        flushCache - the flush cache flag, instructs the associated layout to reset all its caches, if any.
        Returns:
        the computed size.
      • getOverlayTextControl

        protected org.eclipse.swt.widgets.Control getOverlayTextControl()
        Returns overlay text control.
        Returns:
        overlay text control. Returns null if there is no overlay at the moment.
      • resetOverlayTextControl

        protected void resetOverlayTextControl()
        Resets overlay text control.
      • createOverlay

        protected void createOverlay​(org.eclipse.swt.widgets.Composite parent)
        Creates overlay
        Parameters:
        parent - - overlay parent. can't be null.
      • setOverlayText

        protected void setOverlayText​(String text)
        Sets overlay text.
        Parameters:
        text - - text to set. Can't be null.
      • getOverlayText

        protected String getOverlayText()
        Returns overlay text.
        Returns:
        overlay text. Can't return null.
      • selectAllOverlayText

        protected void selectAllOverlayText()
        Selects all overlay text.
      • getDisplayText

        protected String getDisplayText​(boolean displayHint)
        Returns displayed text.
        Parameters:
        displayHint - - true if should return hint if it is displaying.
        Returns:
        displayed text. Can't return null.
      • getLastNotifiedText

        protected String getLastNotifiedText()
        Returns last notified text.
        Returns:
        last notified text. Can't return null.
      • setLastNotifiedText

        protected void setLastNotifiedText​(String lastNotifiedText)
        Sets last notified text.
        Parameters:
        lastNotifiedText - - last notified text to set. Can't be null.
      • resetTextSize

        protected void resetTextSize()
        Resets text size.
      • setTextInternal

        protected void setTextInternal​(String text)
        Sets text without checking it.
        Parameters:
        text - - text to set. Can't be null.
      • setUndoRedoText

        protected void setUndoRedoText​(String undoRedoText)
        Sets undo redo text.
        Parameters:
        undoRedoText - - undo redo text to set. Can't be null.