Class HTMLHelper


  • @OpenApiAll
    public class HTMLHelper
    extends java.lang.Object
    The class is used for html document creation.
    • Field Detail

      • styleSheet

        private static byte[] styleSheet
      • documentBase

        private static java.net.URL documentBase
    • Constructor Detail

      • HTMLHelper

        public HTMLHelper()
    • Method Detail

      • getDocumentBase

        public static java.net.URL getDocumentBase()
      • createDefaultStyleSheet

        private static javax.swing.text.html.StyleSheet createDefaultStyleSheet()
      • createHTMLView

        public static javax.swing.text.View createHTMLView​(com.nomagic.magicdraw.uml.symbols.shapes.TextObject object,
                                                           java.lang.String html,
                                                           @CheckForNull
                                                           Project project)
        Create an html renderer for the text object and string of html.
        Parameters:
        object - the given text object.
        html - the given html text.
      • createHTMLView

        public static javax.swing.text.View createHTMLView​(java.lang.String html,
                                                           javax.swing.text.StyledDocument document,
                                                           @CheckForNull
                                                           Project project,
                                                           @CheckForNull
                                                           ShapeElement object,
                                                           boolean useAlphaChannelForTransparency)
        Create an html renderer for the html text and document container
        Parameters:
        html - the given html text
        document - document
        object - the given text object
      • applyTransparency

        private static void applyTransparency​(javax.swing.text.StyledDocument document,
                                              ShapeElement object,
                                              boolean useAlphaChannel)
      • createDefaultDocument

        public static javax.swing.text.html.HTMLDocument createDefaultDocument​(com.nomagic.magicdraw.uml.symbols.shapes.TextObject obj)
        Creates the html document for given text object with given style sheet.
        Parameters:
        obj - the text object.
      • applyStyleSheet

        public 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.
        Parameters:
        styles - the given style sheet.
        obj - the given text object.
      • setPStyleProperties

        public static void setPStyleProperties​(javax.swing.text.html.StyleSheet styleSheet,
                                               int fontSize,
                                               java.lang.String family,
                                               java.awt.Color foreground)
        Set Style property
        Parameters:
        styleSheet - Style sheet
        fontSize - Font size.
        family - Font Family
        foreground - Fore ground color.
      • applyFontSizeStyleSheetOnP

        @Deprecated
        public static java.lang.String applyFontSizeStyleSheetOnP​(java.lang.String html,
                                                                  java.awt.Font font,
                                                                  boolean ptUnits)
        Deprecated.
        use HtmlStyleUtils.applyFontSizeStyleSheetOnP(String, Font, boolean)
      • applyFontSizeStyleSheetColorOnP

        @Deprecated
        public static java.lang.String applyFontSizeStyleSheetColorOnP​(java.lang.String html,
                                                                       java.awt.Font font,
                                                                       boolean ptUnits,
                                                                       int red,
                                                                       int green,
                                                                       int blue)
        Deprecated.
        use HtmlStyleUtils.applyFontSizeStyleSheetColorOnP(String, Font, boolean, int, int, int)
      • getPureTextFromHTMLSource

        @Deprecated
        public static java.lang.String getPureTextFromHTMLSource​(java.lang.String source)
      • isHTMLText

        @Deprecated
        public static boolean isHTMLText​(@CheckForNull
                                         java.lang.String text)
      • constructHTMLText

        @Deprecated
        public static java.lang.String constructHTMLText​(java.lang.String text)
      • constructHTMLText

        @Deprecated
        public static java.lang.String constructHTMLText​(java.lang.String text,
                                                         boolean convertCharacters,
                                                         boolean addEnterAfterP)
        Deprecated.
        use HtmlTextUtilsInternal.toHtmlText(String, boolean, boolean)