Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSimcoe committed Jul 23, 2024
1 parent 5386f77 commit 2827098
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
10 changes: 7 additions & 3 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include::./includes/attributes.adoc[]

:extension-status: experimental

This extension allows you to use https://openjfx.io/[Java FX] to your Quarkus application.
This extension allows you to use https://openjfx.io/[Java FX] in your Quarkus application.

== Installation

Expand All @@ -33,7 +33,7 @@ dependencies {
== Usage

The extension allows using cdi features in JavaFX controller classes. +
The FXMLLoader is made a CDI bean and can be injected in your application.
The `FXMLLoader` is made a CDI bean and can be injected in your application.

.Loading FXML with injected `FXMLLoader`
[source,java]
Expand Down Expand Up @@ -121,4 +121,8 @@ public class MyBean {
@Inject
HostServices hostServices;
}
----
----

== Properties

include::includes/quarkus-fx.adoc[]
12 changes: 6 additions & 6 deletions docs/modules/ROOT/pages/run-on-fx-thread.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ Annotation can be applied on method level or on class level (to mark all methods
[source,java]
----
VBox vBox = new VBox();
private final VBox vBox = new VBox();
public void start(@Observes final FxStartupEvent event) {
public void start(@Observes final FxPostStartupEvent event) {
Stage = event.getPrimaryStage();
Scene scene = new Scene(this.vBox);
stage.setScene(scene);
stage.show();
try (ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor()) {
try (ExecutorService executorService = Executors.newSingleThreadExecutor()) {
executorService.submit(() -> this.showNode(this.createExpensiveNode()));
}
}
Node createExpensiveNode() {//<1>
Node createExpensiveNode() { //<1>
return new Label(LocalTime.now().toString());
}
@RunOnFxThread
void showNode(final Node node) {//<2>
void showNode(final Node node) { //<2>
this.vBox.getChildren().add(node);
}
----
<1> `createExpensiveNode` method will be executed in a thread from executor service
<2> `showNode` method will be executed on JavaFx UI thread (JavaFX Application Thread)
<2> `showNode` method will be executed on JavaFX UI thread (JavaFX Application Thread)
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/startup-synchronization.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ startupLatch.await();
// FX is ready
----

Alternatively, the `FxStartupEvent` can be observed.
Alternatively, the `FxApplicationStartupEvent` or `FxPostStartupEvent` events can be observed.

Example of a `SkipPredicate` that can be used in conjunction with a `@Scheduled`

Expand All @@ -28,7 +28,7 @@ public class FxApplicationNotStarted implements SkipPredicate {
private volatile boolean started;
void onFxStartup(@Observes final FxStartupEvent event) {
void onFxStartup(@Observes final FxPostStartupEvent event) {
this.started = true;
}
Expand Down

0 comments on commit 2827098

Please sign in to comment.