Class JxBrowserUtil


  • public final class JxBrowserUtil
    extends java.lang.Object
    This class should only be called if JX Browser libs are on the class path.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CHROMIUM_DIR
      System flag used to specify alternative location for the binaries/assets used by the JxBrowser chromium engine.
      static java.lang.String DEBUG_PORT
      System flag used to declare alternative debug port exposed by Chromium
      static int DEFAULT_DEBUG_PORT
      Default port exposed by chromium for the purposes of attaching chromium dev-tools.
      static java.lang.String DEFAULT_JXBROWSER_DIR
      Default name of the folder containing chromium's runtime binaries/assets.
      static java.lang.String JX_BROWSER_VERSION  
      static java.lang.String JXBROWSER_LICENSE
      Override the JxBrowser license used to create an Engine instance.
      static java.lang.String USER_DATA_DIRECTORY
      The directory where user data is stored for an instance of the JxBrowser Engine.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Optional<com.teamdev.jxbrowser.engine.Engine> getOrCreateEngine​(LaunchContext launchContext, com.teamdev.jxbrowser.engine.RenderingMode renderingMode, java.lang.String jxbLicense)  
      static java.util.Optional<com.teamdev.jxbrowser.engine.Engine> getOrCreateEngine​(java.nio.file.Path resourceDir, com.teamdev.jxbrowser.engine.EngineOptions options)  
      static boolean hasModifiers​(com.teamdev.jxbrowser.ui.KeyModifiers modifiers)  
      static void initNavLifecycleObserverLogging​(com.teamdev.jxbrowser.browser.Browser browser, javax.swing.JTextField urlField)  
      static java.lang.String prettyPrintEngineOptions​(com.teamdev.jxbrowser.engine.EngineOptions options)
      Simple utility method that takes an EngineOptions object and returns a human readable string showing the options that are configured.
      static void shutdown​(com.teamdev.jxbrowser.engine.EngineOptions options)
      Shuts down the engine that was created using the specified chromium directory.
      static com.teamdev.jxbrowser.net.callback.VerifyCertificateCallback.Response verifyCertificate​(com.teamdev.jxbrowser.net.callback.VerifyCertificateCallback.Params params)  
      static int zoomPercentFromMouseWheelEvent​(com.teamdev.jxbrowser.ui.event.MouseWheel mouseEvent, com.teamdev.jxbrowser.zoom.ZoomLevel previousZoom)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CHROMIUM_DIR

        public static final java.lang.String CHROMIUM_DIR
        System flag used to specify alternative location for the binaries/assets used by the JxBrowser chromium engine. Defaults to
        <designer cache directory>/.ignition
        .
        See Also:
        Constant Field Values
      • DEBUG_PORT

        public static final java.lang.String DEBUG_PORT
        System flag used to declare alternative debug port exposed by Chromium
        See Also:
        Constant Field Values
      • DEFAULT_DEBUG_PORT

        public static final int DEFAULT_DEBUG_PORT
        Default port exposed by chromium for the purposes of attaching chromium dev-tools. Overridden by providing the specifying the DEBUG_PORT as a System (jvm) flag (e.g., ignition.conf jvm params).
        See Also:
        Constant Field Values
      • USER_DATA_DIRECTORY

        public static final java.lang.String USER_DATA_DIRECTORY
        The directory where user data is stored for an instance of the JxBrowser Engine. Default is to the designer cache directory/.jxbrowser/<ignition_username>
        See Also:
        Constant Field Values
      • JXBROWSER_LICENSE

        public static final java.lang.String JXBROWSER_LICENSE
        Override the JxBrowser license used to create an Engine instance. Not intended for public use due to restrictions requiring a license specific to Ignition, but may be useful in updating the license on systems which are unable to otherwise update to a newer version of Ignition, yet need to apply a more recent license.
        See Also:
        Constant Field Values
      • DEFAULT_JXBROWSER_DIR

        public static final java.lang.String DEFAULT_JXBROWSER_DIR
        Default name of the folder containing chromium's runtime binaries/assets.
        See Also:
        Constant Field Values
      • JX_BROWSER_VERSION

        public static final java.lang.String JX_BROWSER_VERSION
    • Method Detail

      • verifyCertificate

        public static com.teamdev.jxbrowser.net.callback.VerifyCertificateCallback.Response verifyCertificate​(com.teamdev.jxbrowser.net.callback.VerifyCertificateCallback.Params params)
      • shutdown

        public static void shutdown​(@Nullable
                                    com.teamdev.jxbrowser.engine.EngineOptions options)
        Shuts down the engine that was created using the specified chromium directory.
        Parameters:
        options - the engine options for the engine being closed (may get by calling engine.options())
      • getOrCreateEngine

        public static java.util.Optional<com.teamdev.jxbrowser.engine.Engine> getOrCreateEngine​(@Nonnull
                                                                                                java.nio.file.Path resourceDir,
                                                                                                @Nonnull
                                                                                                com.teamdev.jxbrowser.engine.EngineOptions options)
      • hasModifiers

        public static boolean hasModifiers​(com.teamdev.jxbrowser.ui.KeyModifiers modifiers)
      • getOrCreateEngine

        public static java.util.Optional<com.teamdev.jxbrowser.engine.Engine> getOrCreateEngine​(@Nonnull
                                                                                                LaunchContext launchContext,
                                                                                                @Nonnull
                                                                                                com.teamdev.jxbrowser.engine.RenderingMode renderingMode,
                                                                                                @Nonnull
                                                                                                java.lang.String jxbLicense)
      • zoomPercentFromMouseWheelEvent

        public static int zoomPercentFromMouseWheelEvent​(com.teamdev.jxbrowser.ui.event.MouseWheel mouseEvent,
                                                         com.teamdev.jxbrowser.zoom.ZoomLevel previousZoom)
        Parameters:
        mouseEvent - the raw mouse event that triggered the change in zoom
        previousZoom - the level that is the basis of the new zoom
        Returns:
        integer representing the percent of zoom for the new value
      • initNavLifecycleObserverLogging

        public static void initNavLifecycleObserverLogging​(@Nonnull
                                                           com.teamdev.jxbrowser.browser.Browser browser,
                                                           @Nullable
                                                           javax.swing.JTextField urlField)
      • prettyPrintEngineOptions

        public static java.lang.String prettyPrintEngineOptions​(@Nullable
                                                                com.teamdev.jxbrowser.engine.EngineOptions options)
        Simple utility method that takes an EngineOptions object and returns a human readable string showing the options that are configured.
        Returns:
        human readable string of the options, or "null" of the options object was null.