280 * JSObject window = (JSObject) webEngine.executeScript("window");
281 * window.setMember("app", new JavaApplication());
282 * </code></pre>
283 * <p> In this case, since the property value is a local object, {@code "new JavaApplication()"},
284 * the value may be garbage collected in next GC cycle.
285 * <p>
286 * When a user clicks the link, it does not guarantee to execute the callback method {@code exit}.
287 * <p>
288 * If there are multiple Java methods with the given name,
289 * then the engine selects one matching the number of parameters
290 * in the call. (Varargs are not handled.) An unspecified one is
291 * chosen if there are multiple ones with the correct number of parameters.
292 * <p>
293 * You can pick a specific overloaded method by listing the
294 * parameter types in an "extended method name", which has the
295 * form <code>"<var>method_name</var>(<var>param_type1</var>,...,<var>param_typen</var>)"</code>. Typically you'd write the JavaScript expression:
296 * <pre>
297 * <code><var>receiver</var>["<var>method_name</var>(<var>param_type1</var>,...,<var>param_typeN</var>)"](<var>arg1</var>,...,<var>argN</var>)</code>
298 * </pre>
299 *
300 * <p><b>Threading</b></p>
301 * <p>{@code WebEngine} objects must be created and accessed solely from the
302 * JavaFX Application thread. This rule also applies to any DOM and JavaScript
303 * objects obtained from the {@code WebEngine} object.
304 * @since JavaFX 2.0
305 */
306 final public class WebEngine {
307 static {
308 Accessor.setPageAccessor(w -> w == null ? null : w.getPage());
309
310 Invoker.setInvoker(new PrismInvoker());
311 Renderer.setRenderer(new PrismRenderer());
312 WCGraphicsManager.setGraphicsManager(new PrismGraphicsManager());
313 CursorManager.setCursorManager(new CursorManagerImpl());
314 com.sun.webkit.EventLoop.setEventLoop(new EventLoopImpl());
315 ThemeClient.setDefaultRenderTheme(new RenderThemeImpl());
316 Utilities.setUtilities(new UtilitiesImpl());
317 }
318
319 private static final Logger logger =
|
280 * JSObject window = (JSObject) webEngine.executeScript("window");
281 * window.setMember("app", new JavaApplication());
282 * </code></pre>
283 * <p> In this case, since the property value is a local object, {@code "new JavaApplication()"},
284 * the value may be garbage collected in next GC cycle.
285 * <p>
286 * When a user clicks the link, it does not guarantee to execute the callback method {@code exit}.
287 * <p>
288 * If there are multiple Java methods with the given name,
289 * then the engine selects one matching the number of parameters
290 * in the call. (Varargs are not handled.) An unspecified one is
291 * chosen if there are multiple ones with the correct number of parameters.
292 * <p>
293 * You can pick a specific overloaded method by listing the
294 * parameter types in an "extended method name", which has the
295 * form <code>"<var>method_name</var>(<var>param_type1</var>,...,<var>param_typen</var>)"</code>. Typically you'd write the JavaScript expression:
296 * <pre>
297 * <code><var>receiver</var>["<var>method_name</var>(<var>param_type1</var>,...,<var>param_typeN</var>)"](<var>arg1</var>,...,<var>argN</var>)</code>
298 * </pre>
299 *
300 * <p>
301 * The Java class and method must both be declared public. If the class is in a
302 * named module, then the module must {@link Module#isOpen(String,Module) open}
303 * the containing package to at least the {@code javafx.web} module
304 * (or {@link Module#isExported(String) export} the containing package
305 * unconditionally). Otherwise, the method will not be called, and no error or
306 * warning will be produced.
307 * </p>
308 *
309 * <p><b>Threading</b></p>
310 * <p>{@code WebEngine} objects must be created and accessed solely from the
311 * JavaFX Application thread. This rule also applies to any DOM and JavaScript
312 * objects obtained from the {@code WebEngine} object.
313 * @since JavaFX 2.0
314 */
315 final public class WebEngine {
316 static {
317 Accessor.setPageAccessor(w -> w == null ? null : w.getPage());
318
319 Invoker.setInvoker(new PrismInvoker());
320 Renderer.setRenderer(new PrismRenderer());
321 WCGraphicsManager.setGraphicsManager(new PrismGraphicsManager());
322 CursorManager.setCursorManager(new CursorManagerImpl());
323 com.sun.webkit.EventLoop.setEventLoop(new EventLoopImpl());
324 ThemeClient.setDefaultRenderTheme(new RenderThemeImpl());
325 Utilities.setUtilities(new UtilitiesImpl());
326 }
327
328 private static final Logger logger =
|