@OpenApiAll
public class HTMLHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
HTMLHelper.Renderer
Root text view that acts as an HTML renderer.
|
Modifier and Type | Field and Description |
---|---|
static java.net.URL |
BASE |
static java.lang.String |
MD_ICON_TAG |
Constructor and Description |
---|
HTMLHelper() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
applyFontSizeStyleSheetColorOnP(java.lang.String html,
java.awt.Font font,
boolean ptUnits,
int red,
int green,
int blue)
Apply font size style and color on
|
static java.lang.String |
applyFontSizeStyleSheetOnBody(java.lang.String html,
java.awt.Font font,
boolean ptUnits)
Apply font size style on tag in the given html text.
|
static java.lang.String |
applyFontSizeStyleSheetOnP(java.lang.String html,
java.awt.Font font,
boolean ptUnits)
Apply font size style on
|
static void |
applyStyleSheet(javax.swing.text.html.StyleSheet styles,
com.nomagic.magicdraw.uml.symbols.shapes.TextObject obj,
boolean takeZoomFactor)
Changes the properties of the given style sheet according to the properties of the given text object.
|
static java.lang.String |
constructHTMLText(java.lang.String text)
Adds the html info to the given text in order to display it as HTML.
|
static java.lang.String |
constructHTMLText(java.lang.String text,
boolean convertCharacters,
boolean addEnterAfterP)
Adds the html info to the given text in order to display it as HTML.
|
static javax.swing.text.View |
createHTMLView(javax.swing.text.html.StyleSheet sheet,
com.nomagic.magicdraw.uml.symbols.shapes.TextObject object,
java.lang.String html,
Project project)
Create an html renderer for the text object and string of html.
|
static java.lang.String |
getHTMLBody(java.lang.String html) |
static java.lang.String |
getPureText(javax.swing.text.Document doc)
Returns the pure text.
|
static java.lang.String |
getPureTextFromHTMLSource(java.lang.String source)
Get Pure text from html source.
|
static java.lang.String |
getSelectedHTMLSource(javax.swing.JEditorPane htmlPane)
Get Selected html source.
|
static boolean |
isHTMLText(java.lang.String s)
Check the given string to see if it should trigger the
html rendering logic.
|
static java.lang.String |
makeEndTag(java.lang.String tag)
Create end tag for the given tag.
|
static java.lang.String |
makeStartTag(java.lang.String tag)
Create start tag for the given tag.
|
static java.lang.String |
removeColorTagsWithValue(java.lang.String pureText) |
static java.lang.String |
removeHTMLHeader(java.lang.String html)
Remove HTML Header from the given Val.
|
static void |
setPStyleProperties(javax.swing.text.html.StyleSheet styleSheet,
int fontSize,
java.lang.String family,
java.awt.Color foreground)
Set Style property
|
static java.lang.String |
stringToHTMLString(java.lang.String string) |
static java.lang.String |
wrapAsHTML(java.lang.String text) |
static java.lang.StringBuilder |
wrapAsHTML(java.lang.StringBuilder text) |
static java.lang.String |
wrapAsHTMLDocument(java.lang.String text) |
static java.lang.String |
wrapByHtmlBody(java.lang.String text) |
public static final java.lang.String MD_ICON_TAG
public static java.net.URL BASE
@Nonnull public static java.lang.String applyFontSizeStyleSheetOnP(@Nonnull java.lang.String html, @Nonnull java.awt.Font font, boolean ptUnits)
tags in the given html text
html
- html textfont
- fontptUnits
- use "pt" or "px" units for font size@Nonnull public static java.lang.String applyFontSizeStyleSheetColorOnP(@Nonnull java.lang.String html, @Nonnull java.awt.Font font, boolean ptUnits, int red, int green, int blue)
tags in the given html text.
html
- text.font
- text font.ptUnits
- use "pt" or "px" units for font sizered
- color code.green
- color code.blue
- color code.@Nonnull public static java.lang.String applyFontSizeStyleSheetOnBody(@Nonnull java.lang.String html, @Nonnull java.awt.Font font, boolean ptUnits)
html
- text.font
- text font.ptUnits
- use "pt" or "px" units for font sizepublic static javax.swing.text.View createHTMLView(@CheckForNull javax.swing.text.html.StyleSheet sheet, @Nonnull com.nomagic.magicdraw.uml.symbols.shapes.TextObject object, @Nonnull java.lang.String html, @CheckForNull Project project)
sheet
- the style sheet of the document.object
- the given text object.html
- the given html text.public static java.lang.String wrapAsHTML(@Nonnull java.lang.String text)
public static java.lang.StringBuilder wrapAsHTML(java.lang.StringBuilder text)
@Nonnull public static java.lang.String wrapAsHTMLDocument(@Nonnull java.lang.String text)
public static java.lang.String wrapByHtmlBody(java.lang.String text)
@Nonnull public static java.lang.String stringToHTMLString(@Nonnull java.lang.String string)
public static void applyStyleSheet(@Nonnull javax.swing.text.html.StyleSheet styles, @Nonnull com.nomagic.magicdraw.uml.symbols.shapes.TextObject obj, boolean takeZoomFactor)
styles
- the given style sheet.obj
- the given text object.public static void setPStyleProperties(@Nonnull javax.swing.text.html.StyleSheet styleSheet, int fontSize, @Nonnull java.lang.String family, @Nonnull java.awt.Color foreground)
styleSheet
- Style sheetfontSize
- Font size.family
- Font Familyforeground
- Fore ground color.public static java.lang.String removeColorTagsWithValue(java.lang.String pureText)
public static java.lang.String getPureText(javax.swing.text.Document doc)
public static java.lang.String getPureTextFromHTMLSource(java.lang.String source)
source
- The given html source.public static boolean isHTMLText(@CheckForNull java.lang.String s)
s
- the given string.public static java.lang.String removeHTMLHeader(java.lang.String html)
html
- The given HTML Source.public static java.lang.String getHTMLBody(java.lang.String html)
public static java.lang.String constructHTMLText(java.lang.String text)
text
- the given text.@Nonnull public static java.lang.String constructHTMLText(@Nonnull java.lang.String text, boolean convertCharacters, boolean addEnterAfterP)
text
- the given text.@Nonnull public static java.lang.String getSelectedHTMLSource(@Nonnull javax.swing.JEditorPane htmlPane)
htmlPane
- instance of JEditorPane
public static java.lang.String makeStartTag(java.lang.String tag)
tag
- The given tag.public static java.lang.String makeEndTag(java.lang.String tag)
tag
- The given tag.