Class FormattedTextEditableView
- java.lang.Object
-
- com._1c.g5.v8.dt.md.ui.editor.formattedtext.FormattedTextViewFx
-
- com._1c.g5.v8.dt.md.ui.editor.formattedtext.FormattedTextEditableView
-
- All Implemented Interfaces:
org.eclipse.ui.services.IDisposable
public class FormattedTextEditableView extends FormattedTextViewFx
View of formatted text where editing is allowed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
FormattedTextEditableView.HtmlChangeListener
Listener of changing HTML contents.-
Nested classes/interfaces inherited from class com._1c.g5.v8.dt.md.ui.editor.formattedtext.FormattedTextViewFx
FormattedTextViewFx.HtmlConverterHelper
-
-
Constructor Summary
Constructors Constructor Description FormattedTextEditableView(javafx.embed.swt.FXCanvas canvas, String content, boolean makeActive, Runnable onContentLoaded, Consumer<String> onContentChanged, Runnable onSelectionChanged, IV8Project v8Project, IMdObjectByTypeProvider objectByTypeProvider, IColorProvider colorProvider, IFontProvider fontProvider)
Creates new editable view of formatted text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decreaseFontSize()
Decreases font size.String
getContent()
Gets content of formatted string.Color
getCurrentSelectionBackgroundColor()
Returns background color under current selection.Font
getCurrentSelectionFont()
Returns font under current selection.String
getCurrentSelectionHyperlink()
Returns hyperlink under current selection.Color
getCurrentSelectionTextColor()
Returns text color under current selection.void
increaseFontSize()
Increases font size.protected void
initializeJavaScript()
Runs JavaScript initialization scripts before loading HTML content.void
insertPicture(Picture picture)
Inserts picture.void
insertSymbol(int symbolCodePoint)
Inserts special symbol.void
insertSymbol(String symbols)
Inserts symbols.boolean
isCurrentSelectionBold()
Returns whether current selection is bold.boolean
isCurrentSelectionItalic()
Returns whether current selection is italic.boolean
isCurrentSelectionUnderline()
Returns whether current selection is bold.void
setBackgroundColor(Color color)
Sets background color.void
setBold()
Sets bold font.void
setContent(String content)
Sets content.void
setFont(Font font)
Sets specified font.void
setHyperlink(String hyperlink)
Sets hyperlink.protected void
setInitialContent(String html, Runnable onContentLoaded)
Sets HTML content to the view.void
setItalic()
Sets italic font.void
setTextColor(Color color)
Sets text color.void
setUnderline()
Sets underline font.-
Methods inherited from class com._1c.g5.v8.dt.md.ui.editor.formattedtext.FormattedTextViewFx
dispose, executeCommand, executeCommand, executeCommandStrArg, executeCommandStrArg, executeScript, executeScriptFromResource, getColorProvider, getContentAsHtml, getContentSize, getEncoder, getFontProvider, getObjectByTypeProvider, getResourceAsString, getV8Project, getVersion, getWebEngine, hideScrollBars, resizeView, updateFormattedStringSettings
-
-
-
-
Constructor Detail
-
FormattedTextEditableView
public FormattedTextEditableView(javafx.embed.swt.FXCanvas canvas, String content, boolean makeActive, Runnable onContentLoaded, Consumer<String> onContentChanged, Runnable onSelectionChanged, IV8Project v8Project, IMdObjectByTypeProvider objectByTypeProvider, IColorProvider colorProvider, IFontProvider fontProvider)
Creates new editable view of formatted text.- Parameters:
canvas
- theFXCanvas
instance to which to attach this view, cannot benull
content
- initial formatted text contentmakeActive
- flag to make the view activeonContentLoaded
- callback to be called when content has been loadedonContentChanged
- callback to be called when editor content changedonSelectionChanged
- callback to be called when editor selection changedv8Project
- V8 project, cannot benull
objectByTypeProvider
- object by type provider, cannot benull
colorProvider
- the color provider, cannot benull
fontProvider
- the font provider, cannot benull
-
-
Method Detail
-
setBold
public void setBold()
Sets bold font.
-
setContent
public void setContent(String content)
Sets content.- Parameters:
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.- Returns:
true
if font under current selection is bold,false
otherwise
-
isCurrentSelectionItalic
public boolean isCurrentSelectionItalic()
Returns whether current selection is italic.- Returns:
true
if font under current selection is italic,false
otherwise
-
isCurrentSelectionUnderline
public boolean isCurrentSelectionUnderline()
Returns whether current selection is bold.- Returns:
true
if font under current selection is underlined,false
otherwise
-
setFont
public void setFont(Font font)
Sets specified font.- Parameters:
font
- the font to set
-
getCurrentSelectionFont
public Font getCurrentSelectionFont()
Returns font under current selection.- Returns:
- 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.- Parameters:
color
- the color to set
-
getCurrentSelectionBackgroundColor
public Color getCurrentSelectionBackgroundColor()
Returns background color under current selection.- Returns:
- the background color
-
setTextColor
public void setTextColor(Color color)
Sets text color.- Parameters:
color
- the color to set
-
getCurrentSelectionTextColor
public Color getCurrentSelectionTextColor()
Returns text color under current selection.- Returns:
- the text color
-
setHyperlink
public void setHyperlink(String hyperlink)
Sets hyperlink.- Parameters:
hyperlink
- the hyperlink to set
-
getCurrentSelectionHyperlink
public String getCurrentSelectionHyperlink()
Returns hyperlink under current selection.- Returns:
- the hyperlink found or empty string if not
-
insertPicture
public void insertPicture(Picture picture)
Inserts picture.- Parameters:
picture
- the picture to insert
-
insertSymbol
public void insertSymbol(int symbolCodePoint)
Inserts special symbol.- Parameters:
symbolCodePoint
- the symbol's code point
-
insertSymbol
public void insertSymbol(String symbols)
Inserts symbols.- Parameters:
symbols
- the symbols for inserting, cannot benull
-
getContent
public String getContent()
Gets content of formatted string.- Returns:
- content of formatted string, never
null
-
initializeJavaScript
protected void initializeJavaScript()
Description copied from class:FormattedTextViewFx
Runs JavaScript initialization scripts before loading HTML content.- Overrides:
initializeJavaScript
in classFormattedTextViewFx
-
setInitialContent
protected void setInitialContent(String html, Runnable onContentLoaded)
Description copied from class:FormattedTextViewFx
Sets HTML content to the view.- Overrides:
setInitialContent
in classFormattedTextViewFx
- Parameters:
html
- the content to setonContentLoaded
- the callback to be called when initial content has been loaded
-
-