Validate preview sessions against real classpath and module-path fixtures
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>de.neitzel.fxdesigner.fixtures</groupId>
|
||||
<artifactId>preview-fixture-modulepath</artifactId>
|
||||
<version>1</version>
|
||||
</parent>
|
||||
<artifactId>app-modulepath</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>de.neitzel.lib</groupId>
|
||||
<artifactId>fx</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package fixture.components;
|
||||
|
||||
@jakarta.inject.Singleton
|
||||
public class Card extends javafx.scene.layout.VBox implements de.neitzel.fx.view.HasViewModel {
|
||||
public final Greeting greeting;
|
||||
private final javafx.beans.property.ObjectProperty<Object> model =
|
||||
new javafx.beans.property.SimpleObjectProperty<>();
|
||||
@javafx.fxml.FXML private javafx.scene.control.Label captionLabel;
|
||||
@javafx.fxml.FXML private javafx.scene.control.TextField street;
|
||||
public de.neitzel.fx.view.ViewModel received;
|
||||
public boolean injected;
|
||||
|
||||
public Card(Greeting greeting) {
|
||||
this.greeting = greeting;
|
||||
}
|
||||
|
||||
@javafx.fxml.FXML
|
||||
public void initialize() {
|
||||
injected = true;
|
||||
captionLabel.setText(greeting.prefix);
|
||||
}
|
||||
|
||||
public String getCaption() {
|
||||
return captionLabel.getText();
|
||||
}
|
||||
|
||||
public void setCaption(String value) {
|
||||
if (!injected) throw new IllegalStateException("Caption applied before injection");
|
||||
captionLabel.setText(value);
|
||||
}
|
||||
|
||||
public javafx.beans.property.ObjectProperty<Object> modelProperty() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object getModel() {
|
||||
return model.get();
|
||||
}
|
||||
|
||||
public void setModel(Object value) {
|
||||
model.set(value);
|
||||
}
|
||||
|
||||
public void setViewModel(de.neitzel.fx.view.ViewModel vm) {
|
||||
received = vm;
|
||||
}
|
||||
|
||||
public javafx.scene.control.TextField street() {
|
||||
return street;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package fixture.components;
|
||||
|
||||
@jakarta.inject.Singleton
|
||||
public class Greeting implements AutoCloseable {
|
||||
public final String identity = java.util.UUID.randomUUID().toString();
|
||||
public String prefix = "sample";
|
||||
public int closes;
|
||||
|
||||
public void close() {
|
||||
closes++;
|
||||
}
|
||||
|
||||
public String text() {
|
||||
return prefix + "-" + identity;
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package fixture.components;
|
||||
|
||||
@jakarta.inject.Singleton
|
||||
@de.neitzel.fx.view.ViewModelClass(PersonViewModel.class)
|
||||
public class PersonController implements de.neitzel.fx.view.HasViewModel {
|
||||
public final Greeting greeting;
|
||||
public de.neitzel.fx.view.ViewModel received;
|
||||
|
||||
public PersonController(Greeting greeting) {
|
||||
this.greeting = greeting;
|
||||
System.setProperty("fixture.controllers", "constructed");
|
||||
}
|
||||
|
||||
public void setViewModel(de.neitzel.fx.view.ViewModel vm) {
|
||||
received = vm;
|
||||
}
|
||||
|
||||
public String greeting() {
|
||||
if (received == null) throw new IllegalStateException("No ViewModel before bindings");
|
||||
return greeting.text();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package fixture.components;
|
||||
|
||||
public class PersonViewModel extends de.neitzel.fx.view.ViewModel {
|
||||
public PersonViewModel(Object model) {
|
||||
super(model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package fixture.model;
|
||||
|
||||
public class Address {
|
||||
private String street = "First Street";
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package fixture.model;
|
||||
|
||||
public class Person {
|
||||
private String name = "Ada";
|
||||
private Address home = new Address();
|
||||
|
||||
public Person() {
|
||||
System.setProperty(
|
||||
"fixture.models",
|
||||
Integer.toString(Integer.parseInt(System.getProperty("fixture.models", "0")) + 1));
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Address getHome() {
|
||||
return home;
|
||||
}
|
||||
|
||||
public void setHome(Address home) {
|
||||
this.home = home;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
module fixture.app {
|
||||
requires fx;
|
||||
requires injection;
|
||||
requires jakarta.inject;
|
||||
requires javafx.controls;
|
||||
requires javafx.fxml;
|
||||
|
||||
exports fixture.model to
|
||||
fixture.preview,
|
||||
fixture.checks;
|
||||
exports fixture.components to
|
||||
fixture.preview,
|
||||
fixture.checks;
|
||||
|
||||
opens fixture.components;
|
||||
opens fixture.model to
|
||||
fx;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?import javafx.scene.layout.VBox?><?import javafx.scene.control.Label?><?import javafx.scene.control.TextField?><?import de.neitzel.fx.view.BindingList?><?import de.neitzel.fx.view.DirectBinding?>
|
||||
<fx:root type="javafx.scene.layout.VBox" xmlns:fx="http://javafx.com/fxml/1"><fx:define><BindingList><DirectBinding control="street" property="text" path="street" direction="both"/></BindingList></fx:define><Label fx:id="captionLabel"/><TextField fx:id="street"/></fx:root>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?import javafx.scene.layout.VBox?><?import javafx.scene.control.Label?><?import javafx.scene.control.TextField?><?import fixture.components.Card?><?import de.neitzel.fx.view.BindingList?><?import de.neitzel.fx.view.DirectBinding?><?import de.neitzel.fx.view.ComputedBinding?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml/1" fx:controller="fixture.components.PersonController" prefWidth="420" prefHeight="240"><fx:define><BindingList><DirectBinding control="name" property="text" path="name" direction="both"/><DirectBinding control="card" property="model" path="home" direction="both"/><DirectBinding control="second" property="model" path="home" direction="both"/><ComputedBinding control="greeting" property="text" method="#greeting"/></BindingList></fx:define><TextField fx:id="name"/><Label fx:id="greeting"/><Card fx:id="card" caption="FXML caption" prefWidth="not-a-number" alignment="CENTER_LEFT"/><Card fx:id="second" caption="Second"/></VBox>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?import javafx.scene.layout.VBox?><?import javafx.scene.control.Label?><?import javafx.scene.control.TextField?><?import fixture.components.Card?><?import de.neitzel.fx.view.BindingList?><?import de.neitzel.fx.view.DirectBinding?><?import de.neitzel.fx.view.ComputedBinding?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml/1" fx:controller="fixture.components.PersonController" prefWidth="420" prefHeight="240"><fx:define><BindingList><DirectBinding control="name" property="text" path="name" direction="both"/><DirectBinding control="card" property="model" path="home" direction="both"/><DirectBinding control="second" property="model" path="home" direction="both"/><ComputedBinding control="greeting" property="text" method="#greeting"/></BindingList></fx:define><TextField fx:id="name"/><Label fx:id="greeting"/><Card fx:id="card" caption="FXML caption" prefWidth="310" alignment="CENTER_LEFT"/><Card fx:id="second" caption="Second"/></VBox>
|
||||
Reference in New Issue
Block a user