Package provided.owlMaps.cefUtils.impl
Class CefUtils
java.lang.Object
provided.owlMaps.cefUtils.impl.CefUtils
- All Implemented Interfaces:
ICefUtils
public final class CefUtils extends java.lang.Object implements ICefUtils
Implementation of ICefUtils
- Author:
- swong
-
Field Summary
Fields Modifier and Type Field Description private org.cef.browser.CefMessageRoutercallbackMsgRouterThe message router to use for callbacks from the JavaScript side.(package private) org.cef.browser.CefBrowsercefBrowserThe current CefBrowser instance holding the frame that holds the mapprivate org.cef.CefClientcefClientThe CEF client object(package private) org.cef.browser.CefFramecefFrameThe current CefFrame holding the map in the browser(package private) ICefObjectcefMapThe current map object being held in the browserprivate ICefObjectFactorycefObjFacThe factory to use to create ICefObjectsprivate java.util.Map<java.util.UUID,java.util.function.Consumer<?>>consumerCallbackMapThe map of Consumer function ID's to the Consumer itself.private longdevToolsDelayThe current delay to use before creating and displaying the dev tools windowprivate java.lang.StringgoogleMapsApiKeyThe Google Maps API key in useprivate com.google.gson.GsongsonGSON JSON converter to use for data transmission to/from the JavaScript side(package private) booleanisTransparentIf true the browser background is transparentprivate static java.lang.StringJS_CALL_FN_FORMATFormat string for JavaScript call to run a given window function.private booleanmakeDevToolsIf true, create the dev tools window after the current devToolsDelayprivate org.cef.browser.CefMessageRouterobjCreateMsgRouterThe message router to use when creating objects on the JavaScript sideprivate java.util.Map<java.util.UUID,java.util.function.Consumer<?>>pendingReturnValMapThe map of Consumer function ID's to the Consumer itself where the Consumer is used for processing returned values from the JavaScript side.private org.cef.browser.CefMessageRouterreturnValMsgRouterThe message router to use for return values from JavaScript method calls.private java.util.Map<java.util.UUID,java.lang.Runnable>runnableCallbackMapThe map of Runnable function ID's to the Runnable itself.private ISystemInfosysInfoAccessors for accessing dynamic system valuesprivate booleanuseOSRIf true, use Off-Screen RenderingFields inherited from interface provided.owlMaps.cefUtils.ICefUtils
DEV_TOOLS_DELAY_DEFAULT, DEV_TOOLS_PORT_DEFAULT, MAKE_DEV_TOOLS_DEFAULT, USE_OFF_SCREEN_RENDERING_DEFAULT -
Constructor Summary
Constructors Constructor Description CefUtils(java.lang.String googleMapsApiKey, ISystemInfo sysInfo)Constructor for the class -
Method Summary
Modifier and Type Method Description <T> java.util.concurrent.Future<T>call(java.lang.String fnName, java.lang.reflect.Type returnType, java.lang.Object... params)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Call the specified Javascript functuion with the given parameters and return the result as a FuturevoidcallVoid(java.lang.String fnName, java.lang.Object... params)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
A call to the given Javascript function that is a void return<T> TconvertJsonMap(T x, java.lang.reflect.Type resultType)Converts the given object into the given result type by converting back to JSON and sending back through the GSON parser.ICefObjectgetCefMapObj()Get the ICefObject that wraps the Javascript map entitydoublegetSysLengthPerMeter()*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Get the conversion factor from the length units currently being used by the system into meters.ICefObjectmakeCefObj(java.lang.String jsClassname, java.lang.Object... params)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Instantiate the given class on the JavaScript side with the given parametersjava.util.UUIDregisterConsumerCallback(java.util.function.Consumer<?> callback)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Register the given Consumer in the system so that it can be used for callbacks.java.util.UUIDregisterPendingReturnValCallback(java.util.function.Consumer<?> callback)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Register the given Consumer in the system so that it can be used for return values of function calls.java.util.UUIDregisterRunnableCallback(java.lang.Runnable callback)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Register the given Runnable in the system so that it can be used for callbacks.voidsetDevToolsDelay(long delay)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Sets the delay to wait before opening the dev tools window.voidsetDevToolsPort(int port)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Set the port used by the dev tools windowvoidsetMakeDevTools(boolean makeDevTools)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Enables the display of the browser dev console windowvoidsetUseOSR(boolean useOSR)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Sets whether or not the system uses the Off-Screen Rendering (OSR).javax.swing.JComponentstart(java.lang.String startURL, provided.mixedData.IMixedDataDictionary mapOptionsDict, java.lang.Runnable onMapLoad)*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Start the Map on the Javascript sideMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
JS_CALL_FN_FORMAT
private static final java.lang.String JS_CALL_FN_FORMATFormat string for JavaScript call to run a given window function.- See Also:
- Constant Field Values
-
sysInfo
Accessors for accessing dynamic system values -
googleMapsApiKey
private final java.lang.String googleMapsApiKeyThe Google Maps API key in use -
cefClient
private final org.cef.CefClient cefClientThe CEF client object -
gson
private com.google.gson.Gson gsonGSON JSON converter to use for data transmission to/from the JavaScript side -
isTransparent
boolean isTransparentIf true the browser background is transparent -
makeDevTools
private boolean makeDevToolsIf true, create the dev tools window after the current devToolsDelay -
devToolsDelay
private long devToolsDelayThe current delay to use before creating and displaying the dev tools window -
useOSR
private boolean useOSRIf true, use Off-Screen Rendering -
cefObjFac
The factory to use to create ICefObjects -
callbackMsgRouter
private org.cef.browser.CefMessageRouter callbackMsgRouterThe message router to use for callbacks from the JavaScript side. The callbacks are assumed to be persistent and utilized multiple times. -
objCreateMsgRouter
private org.cef.browser.CefMessageRouter objCreateMsgRouterThe message router to use when creating objects on the JavaScript side -
returnValMsgRouter
private org.cef.browser.CefMessageRouter returnValMsgRouterThe message router to use for return values from JavaScript method calls. The callbacks are assumed to be single use for a particular function call's return value. -
runnableCallbackMap
private java.util.Map<java.util.UUID,java.lang.Runnable> runnableCallbackMapThe map of Runnable function ID's to the Runnable itself. -
consumerCallbackMap
private java.util.Map<java.util.UUID,java.util.function.Consumer<?>> consumerCallbackMapThe map of Consumer function ID's to the Consumer itself. -
pendingReturnValMap
private java.util.Map<java.util.UUID,java.util.function.Consumer<?>> pendingReturnValMapThe map of Consumer function ID's to the Consumer itself where the Consumer is used for processing returned values from the JavaScript side. -
cefBrowser
org.cef.browser.CefBrowser cefBrowserThe current CefBrowser instance holding the frame that holds the map -
cefFrame
org.cef.browser.CefFrame cefFrameThe current CefFrame holding the map in the browser -
cefMap
ICefObject cefMapThe current map object being held in the browser
-
-
Constructor Details
-
CefUtils
Constructor for the class- Parameters:
googleMapsApiKey- The Google Maps API key to usesysInfo- ISytemInfo object to provide dynamically set system-wide info such as the unit of length in use.
-
-
Method Details
-
start
public javax.swing.JComponent start(java.lang.String startURL, provided.mixedData.IMixedDataDictionary mapOptionsDict, java.lang.Runnable onMapLoad)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Start the Map on the Javascript side -
setDevToolsDelay
public void setDevToolsDelay(long delay)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Sets the delay to wait before opening the dev tools window. The dev tools window needs to be delayed so that it can show what's happening in the map.- Specified by:
setDevToolsDelayin interfaceICefUtils- Parameters:
delay- The number of milliseconds to delay
-
setUseOSR
public void setUseOSR(boolean useOSR)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Sets whether or not the system uses the Off-Screen Rendering (OSR). -
setDevToolsPort
public void setDevToolsPort(int port)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Set the port used by the dev tools window- Specified by:
setDevToolsPortin interfaceICefUtils- Parameters:
port- A valid port number not being used by any other app.
-
setMakeDevTools
public void setMakeDevTools(boolean makeDevTools)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Enables the display of the browser dev console window- Specified by:
setMakeDevToolsin interfaceICefUtils- Parameters:
makeDevTools- If true, show the dev console window
-
getCefMapObj
Description copied from interface:ICefUtilsGet the ICefObject that wraps the Javascript map entity- Specified by:
getCefMapObjin interfaceICefUtils- Returns:
- The ICefObject for the map
-
callVoid
public void callVoid(java.lang.String fnName, java.lang.Object... params)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
A call to the given Javascript function that is a void return -
call
public <T> java.util.concurrent.Future<T> call(java.lang.String fnName, java.lang.reflect.Type returnType, java.lang.Object... params)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Call the specified Javascript functuion with the given parameters and return the result as a Future -
registerRunnableCallback
public java.util.UUID registerRunnableCallback(java.lang.Runnable callback)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Register the given Runnable in the system so that it can be used for callbacks.- Specified by:
registerRunnableCallbackin interfaceICefUtils- Parameters:
callback- The Runnable to register- Returns:
- A unique ID associated with the given Runnable.
-
registerConsumerCallback
public java.util.UUID registerConsumerCallback(java.util.function.Consumer<?> callback)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Register the given Consumer in the system so that it can be used for callbacks. The callback is assumed to be persistent and used multiple times.- Specified by:
registerConsumerCallbackin interfaceICefUtils- Parameters:
callback- The Consumer to register- Returns:
- A unique ID associated with the given Consumer
-
registerPendingReturnValCallback
public java.util.UUID registerPendingReturnValCallback(java.util.function.Consumer<?> callback)Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Register the given Consumer in the system so that it can be used for return values of function calls. The callback is assumed to be single use and must be removed from the mapping when executed.- Specified by:
registerPendingReturnValCallbackin interfaceICefUtils- Parameters:
callback- The Consumer to register- Returns:
- A unique ID associated with the given Consumer
-
convertJsonMap
public <T> T convertJsonMap(T x, java.lang.reflect.Type resultType)Converts the given object into the given result type by converting back to JSON and sending back through the GSON parser.- Specified by:
convertJsonMapin interfaceICefUtils- Type Parameters:
T- The type of the original object- Parameters:
x- The original objectresultType- The desired type of the result- Returns:
- An object of the desired type, not usually the same instance as the given object
-
getSysLengthPerMeter
public double getSysLengthPerMeter()Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Get the conversion factor from the length units currently being used by the system into meters.- Specified by:
getSysLengthPerMeterin interfaceICefUtils- Returns:
- A length conversion factor of system_units/meter
-
makeCefObj
Description copied from interface:ICefUtils*** FOR INTERNAL USE ONLY!! DEVELOPER CODE SHOULD NEVER USE THIS METHOD DIRECTLY! ***
Instantiate the given class on the JavaScript side with the given parameters- Specified by:
makeCefObjin interfaceICefUtils- Parameters:
jsClassname- The name of the class to instantiateparams- The class's constructor parameters- Returns:
- An ICefObject representing the instantiated JavaScript object. The object is NOT to be considered viable until it is able to return a valid ID value.
-