Class FormattedTextEditableView

  • All Implemented Interfaces:

    public class FormattedTextEditableView
    extends FormattedTextViewFx
    View of formatted text where editing is allowed.
    • Constructor Detail

      • FormattedTextEditableView

        public FormattedTextEditableView​(javafx.embed.swt.FXCanvas canvas,
                                         String content,
                                         boolean makeActive,
                                         Runnable onContentLoaded,
                                         Consumer<String> onContentChanged,
                                         Runnable onSelectionChanged,
                                         IV8ProjectManager v8projectManager,
                                         IMdObjectByTypeProvider objectByTypeProvider,
                                         org.eclipse.emf.ecore.EObject context,
                                         Version version,
                                         IColorProvider colorProvider,
                                         IFontProvider fontProvider)
        Creates new editable view of formatted text.
        canvas - the FXCanvas instance to which to attach this view, cannot be null
        content - initial formatted text content
        makeActive - flag to make the view active
        onContentLoaded - callback to be called when content has been loaded
        onContentChanged - callback to be called when editor content changed
        onSelectionChanged - callback to be called when editor selection changed
        v8projectManager - V8 project manager, cannot be null
        objectByTypeProvider - object by type provider, cannot be null
        context - context object which value to be edited, cannot be null
        version - current project version, cannot be null
        colorProvider - the color provider, cannot be null
        fontProvider - the font provider, cannot be null
    • Method Detail

      • setBold

        public void setBold()
        Sets bold font.
      • setContent

        public void setContent​(String content)
        Sets content.
        content - the content.
      • setItalic

        public void setItalic()
        Sets italic font.
      • setUnderline

        public void setUnderline()
        Sets underline font.
      • isCurrentSelectionBold

        public boolean isCurrentSelectionBold()
        Returns whether current selection is bold.
        true if font under current selection is bold, false otherwise
      • isCurrentSelectionItalic

        public boolean isCurrentSelectionItalic()
        Returns whether current selection is italic.
        true if font under current selection is italic, false otherwise
      • isCurrentSelectionUnderline

        public boolean isCurrentSelectionUnderline()
        Returns whether current selection is bold.
        true if font under current selection is underlined, false otherwise
      • setFont

        public void setFont​(Font font)
        Sets specified font.
        font - the font to set
      • getCurrentSelectionFont

        public Font getCurrentSelectionFont()
        Returns font under current selection.
        the font
      • increaseFontSize

        public void increaseFontSize()
        Increases font size.
      • decreaseFontSize

        public void decreaseFontSize()
        Decreases font size.
      • setBackgroundColor

        public void setBackgroundColor​(Color color)
        Sets background color.
        color - the color to set
      • getCurrentSelectionBackgroundColor

        public Color getCurrentSelectionBackgroundColor()
        Returns background color under current selection.
        the background color
      • setTextColor

        public void setTextColor​(Color color)
        Sets text color.
        color - the color to set
      • getCurrentSelectionTextColor

        public Color getCurrentSelectionTextColor()
        Returns text color under current selection.
        the text color
      • setHyperlink

        public void setHyperlink​(String hyperlink)
        Sets hyperlink.
        hyperlink - the hyperlink to set
      • getCurrentSelectionHyperlink

        public String getCurrentSelectionHyperlink()
        Returns hyperlink under current selection.
        the hyperlink found or empty string if not
      • insertPicture

        public void insertPicture​(Picture picture)
        Inserts picture.
        picture - the picture to insert
      • insertSymbol

        public void insertSymbol​(int symbolCodePoint)
        Inserts special symbol.
        symbolCodePoint - the symbol's code point
      • insertSymbol

        public void insertSymbol​(String symbols)
        Inserts symbols.
        symbols - the symbols for inserting, cannot be null
      • getContent

        public String getContent()
        Gets content of formatted string.
        content of formatted string, never null
      • setInitialContent

        protected void setInitialContent​(String html,
                                         Runnable onContentLoaded)
        Description copied from class: FormattedTextViewFx
        Sets HTML content to the view.
        setInitialContent in class FormattedTextViewFx
        html - the content to set
        onContentLoaded - the callback to be called when initial content has been loaded