Class FormattedTextView
- java.lang.Object
-
- com._1c.g5.v8.dt.md.ui.editor.formattedtext.FormattedTextView
-
- All Implemented Interfaces:
org.eclipse.ui.services.IDisposable
public class FormattedTextView extends Object implements org.eclipse.ui.services.IDisposable
View to display formatted text content. Based on Chromium SWTBrowser
.
-
-
Constructor Summary
Constructors Constructor Description FormattedTextView(org.eclipse.swt.chromium.Browser browser, String content, IV8Project v8Project, IMdObjectByTypeProvider objectByTypeProvider, IColorProvider colorProvider, IFontProvider fontProvider, int scale, double preferredWidth, double preferredHeight, FormattedStringSettings formattedStringSettings)
Creates new view of formatted text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
protected Object
evaluateScript(String script)
Evaluates java script in browser engineorg.eclipse.swt.graphics.Point
getContentSize()
Returns size of the loaded content.void
resizeView(double width, double height)
Resizes view containment.protected void
setInitialContent(String html)
Sets HTML content to the view.void
updateFormattedStringSettings(FormattedStringSettings settings)
Updates theFormattedStringSettings
.
-
-
-
Constructor Detail
-
FormattedTextView
public FormattedTextView(org.eclipse.swt.chromium.Browser browser, String content, IV8Project v8Project, IMdObjectByTypeProvider objectByTypeProvider, IColorProvider colorProvider, IFontProvider fontProvider, int scale, double preferredWidth, double preferredHeight, FormattedStringSettings formattedStringSettings)
Creates new view of formatted text.- Parameters:
browser
- theBrowser
instance to which to attach this view, cannot benull
content
- formatted text contentv8Project
- V8 project, cannot benull
objectByTypeProvider
- object by type provider, cannot benull
colorProvider
- the color provider, cannot benull
fontProvider
- the font provider, cannot benull
scale
- the form scale in percentpreferredWidth
- the preferred width of the formatted text, useSWT.DEFAULT
to ignore limitpreferredHeight
- the preferred height of the formatted text, useSWT.DEFAULT
to ignore limitformattedStringSettings
- the formatted text default settings, can benull
-
-
Method Detail
-
getContentSize
public org.eclipse.swt.graphics.Point getContentSize()
Returns size of the loaded content.- Returns:
- content size calculated or (-1,-1) in case of problems
-
updateFormattedStringSettings
public void updateFormattedStringSettings(FormattedStringSettings settings)
Updates theFormattedStringSettings
. If default font style is changed you should use this method to set correct settings.- Parameters:
settings
- new formatted text settings, can't benull
-
resizeView
public void resizeView(double width, double height)
Resizes view containment.- Parameters:
width
- new width for viewheight
- new height for viewonContentLoaded
- callback to be called when content has been loaded
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceorg.eclipse.ui.services.IDisposable
-
setInitialContent
protected void setInitialContent(String html)
Sets HTML content to the view. Browser engine works asynchronuosly, so that after setting a formatted text to the browser we create a progress listener and produce additional rendering of the formatted text on completion. Seerender()
- Parameters:
html
- the content to set
-
-