Separate JavaFX loading from the Neitzel injection container
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Person desk reference application
|
||||
|
||||
This runnable application demonstrates [NeitzelLib FX](../fx/README.md) and [injection](../injection/README.md) together. It edits one Person with a home Address, nested Note, visit list, selected visit and tags. Use it as a reference for wiring a real screen; the [minimal quick start](../fx/docs/quick-start.md) is the smaller starting point for a new project.
|
||||
This runnable application demonstrates [NeitzelLib FX](../fx/README.md) with the [optional Neitzel adapter](../fx-injection/README.md). It edits one Person with a home Address, nested Note, visit list, selected visit and tags. Use it as a reference for wiring a real screen; the [minimal quick start](../fx/docs/quick-start.md) is the smaller starting point for a new project.
|
||||
|
||||
Separate Java/FXML launchers demonstrate [standalone bars](../fx/docs/bars.md)
|
||||
and [docking](../fx/docs/docking.md) without initializing MVVM or injection.
|
||||
@@ -47,7 +47,7 @@ Paths below are relative to this module. Java sources share `src/main/java/de/ne
|
||||
| File/type | Responsibility |
|
||||
| --- | --- |
|
||||
| `Main` | Plain Java launcher calling `Application.launch` |
|
||||
| `DeskApp` | Scan configuration, fresh sample Model, ViewLoader, Scene and message popup registration |
|
||||
| `DeskApp` | Scan configuration, sample Model, Component registrations in `DeskApp.dependencies(person)`, ViewLoader and window-owned Model context |
|
||||
| `model/Person`, `Address`, `Note`, `Role` | JavaBean data and enum; no JavaFX properties required |
|
||||
| `view/DeskController` and `Desk.fxml` | Screen handlers, computed greeting, controls and binding declarations |
|
||||
| `view/PersonViewModel` | Handwritten ViewModel subclass with a derived title |
|
||||
@@ -81,7 +81,7 @@ normal build needs no Designer processor; Lombok still runs.
|
||||
2. Edit Age using its `years ` text format. An invalid value stays visible while the previous Model value is retained. A message explains the failure; a valid value clears that conversion failure.
|
||||
3. Edit the home street. The path-bound label follows. Empty street input fails through `StreetConverter`; the parent receives the child message with the `home.street` source prefix.
|
||||
4. Edit the nested note. AddressForm's inner NoteForm binds to its own Model. The `Opened as ...` label records initial setup rather than tracking every later city edit.
|
||||
5. Add a visit. Both the repeated forms and Table gain a row. Edit a street in one representation and observe the same Address in the other. The Table's Remove button delegates to the controller.
|
||||
5. Add a visit. Both the repeated forms and Table gain a row. Edit a street in one representation and observe the same Address in the other. The Table's Remove button uses the desk's shared `VisitActions` service.
|
||||
6. Select a visit in the ComboBox or Table. Both use the `selectedVisit` Attribute. Resize, sort and filter Table columns; filtering and sorting affect displayed rows without reordering the Model's list.
|
||||
7. Edit the visited date in ISO form (`yyyy-MM-dd`). Invalid text keeps the old date. Add a tag to see a shared ObservableList of simple values.
|
||||
8. Try the information, warning and fatal message buttons. Severity is data and logging behavior; a fatal message does not itself exit the application. Close each non-blocking popup normally.
|
||||
|
||||
@@ -41,8 +41,9 @@ The application adapter owns its change listener and derived bindings. Its
|
||||
`onClosed` and `onDiscarded` hooks release those resources explicitly. Moves,
|
||||
collapse and veto do not run those hooks. A rejected factory-created editor is
|
||||
discarded; rejection of a directly supplied Dockable leaves cleanup to its caller.
|
||||
This does not dispose the LoadedView or evict the runtime's strong Model-to-ViewModel
|
||||
identity cache. See the [MVVM lifetime contract](../../fx/docs/architecture.md).
|
||||
The same hooks close the editor's `ViewModelContext`, which closes the
|
||||
`LoadedView` and clears its Model-to-ViewModel registrations. See the
|
||||
[MVVM lifetime contract](../../fx/docs/architecture.md).
|
||||
|
||||
`MvvmDockingTest` loads the actual example FXML and checks model/property/control
|
||||
edits before and after moves, object identity, bar ownership, global toolbar
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
<dependency><groupId>com.h2database</groupId><artifactId>h2</artifactId><version>${h2.version}</version></dependency>
|
||||
<dependency>
|
||||
<groupId>de.neitzel.lib</groupId>
|
||||
<artifactId>fx</artifactId>
|
||||
<artifactId>fx-injection</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
+4
-10
@@ -2,29 +2,23 @@ package de.neitzel.fx.example.preview;
|
||||
|
||||
import de.neitzel.fx.example.DeskApp;
|
||||
import de.neitzel.fx.example.model.Address;
|
||||
import de.neitzel.fx.example.view.DeskController;
|
||||
import de.neitzel.fx.example.view.PersonViewModel;
|
||||
import de.neitzel.fxdesigner.preview.PreviewProvider;
|
||||
import de.neitzel.fxdesigner.preview.PreviewSession;
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import de.neitzel.fx.view.ViewDependencies;
|
||||
|
||||
/** Independent samples for the nested, repeated and table-row Address components. */
|
||||
public final class AddressPreviewProvider implements PreviewProvider<Address, ApplicationContext> {
|
||||
public final class AddressPreviewProvider implements PreviewProvider<Address, ViewDependencies> {
|
||||
@Override
|
||||
public Class<Address> modelType() {
|
||||
return Address.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreviewSession<Address, ApplicationContext> open(String id) {
|
||||
public PreviewSession<Address, ViewDependencies> open(String id) {
|
||||
if (!java.util.Set.of("address", "visit", "row").contains(id))
|
||||
throw new IllegalArgumentException("Unknown address example: " + id);
|
||||
var person = DeskApp.sample();
|
||||
var context = new ApplicationContext(DeskApp.class);
|
||||
// An independently previewed row still needs the parent action's state.
|
||||
// No Desk.fxml is loaded and no popup listener is installed.
|
||||
if ("row".equals(id))
|
||||
context.getComponent(DeskController.class).setViewModel(new PersonViewModel(person));
|
||||
var context = DeskApp.dependencies(person);
|
||||
return new SampleSession<>(
|
||||
"address".equals(id) ? person.getHome() : person.getVisits().getFirst(), context);
|
||||
}
|
||||
|
||||
@@ -4,18 +4,19 @@ import de.neitzel.fx.example.DeskApp;
|
||||
import de.neitzel.fx.example.model.Person;
|
||||
import de.neitzel.fxdesigner.preview.PreviewProvider;
|
||||
import de.neitzel.fxdesigner.preview.PreviewSession;
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import de.neitzel.fx.view.ViewDependencies;
|
||||
|
||||
/** Optional test-source preview adapter; it never enters the application distribution. */
|
||||
public final class DeskPreviewProvider implements PreviewProvider<Person, ApplicationContext> {
|
||||
public final class DeskPreviewProvider implements PreviewProvider<Person, ViewDependencies> {
|
||||
@Override
|
||||
public Class<Person> modelType() {
|
||||
return Person.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreviewSession<Person, ApplicationContext> open(String id) {
|
||||
public PreviewSession<Person, ViewDependencies> open(String id) {
|
||||
if (!"desk".equals(id)) throw new IllegalArgumentException("Unknown desk example: " + id);
|
||||
return new SampleSession<>(DeskApp.sample(), new ApplicationContext(DeskApp.class));
|
||||
var person = DeskApp.sample();
|
||||
return new SampleSession<>(person, DeskApp.dependencies(person));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,19 +4,19 @@ import de.neitzel.fx.example.DeskApp;
|
||||
import de.neitzel.fx.example.model.Note;
|
||||
import de.neitzel.fxdesigner.preview.PreviewProvider;
|
||||
import de.neitzel.fxdesigner.preview.PreviewSession;
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import de.neitzel.fx.view.ViewDependencies;
|
||||
|
||||
/** Independent sample for the nested note editor. */
|
||||
public final class NotePreviewProvider implements PreviewProvider<Note, ApplicationContext> {
|
||||
public final class NotePreviewProvider implements PreviewProvider<Note, ViewDependencies> {
|
||||
@Override
|
||||
public Class<Note> modelType() {
|
||||
return Note.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreviewSession<Note, ApplicationContext> open(String id) {
|
||||
public PreviewSession<Note, ViewDependencies> open(String id) {
|
||||
if (!"note".equals(id)) throw new IllegalArgumentException("Unknown note example: " + id);
|
||||
return new SampleSession<>(
|
||||
DeskApp.sample().getHome().getNote(), new ApplicationContext(DeskApp.class));
|
||||
var person = DeskApp.sample();
|
||||
return new SampleSession<>(person.getHome().getNote(), DeskApp.dependencies(person));
|
||||
}
|
||||
}
|
||||
|
||||
+13
-11
@@ -3,7 +3,9 @@ package de.neitzel.fx.example.preview;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import de.neitzel.fx.example.view.DeskController;
|
||||
import de.neitzel.fx.example.view.VisitRow;
|
||||
import de.neitzel.fx.view.ViewLoader;
|
||||
import de.neitzel.fx.view.ViewModelContext;
|
||||
|
||||
import javafx.application.Platform;
|
||||
|
||||
@@ -48,12 +50,12 @@ class PreviewProvidersTest {
|
||||
assertNotSame(first.model(), second.model());
|
||||
assertNotSame(first.model().getHome(), second.model().getHome());
|
||||
assertNotSame(first.context(), second.context());
|
||||
var view =
|
||||
ViewLoader.load(
|
||||
DeskController.class.getResource("Desk.fxml"),
|
||||
first.model(),
|
||||
first.context());
|
||||
assertNotNull(view.getRoot().lookup("#nameField"));
|
||||
try (var models = new ViewModelContext()) {
|
||||
var view = ViewLoader.loadWithDependencies(
|
||||
DeskController.class.getResource("Desk.fxml"),
|
||||
first.model(), first.context(), models);
|
||||
assertNotNull(view.getRoot().lookup("#nameField"));
|
||||
}
|
||||
assertEquals("Ada Lovelace", first.model().getName());
|
||||
assertTrue(first.ready().toCompletableFuture().isDone());
|
||||
assertThrows(IllegalArgumentException.class, () -> provider.open("unknown"));
|
||||
@@ -70,11 +72,11 @@ class PreviewProvidersTest {
|
||||
var visit = addresses.open("visit");
|
||||
assertNotNull(visit.model().getVisitedOn());
|
||||
var row = addresses.open("row");
|
||||
assertDoesNotThrow(
|
||||
() ->
|
||||
row.context()
|
||||
.getComponent(DeskController.class)
|
||||
.removeVisit(row.model()));
|
||||
try (var models = new ViewModelContext()) {
|
||||
var view = ViewLoader.loadComponentWithDependencies(
|
||||
VisitRow.class, row.model(), row.context(), models);
|
||||
assertDoesNotThrow(((VisitRow) view.getRoot())::remove);
|
||||
}
|
||||
var note = new NotePreviewProvider().open("note");
|
||||
assertEquals("Kept at home", note.model().getText());
|
||||
assertThrows(IllegalArgumentException.class, () -> addresses.open("desk"));
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package de.neitzel.fx.example.preview;
|
||||
|
||||
import de.neitzel.fxdesigner.preview.PreviewSession;
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import de.neitzel.fx.view.ViewDependencies;
|
||||
|
||||
/** The sample owns no timers, network connections or background work to release. */
|
||||
record SampleSession<M>(M model, ApplicationContext context)
|
||||
implements PreviewSession<M, ApplicationContext> {
|
||||
record SampleSession<M>(M model, ViewDependencies context)
|
||||
implements PreviewSession<M, ViewDependencies> {
|
||||
@Override
|
||||
public void close() {}
|
||||
}
|
||||
|
||||
@@ -4,19 +4,28 @@ import de.neitzel.fx.example.model.Address;
|
||||
import de.neitzel.fx.example.model.Note;
|
||||
import de.neitzel.fx.example.model.Person;
|
||||
import de.neitzel.fx.example.model.Role;
|
||||
import de.neitzel.fx.example.view.AddressForm;
|
||||
import de.neitzel.fx.example.view.DeskController;
|
||||
import de.neitzel.fx.example.view.NoteForm;
|
||||
import de.neitzel.fx.example.view.VisitActions;
|
||||
import de.neitzel.fx.example.view.VisitForm;
|
||||
import de.neitzel.fx.example.view.VisitRow;
|
||||
import de.neitzel.fx.injection.NeitzelViewDependencies;
|
||||
import de.neitzel.fx.view.LoadedView;
|
||||
import de.neitzel.fx.view.MessagePopup;
|
||||
import de.neitzel.fx.view.ViewLoader;
|
||||
import de.neitzel.fx.view.ViewModelContext;
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import de.neitzel.injection.annotation.Config;
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Opens the person desk for one ordinary {@link Person}.
|
||||
@@ -60,6 +69,14 @@ public class DeskApp extends Application {
|
||||
return person;
|
||||
}
|
||||
|
||||
/** Configures one Model and shared service context for the app or a preview. */
|
||||
public static NeitzelViewDependencies dependencies(Person person) {
|
||||
var context = new ApplicationContext(DeskApp.class);
|
||||
context.getComponent(VisitActions.class).setPerson(person);
|
||||
return new NeitzelViewDependencies(context,
|
||||
Set.of(AddressForm.class, NoteForm.class, VisitForm.class, VisitRow.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the desk.
|
||||
*
|
||||
@@ -76,9 +93,11 @@ public class DeskApp extends Application {
|
||||
*/
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
ApplicationContext context = new ApplicationContext(DeskApp.class);
|
||||
Person person = sample();
|
||||
LoadedView loaded = ViewLoader.load(DeskController.class.getResource("Desk.fxml"), person, context);
|
||||
var models = new ViewModelContext();
|
||||
LoadedView loaded = ViewLoader.loadWithDependencies(
|
||||
DeskController.class.getResource("Desk.fxml"), person, dependencies(person), models);
|
||||
stage.addEventHandler(WindowEvent.WINDOW_HIDDEN, event -> models.close());
|
||||
MessagePopup.showNewMessages(loaded.getViewModel());
|
||||
stage.setTitle("fx example");
|
||||
stage.setScene(new Scene(loaded.getRoot()));
|
||||
|
||||
@@ -3,9 +3,12 @@ package de.neitzel.fx.example.docking.mvvm;
|
||||
import de.neitzel.fx.docking.Dockable;
|
||||
import de.neitzel.fx.docking.DockableId;
|
||||
import de.neitzel.fx.example.model.Note;
|
||||
import de.neitzel.fx.injection.NeitzelViewDependencies;
|
||||
import de.neitzel.fx.view.LoadedView;
|
||||
import de.neitzel.fx.view.ViewLoader;
|
||||
import de.neitzel.fx.view.ViewModelContext;
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import java.util.Set;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.StringBinding;
|
||||
import javafx.beans.property.Property;
|
||||
@@ -21,6 +24,7 @@ import lombok.Getter;
|
||||
/** Application adapter: one loaded View becomes ordinary Dockable content. */
|
||||
public final class MvvmEditor implements AutoCloseable {
|
||||
@Getter private final Note model = new Note("Edit this note, then move or float its tab.");
|
||||
private final ViewModelContext models = new ViewModelContext();
|
||||
@Getter private final LoadedView view;
|
||||
@Getter private final Dockable dockable;
|
||||
private final Property<String> text;
|
||||
@@ -35,8 +39,9 @@ public final class MvvmEditor implements AutoCloseable {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public MvvmEditor(String id) {
|
||||
view = ViewLoader.load(MvvmEditor.class.getResource("MvvmEditor.fxml"), model,
|
||||
new ApplicationContext(MvvmEditor.class));
|
||||
var dependencies = new NeitzelViewDependencies(new ApplicationContext(MvvmEditor.class), Set.of());
|
||||
view = ViewLoader.loadWithDependencies(
|
||||
MvvmEditor.class.getResource("MvvmEditor.fxml"), model, dependencies, models);
|
||||
text = (Property<String>) view.property("text");
|
||||
TextArea input = (TextArea) view.getRoot().lookup("#text");
|
||||
dockable = new Dockable(new DockableId(id), view.getRoot());
|
||||
@@ -64,7 +69,7 @@ public final class MvvmEditor implements AutoCloseable {
|
||||
dirty.set(false);
|
||||
}
|
||||
|
||||
/** Releases this adapter's resources, not the LoadedView or global ViewModel identity cache. */
|
||||
/** Releases the editor's bindings and its managed View. */
|
||||
@Override public void close() {
|
||||
if (released) return;
|
||||
released = true;
|
||||
@@ -76,5 +81,6 @@ public final class MvvmEditor implements AutoCloseable {
|
||||
status.setText("Released application listeners");
|
||||
clear.setOnAction(null);
|
||||
clear.setDisable(true);
|
||||
models.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,18 +95,6 @@ public class DeskController implements HasViewModel {
|
||||
visits().add(created);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a visit from the list the table and Repeat are watching.
|
||||
*
|
||||
* @param visit the visit
|
||||
*/
|
||||
public void removeVisit(Address visit) {
|
||||
if (visit == null) {
|
||||
return;
|
||||
}
|
||||
visits().remove(visit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the tag field's text to the tag list and clears the field.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package de.neitzel.fx.example.view;
|
||||
|
||||
import de.neitzel.fx.example.model.Address;
|
||||
import de.neitzel.fx.example.model.Person;
|
||||
import jakarta.inject.Singleton;
|
||||
import lombok.Setter;
|
||||
|
||||
/** Removes a visit from the Model that owns the repeated forms and table rows. */
|
||||
@Singleton
|
||||
public final class VisitActions {
|
||||
@Setter
|
||||
private Person person;
|
||||
|
||||
public void remove(Address visit) {
|
||||
person.getVisits().remove(visit);
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,9 @@ import lombok.RequiredArgsConstructor;
|
||||
public class VisitRow extends HBox {
|
||||
|
||||
/**
|
||||
* The desk controller that removes a visit from the person.
|
||||
* The shared action that removes a visit from the person.
|
||||
*/
|
||||
private final DeskController desk;
|
||||
private final VisitActions visits;
|
||||
|
||||
/**
|
||||
* The visit this row edits. The table sets it once.
|
||||
@@ -63,7 +63,7 @@ public class VisitRow extends HBox {
|
||||
@FXML
|
||||
public void remove() {
|
||||
if (getModel() instanceof Address address) {
|
||||
desk.removeVisit(address);
|
||||
visits.remove(address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import de.neitzel.fx.example.view.VisitForm;
|
||||
import de.neitzel.fx.example.view.VisitRow;
|
||||
import de.neitzel.fx.view.LoadedView;
|
||||
import de.neitzel.fx.view.ViewLoader;
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import de.neitzel.fx.view.ViewDependencies;
|
||||
import de.neitzel.fx.view.ViewModelContext;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
@@ -122,16 +123,13 @@ class DeskLoadsTest {
|
||||
|
||||
/**
|
||||
* A second view of the same person reuses the view model, so a name edit shows on both.
|
||||
* <p>
|
||||
* The second document is only a name field. Loading the desk again would rebuild the home
|
||||
* address form, and that form is the cached singleton already showing.
|
||||
*/
|
||||
@Test
|
||||
void secondViewReusesTheViewModel() throws Exception {
|
||||
onFx(() -> {
|
||||
Loaded first = load();
|
||||
LoadedView second = ViewLoader.load(
|
||||
DeskLoadsTest.class.getResource("NameLine.fxml"), first.person(), first.context());
|
||||
LoadedView second = ViewLoader.loadWithDependencies(
|
||||
DeskLoadsTest.class.getResource("NameLine.fxml"), first.person(), first.context(), first.models());
|
||||
assertSame(first.view().getViewModel(), second.getViewModel());
|
||||
textField(first.root(), "nameField").setText("Grace");
|
||||
assertEquals("Grace", first.person().getName());
|
||||
@@ -261,16 +259,15 @@ class DeskLoadsTest {
|
||||
onFx(() -> {
|
||||
Loaded loaded = load();
|
||||
Parent root = loaded.root();
|
||||
DeskController desk = loaded.context().getComponent(DeskController.class);
|
||||
desk.leaveNote();
|
||||
fire(root, "Leave a note");
|
||||
assertEquals(de.neitzel.fx.view.Message.Severity.INFO,
|
||||
loaded.view().getViewModel().getLatestMessage().getSeverity());
|
||||
assertEquals("The model already has the name Ada Lovelace.", text(root, "noticeLabel"));
|
||||
desk.leaveWarning();
|
||||
fire(root, "Leave a warning");
|
||||
assertEquals(de.neitzel.fx.view.Message.Severity.WARN,
|
||||
loaded.view().getViewModel().getLatestMessage().getSeverity());
|
||||
assertEquals("Check the age before leaving the desk.", text(root, "noticeLabel"));
|
||||
desk.leaveFatal();
|
||||
fire(root, "Leave a fatal notice");
|
||||
assertEquals(de.neitzel.fx.view.Message.Severity.FATAL,
|
||||
loaded.view().getViewModel().getLatestMessage().getSeverity());
|
||||
assertEquals("The desk cannot store this person.", text(root, "noticeLabel"));
|
||||
@@ -300,9 +297,10 @@ class DeskLoadsTest {
|
||||
*
|
||||
* @param person the model
|
||||
* @param view the loaded view
|
||||
* @param context the container
|
||||
* @param context the adapter
|
||||
* @param models the ViewModel context
|
||||
*/
|
||||
private record Loaded(Person person, LoadedView view, ApplicationContext context) {
|
||||
private record Loaded(Person person, LoadedView view, ViewDependencies context, ViewModelContext models) {
|
||||
|
||||
/**
|
||||
* Returns the scene-graph root.
|
||||
@@ -321,9 +319,16 @@ class DeskLoadsTest {
|
||||
*/
|
||||
private static Loaded load() {
|
||||
Person person = DeskApp.sample();
|
||||
ApplicationContext context = new ApplicationContext(DeskApp.class);
|
||||
LoadedView view = ViewLoader.load(DeskController.class.getResource("Desk.fxml"), person, context);
|
||||
return new Loaded(person, view, context);
|
||||
var context = DeskApp.dependencies(person);
|
||||
var models = new ViewModelContext();
|
||||
var view = ViewLoader.loadWithDependencies(
|
||||
DeskController.class.getResource("Desk.fxml"), person, context, models);
|
||||
return new Loaded(person, view, context, models);
|
||||
}
|
||||
|
||||
private static void fire(Parent root, String text) {
|
||||
root.lookupAll(".button").stream().filter(Button.class::isInstance).map(Button.class::cast)
|
||||
.filter(button -> text.equals(button.getText())).findFirst().orElseThrow().fire();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user