Edit and exercise Archiver CommandBindings in the IntelliJ designer
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
package fixture.components;
|
||||
|
||||
@jakarta.inject.Singleton
|
||||
@de.neitzel.fx.view.ViewModelClass(CommandCard.Model.class)
|
||||
public class CommandCard extends javafx.scene.layout.VBox {
|
||||
private final javafx.beans.property.ObjectProperty<fixture.model.Address> model =
|
||||
new javafx.beans.property.SimpleObjectProperty<>();
|
||||
|
||||
public javafx.beans.property.ObjectProperty<fixture.model.Address> modelProperty() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public static class Model extends de.neitzel.fx.view.ViewModel {
|
||||
private final de.neitzel.fx.view.Command run;
|
||||
|
||||
public Model(fixture.model.Address model) {
|
||||
super(model);
|
||||
var enabled = new javafx.beans.property.SimpleBooleanProperty(true);
|
||||
run =
|
||||
new de.neitzel.fx.view.Command(
|
||||
enabled,
|
||||
() -> {
|
||||
model.setStreet("Command executed");
|
||||
enabled.set(false);
|
||||
});
|
||||
}
|
||||
|
||||
public de.neitzel.fx.view.Command getRun() {
|
||||
return run;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -15,6 +15,7 @@ public class PersonController implements de.neitzel.fx.view.HasViewModel {
|
||||
return "Uncertain";
|
||||
}
|
||||
|
||||
public static PersonController boundController;
|
||||
public final Greeting greeting;
|
||||
public de.neitzel.fx.view.ViewModel received;
|
||||
|
||||
@@ -25,6 +26,7 @@ public class PersonController implements de.neitzel.fx.view.HasViewModel {
|
||||
|
||||
public void setViewModel(de.neitzel.fx.view.ViewModel vm) {
|
||||
received = vm;
|
||||
boundController = this;
|
||||
}
|
||||
|
||||
public void action() {
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?neitzel-model fixture.model.Address?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import de.neitzel.fx.view.BindingList?>
|
||||
<?import de.neitzel.fx.view.CommandBinding?>
|
||||
<fx:root xmlns:fx="http://javafx.com/fxml/1" type="javafx.scene.layout.VBox">
|
||||
<fx:define><BindingList><CommandBinding control="run" path="run"/></BindingList></fx:define>
|
||||
<Button fx:id="run" text="Run"/>
|
||||
</fx:root>
|
||||
Reference in New Issue
Block a user