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 }
|
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.
302 * </p>
303 *
304 * <p><b>Deploying an Application as a Module</b></p>
305 * <p>
306 * If any Java class passed to JavaScript is in a named module, then it must
307 * be reflectively accessible to the {@code javafx.web} module.
308 * A class is reflectively accessible if the module
309 * {@link Module#isOpen(String,Module) opens} the containing package to at
310 * least the {@code javafx.web} module.
311 * Otherwise, the method will not be called, and no error or
312 * warning will be produced.
313 * </p>
314 * <p>
315 * For example, if {@code com.foo.MyClass} is in the {@code foo.app} module,
316 * the {@code module-info.java} might
317 * look like this:
318 * </p>
319 *
320 <pre>{@code module foo.app {
321 opens com.foo to javafx.web;
322 }}</pre>
323 *
324 * <p>
325 * Alternatively, a class is reflectively accessible if the module
326 * {@link Module#isExported(String) exports} the containing package
327 * unconditionally.
328 * </p>
329 *
330 * <p><b>Threading</b></p>
331 * <p>{@code WebEngine} objects must be created and accessed solely from the
332 * JavaFX Application thread. This rule also applies to any DOM and JavaScript
333 * objects obtained from the {@code WebEngine} object.
334 * @since JavaFX 2.0
335 */
336 final public class WebEngine {
337 static {
338 Accessor.setPageAccessor(w -> w == null ? null : w.getPage());
339
340 Invoker.setInvoker(new PrismInvoker());
341 Renderer.setRenderer(new PrismRenderer());
342 WCGraphicsManager.setGraphicsManager(new PrismGraphicsManager());
343 CursorManager.setCursorManager(new CursorManagerImpl());
344 com.sun.webkit.EventLoop.setEventLoop(new EventLoopImpl());
345 ThemeClient.setDefaultRenderTheme(new RenderThemeImpl());
346 Utilities.setUtilities(new UtilitiesImpl());
347 }
|