Complete JavaFX MVVM examples, bindings and library documentation

This commit is contained in:
2026-11-07 18:36:53 +01:00
parent c76f5b2a28
commit 8062b61ed6
110 changed files with 3808 additions and 220 deletions
@@ -24,8 +24,14 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A child notice is carried onto its parent, with the attribute name prepended to the source.
*/
class CarryChildMessageTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -39,6 +45,9 @@ class CarryChildMessageTest {
}
}
/**
* A street notice on the address appears on the person as address street.
*/
@Test
void aStreetNoticeOnTheAddressAppearsOnThePersonAsAddressStreet() throws Exception {
onFx(() -> {
@@ -64,6 +73,9 @@ class CarryChildMessageTest {
});
}
/**
* A nested street notice reads as person address street.
*/
@Test
void aNestedStreetNoticeReadsAsPersonAddressStreet() throws Exception {
onFx(() -> {
@@ -90,6 +102,9 @@ class CarryChildMessageTest {
});
}
/**
* A bad street is owned by the address and carried as address street.
*/
@Test
void aBadStreetIsOwnedByTheAddressAndCarriedAsAddressStreet() throws Exception {
onFx(() -> {
@@ -120,6 +135,9 @@ class CarryChildMessageTest {
});
}
/**
* A fixed street drops the notice from the address and the person.
*/
@Test
void aFixedStreetDropsTheNoticeFromTheAddressAndThePerson() throws Exception {
onFx(() -> {
@@ -143,6 +161,9 @@ class CarryChildMessageTest {
});
}
/**
* Another bad street updates the carried notice in place.
*/
@Test
void anotherBadStreetUpdatesTheCarriedNoticeInPlace() throws Exception {
onFx(() -> {
@@ -186,6 +207,9 @@ class CarryChildMessageTest {
});
}
/**
* Clearing the address drops the carried notice and a new address brings its own.
*/
@Test
void clearingTheAddressDropsTheCarriedNoticeAndANewAddressBringsItsOwn() throws Exception {
onFx(() -> {
@@ -225,6 +249,9 @@ class CarryChildMessageTest {
});
}
/**
* Fixing the street leaves the persons own notice.
*/
@Test
void fixingTheStreetLeavesThePersonsOwnNotice() throws Exception {
onFx(() -> {
@@ -265,6 +292,9 @@ class CarryChildMessageTest {
});
}
/**
* A fixed nested street drops the notice up the path.
*/
@Test
void aFixedNestedStreetDropsTheNoticeUpThePath() throws Exception {
onFx(() -> {
@@ -293,6 +323,9 @@ class CarryChildMessageTest {
});
}
/**
* A shared address carries the street notice on home and on work.
*/
@Test
void aSharedAddressCarriesTheStreetNoticeOnHomeAndOnWork() throws Exception {
onFx(() -> {
@@ -318,6 +351,11 @@ class CarryChildMessageTest {
});
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -349,8 +387,16 @@ class CarryChildMessageTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -21,8 +21,14 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
/**
* The controller and the view-model class are chosen from the document and then reused.
*/
class ChooseControllerAndViewModelTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -36,6 +42,9 @@ class ChooseControllerAndViewModelTest {
}
}
/**
* Label shows the name recorded when the view model was handed over.
*/
@Test
void labelShowsTheNameRecordedWhenTheViewModelWasHandedOver() throws Exception {
onFx(() -> {
@@ -49,6 +58,9 @@ class ChooseControllerAndViewModelTest {
});
}
/**
* Label shows the greeting injected into the controller.
*/
@Test
void labelShowsTheGreetingInjectedIntoTheController() throws Exception {
onFx(() -> {
@@ -62,6 +74,9 @@ class ChooseControllerAndViewModelTest {
});
}
/**
* Label shows the title from the named view model.
*/
@Test
void labelShowsTheTitleFromTheNamedViewModel() throws Exception {
onFx(() -> {
@@ -81,6 +96,9 @@ class ChooseControllerAndViewModelTest {
});
}
/**
* Label shows the badge from a replacement view model.
*/
@Test
void labelShowsTheBadgeFromAReplacementViewModel() throws Exception {
onFx(() -> {
@@ -100,6 +118,9 @@ class ChooseControllerAndViewModelTest {
});
}
/**
* Component label shows the caption from the named view model.
*/
@Test
void componentLabelShowsTheCaptionFromTheNamedViewModel() throws Exception {
onFx(() -> {
@@ -114,6 +135,9 @@ class ChooseControllerAndViewModelTest {
});
}
/**
* A later view that names a different class fails and leaves the first view.
*/
@Test
void aLaterViewThatNamesADifferentClassFailsAndLeavesTheFirstView() throws Exception {
onFx(() -> {
@@ -134,6 +158,9 @@ class ChooseControllerAndViewModelTest {
});
}
/**
* A later view with no annotation reuses the view model.
*/
@Test
void aLaterViewWithNoAnnotationReusesTheViewModel() throws Exception {
onFx(() -> {
@@ -155,6 +182,11 @@ class ChooseControllerAndViewModelTest {
});
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -186,8 +218,16 @@ class ChooseControllerAndViewModelTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -18,8 +18,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A computed binding writes a controller method result and refreshes it when another property changes.
*/
class ComputeAValueTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -33,6 +39,9 @@ class ComputeAValueTest {
}
}
/**
* Computed binding shows the method result and leaves the model unchanged.
*/
@Test
void computedBindingShowsTheMethodResultAndLeavesTheModelUnchanged() throws Exception {
onFx(() -> {
@@ -49,6 +58,9 @@ class ComputeAValueTest {
});
}
/**
* Typing in another text field updates the computed label.
*/
@Test
void typingInAnotherTextFieldUpdatesTheComputedLabel() throws Exception {
onFx(() -> {
@@ -65,6 +77,9 @@ class ComputeAValueTest {
});
}
/**
* Setting a view model property updates the computed label.
*/
@Test
void settingAViewModelPropertyUpdatesTheComputedLabel() throws Exception {
onFx(() -> {
@@ -82,6 +97,9 @@ class ComputeAValueTest {
});
}
/**
* Changing the computed label does not run the method again.
*/
@Test
void changingTheComputedLabelDoesNotRunTheMethodAgain() throws Exception {
onFx(() -> {
@@ -97,6 +115,11 @@ class ComputeAValueTest {
});
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -128,8 +151,16 @@ class ComputeAValueTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -25,8 +25,14 @@ import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A converter failure keeps the previous value and records one error message.
*/
class ConvertAndRecordFailureTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -40,6 +46,9 @@ class ConvertAndRecordFailureTest {
}
}
/**
* Injected converter prefixes the age text.
*/
@Test
void injectedConverterPrefixesTheAgeText() throws Exception {
onFx(() -> {
@@ -54,6 +63,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Typing a prefixed age updates the model.
*/
@Test
void typingAPrefixedAgeUpdatesTheModel() throws Exception {
onFx(() -> {
@@ -69,6 +81,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Toward view loads when the reverse method is absent.
*/
@Test
void towardViewLoadsWhenTheReverseMethodIsAbsent() throws Exception {
onFx(() -> {
@@ -85,6 +100,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Toward view converter follows a later age.
*/
@Test
void towardViewConverterFollowsALaterAge() throws Exception {
onFx(() -> {
@@ -103,6 +121,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Toward model converts typed text without following the attribute.
*/
@Test
void towardModelConvertsTypedTextWithoutFollowingTheAttribute() throws Exception {
onFx(() -> {
@@ -123,6 +144,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Bad age text keeps the previous int and one error message.
*/
@Test
void badAgeTextKeepsThePreviousIntAndOneErrorMessage() throws Exception {
onFx(() -> {
@@ -146,6 +170,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Another bad age updates the same message.
*/
@Test
void anotherBadAgeUpdatesTheSameMessage() throws Exception {
onFx(() -> {
@@ -168,6 +195,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* A valid age removes the failure message.
*/
@Test
void aValidAgeRemovesTheFailureMessage() throws Exception {
onFx(() -> {
@@ -187,6 +217,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Developer info stays latest and is not logged.
*/
@Test
void developerInfoStaysLatestAndIsNotLogged() throws Exception {
onFx(() -> {
@@ -212,6 +245,9 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Error and fatal messages are written to the log.
*/
@Test
void errorAndFatalMessagesAreWrittenToTheLog() throws Exception {
onFx(() -> {
@@ -240,6 +276,11 @@ class ConvertAndRecordFailureTest {
});
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -271,6 +312,12 @@ class ConvertAndRecordFailureTest {
}
}
/**
* Runs one check and returns what it wrote to standard error.
*
* @param action the check
* @return the text written to standard error
*/
private static String captureErr(FxAction action) throws Exception {
PrintStream previous = System.err;
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@@ -285,8 +332,16 @@ class ConvertAndRecordFailureTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -23,8 +23,14 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A component edits one model instance, and a nested component edits the next.
*/
class EditAddressInAComponentTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -38,6 +44,9 @@ class EditAddressInAComponentTest {
}
}
/**
* Editing the street updates that address.
*/
@Test
void editingTheStreetUpdatesThatAddress() throws Exception {
onFx(() -> {
@@ -58,6 +67,9 @@ class EditAddressInAComponentTest {
});
}
/**
* Null address leaves the model unset and keeps the street text.
*/
@Test
void nullAddressLeavesTheModelUnsetAndKeepsTheStreetText() throws Exception {
onFx(() -> {
@@ -75,6 +87,9 @@ class EditAddressInAComponentTest {
});
}
/**
* Street label shows the injected prefix.
*/
@Test
void streetLabelShowsTheInjectedPrefix() throws Exception {
onFx(() -> {
@@ -90,6 +105,9 @@ class EditAddressInAComponentTest {
});
}
/**
* Component receives the address view model before its bindings run.
*/
@Test
void componentReceivesTheAddressViewModelBeforeItsBindingsRun() throws Exception {
onFx(() -> {
@@ -108,6 +126,9 @@ class EditAddressInAComponentTest {
});
}
/**
* Nested component shows the inner street.
*/
@Test
void nestedComponentShowsTheInnerStreet() throws Exception {
onFx(() -> {
@@ -124,6 +145,11 @@ class EditAddressInAComponentTest {
});
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -155,8 +181,16 @@ class EditAddressInAComponentTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -0,0 +1,95 @@
package de.neitzel.fx.view;
import de.neitzel.fx.view.component.ActionRow;
import de.neitzel.fx.view.fixture.Host;
import de.neitzel.fx.view.fixture.Visit;
import de.neitzel.injection.ApplicationContext;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* A control after the Column fields keeps its own width, and the header uses the Row's spacing.
*/
class KeepAControlAfterTheColumnsTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
FxThread.start();
}
/**
* The remove button stays its own size and the row is wide enough to show it.
*/
@Test
void aControlAfterTheFieldsKeepsItsOwnWidth() throws Exception {
FxThread.onFx(() -> {
Table table = table();
HBox header = header(table);
assertEquals(2, header.getChildren().size());
assertEquals(6, header.getSpacing());
assertEquals(306, header.getPrefWidth());
ActionRow row = row(table);
Region street = (Region) row.getChildren().get(0);
Region city = (Region) row.getChildren().get(1);
Button remove = (Button) row.lookup("#removeButton");
assertEquals(150, street.getPrefWidth());
assertEquals(150, city.getPrefWidth());
assertEquals(Region.USE_COMPUTED_SIZE, remove.getMinWidth());
assertEquals(Region.USE_COMPUTED_SIZE, remove.getPrefWidth());
assertEquals(Region.USE_COMPUTED_SIZE, remove.getMaxWidth());
assertEquals("Remove", remove.getText());
assertEquals(300 + 12 + remove.prefWidth(-1), row.getPrefWidth());
});
}
/**
* Loads the visits table whose row has a button after the fields.
*
* @return the table
*/
private static Table table() {
URL fxml = KeepAControlAfterTheColumnsTest.class.getResource("show-visits-action.fxml");
assertNotNull(fxml);
Host host = new Host();
host.setVisits(new ArrayList<>(List.of(new Visit("Main", "Berlin"))));
LoadedView loaded = ViewLoader.load(fxml, host, new ApplicationContext("de.neitzel.fx.view.component"));
return (Table) loaded.getRoot().lookup("#visitsTable");
}
/**
* Returns the header row.
*
* @param table the table
* @return the header
*/
private static HBox header(Table table) {
ScrollPane headerScroll = (ScrollPane) table.lookup(".table-header-scroll");
return (HBox) headerScroll.getContent();
}
/**
* Returns the first row.
*
* @param table the table
* @return the row
*/
private static ActionRow row(Table table) {
ScrollPane scroll = (ScrollPane) table.lookup("." + Table.SCROLL_STYLE);
return (ActionRow) ((VBox) scroll.getContent()).getChildren().get(0);
}
}
@@ -0,0 +1,155 @@
package de.neitzel.fx.view;
import de.neitzel.fx.view.fixture.Host;
import de.neitzel.fx.view.fixture.Visit;
import de.neitzel.injection.ApplicationContext;
import javafx.scene.control.ScrollPane;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.text.Text;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* A Column opens at its starting width. A Column without one takes an equal share.
*/
class OpenAtAGivenWidthTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
FxThread.start();
}
/**
* Named widths are kept, including after a drag and a change of the Table's width.
*/
@Test
void aColumnOpensAtItsWidth() throws Exception {
FxThread.onFx(() -> {
Table table = table("show-visits-widths.fxml");
HBox header = header(table);
Region street = (Region) header.getChildren().get(0);
Region city = (Region) header.getChildren().get(1);
assertEquals(220, street.getPrefWidth());
assertEquals(80, city.getPrefWidth());
assertEquals(220, field(table, 0).getPrefWidth());
assertEquals(80, field(table, 1).getPrefWidth());
drag(street.lookup("." + Table.RESIZE_STYLE), 0, 40);
assertEquals(260, street.getPrefWidth());
assertEquals(80, city.getPrefWidth());
table.setPrefWidth(900);
assertEquals(260, street.getPrefWidth());
assertEquals(80, city.getPrefWidth());
});
}
/**
* A Column with no width takes what the named widths leave of the Table.
*/
@Test
void aColumnWithoutAWidthTakesTheRemainingShare() throws Exception {
FxThread.onFx(() -> {
HBox header = header(table("show-visits-one-width.fxml"));
assertEquals(100, ((Region) header.getChildren().get(0)).getPrefWidth());
assertEquals(200, ((Region) header.getChildren().get(1)).getPrefWidth());
});
}
/**
* A starting width narrower than the header text opens wide enough to show that text.
*/
@Test
void aNarrowWidthOpensAtTheHeaderText() throws Exception {
FxThread.onFx(() -> {
HBox header = header(table("show-visits-narrow.fxml"));
assertEquals(280, ((Region) header.getChildren().get(0)).getPrefWidth());
Text text = new Text("City");
double headerText = Math.ceil(text.getLayoutBounds().getWidth()) + 8;
assertEquals(headerText, ((Region) header.getChildren().get(1)).getPrefWidth());
});
}
/**
* A width that is not positive fails the load.
*/
@Test
void aWidthThatIsNotPositiveFailsToLoad() throws Exception {
FxThread.onFx(() -> assertThrows(IllegalArgumentException.class, () -> table("show-visits-bad-width.fxml")));
}
/**
* Loads a visits table.
*
* @param name the document name
* @return the table
*/
private static Table table(String name) {
URL fxml = OpenAtAGivenWidthTest.class.getResource(name);
assertNotNull(fxml);
Host host = new Host();
host.setVisits(new ArrayList<>(List.of(new Visit("Main", "Berlin"))));
LoadedView loaded = ViewLoader.load(fxml, host, new ApplicationContext("de.neitzel.fx.view.component"));
return (Table) loaded.getRoot().lookup("#visitsTable");
}
/**
* Returns the header row.
*
* @param table the table
* @return the header
*/
private static HBox header(Table table) {
ScrollPane headerScroll = (ScrollPane) table.lookup(".table-header-scroll");
return (HBox) headerScroll.getContent();
}
/**
* Returns one field of the first row.
*
* @param table the table
* @param index the field index
* @return the field
*/
private static Region field(Table table, int index) {
ScrollPane scroll = (ScrollPane) table.lookup("." + Table.SCROLL_STYLE);
javafx.scene.layout.VBox body = (javafx.scene.layout.VBox) scroll.getContent();
return (Region) ((javafx.scene.Parent) body.getChildren().get(0)).getChildrenUnmodifiable().get(index);
}
/**
* Drags a resize handle from one screen x to another.
*
* @param handle the handle
* @param from the start screen x
* @param to the end screen x
*/
private static void drag(javafx.scene.Node handle, double from, double to) {
handle.fireEvent(mouse(MouseEvent.MOUSE_PRESSED, from));
handle.fireEvent(mouse(MouseEvent.MOUSE_DRAGGED, to));
}
/**
* Returns a primary mouse event.
*
* @param type the event type
* @param screen the screen x
* @return the event
*/
private static MouseEvent mouse(javafx.event.EventType<MouseEvent> type, double screen) {
return new MouseEvent(type, screen, 0, screen, 0, MouseButton.PRIMARY, 1,
false, false, false, false, true, false, false, false, false, false, null);
}
}
@@ -31,8 +31,14 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A path steps through a nested view model, and a null step leaves the binding unapplied.
*/
class ReachNestedAttributeTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -46,6 +52,9 @@ class ReachNestedAttributeTest {
}
}
/**
* Complex attribute holds the view model for the nested address.
*/
@Test
void complexAttributeHoldsTheViewModelForTheNestedAddress() throws Exception {
onFx(() -> {
@@ -61,6 +70,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Both ways text field reads and writes the nested street.
*/
@Test
void bothWaysTextFieldReadsAndWritesTheNestedStreet() throws Exception {
onFx(() -> {
@@ -78,6 +90,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Toward view label follows the nested street and does not write.
*/
@Test
void towardViewLabelFollowsTheNestedStreetAndDoesNotWrite() throws Exception {
onFx(() -> {
@@ -99,6 +114,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Both ways binding on a complex path yields the model instance.
*/
@Test
void bothWaysBindingOnAComplexPathYieldsTheModelInstance() throws Exception {
onFx(() -> {
@@ -117,6 +135,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Filling a missing address stores the view model and writes the model.
*/
@Test
void fillingAMissingAddressStoresTheViewModelAndWritesTheModel() throws Exception {
onFx(() -> {
@@ -137,6 +158,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Missing address leaves the control and the model unchanged.
*/
@Test
void missingAddressLeavesTheControlAndTheModelUnchanged() throws Exception {
onFx(() -> {
@@ -151,6 +175,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Null complex attribute holds null.
*/
@Test
void nullComplexAttributeHoldsNull() throws Exception {
onFx(() -> {
@@ -163,6 +190,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Attributes that reach the same address share its view model.
*/
@Test
void attributesThatReachTheSameAddressShareItsViewModel() throws Exception {
onFx(() -> {
@@ -183,6 +213,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Equal addresses keep separate view models.
*/
@Test
void equalAddressesKeepSeparateViewModels() throws Exception {
onFx(() -> {
@@ -206,6 +239,9 @@ class ReachNestedAttributeTest {
});
}
/**
* A person who is their own friend reuses the same view model.
*/
@Test
void aPersonWhoIsTheirOwnFriendReusesTheSameViewModel() throws Exception {
onFx(() -> {
@@ -219,6 +255,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Two people who point at each other reuse the view models already built.
*/
@Test
void twoPeopleWhoPointAtEachOtherReuseTheViewModelsAlreadyBuilt() throws Exception {
onFx(() -> {
@@ -236,6 +275,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Enums booleans and date values stay simple values.
*/
@Test
void enumsBooleansAndDateValuesStaySimpleValues() throws Exception {
onFx(() -> {
@@ -260,6 +302,9 @@ class ReachNestedAttributeTest {
});
}
/**
* A collection stays the collection rather than a view model.
*/
@Test
void aCollectionStaysTheCollectionRatherThanAViewModel() throws Exception {
onFx(() -> {
@@ -281,6 +326,9 @@ class ReachNestedAttributeTest {
});
}
/**
* Two loads of the same person share the view model.
*/
@Test
void twoLoadsOfTheSamePersonShareTheViewModel() throws Exception {
onFx(() -> {
@@ -299,6 +347,11 @@ class ReachNestedAttributeTest {
});
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -330,8 +383,16 @@ class ReachNestedAttributeTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -28,8 +28,14 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A repeat places one component in a pane for each model instance.
*/
class RepeatAddressComponentsTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -43,6 +49,9 @@ class RepeatAddressComponentsTest {
}
}
/**
* Addresses are the address instances on the shared list.
*/
@Test
void addressesAreTheAddressInstancesOnTheSharedList() throws Exception {
onFx(() -> {
@@ -67,6 +76,9 @@ class RepeatAddressComponentsTest {
});
}
/**
* Each address appears as its own form in list order.
*/
@Test
void eachAddressAppearsAsItsOwnFormInListOrder() throws Exception {
onFx(() -> {
@@ -96,6 +108,9 @@ class RepeatAddressComponentsTest {
});
}
/**
* Adding and removing an address updates the pane and the entity.
*/
@Test
void addingAndRemovingAnAddressUpdatesThePaneAndTheEntity() throws Exception {
onFx(() -> {
@@ -131,6 +146,9 @@ class RepeatAddressComponentsTest {
});
}
/**
* Selection is a separate attribute and the forms do not store it.
*/
@Test
void selectionIsASeparateAttributeAndTheFormsDoNotStoreIt() throws Exception {
onFx(() -> {
@@ -161,6 +179,9 @@ class RepeatAddressComponentsTest {
});
}
/**
* A second address form in the same document is another component.
*/
@Test
void aSecondAddressFormInTheSameDocumentIsAnotherComponent() throws Exception {
onFx(() -> {
@@ -189,10 +210,21 @@ class RepeatAddressComponentsTest {
});
}
/**
* Returns the street of each address, in list order.
*
* @param addresses the addresses
* @return the streets, in list order
*/
private static List<String> streets(List<Address> addresses) {
return addresses.stream().map(Address::getStreet).toList();
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -224,8 +256,16 @@ class RepeatAddressComponentsTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -20,8 +20,14 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A list of simple values is one shared list on the control and the model.
*/
class ShowAListOfSimpleValuesTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -35,6 +41,9 @@ class ShowAListOfSimpleValuesTest {
}
}
/**
* List view and person share the tag list.
*/
@Test
void listViewAndPersonShareTheTagList() throws Exception {
onFx(() -> {
@@ -61,6 +70,11 @@ class ShowAListOfSimpleValuesTest {
});
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -92,8 +106,16 @@ class ShowAListOfSimpleValuesTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -21,8 +21,14 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A direct binding shows one attribute and writes it when the direction says so.
*/
class ShowAndEditOneAttributeTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
CountDownLatch started = new CountDownLatch(1);
@@ -36,6 +42,9 @@ class ShowAndEditOneAttributeTest {
}
}
/**
* Both ways text field shows the name and typing updates the model.
*/
@Test
void bothWaysTextFieldShowsTheNameAndTypingUpdatesTheModel() throws Exception {
onFx(() -> {
@@ -51,6 +60,9 @@ class ShowAndEditOneAttributeTest {
});
}
/**
* Toward view label shows the name follows the field and does not write the model.
*/
@Test
void towardViewLabelShowsTheNameFollowsTheFieldAndDoesNotWriteTheModel() throws Exception {
onFx(() -> {
@@ -70,6 +82,9 @@ class ShowAndEditOneAttributeTest {
});
}
/**
* Entity setter after load leaves the text control unchanged.
*/
@Test
void entitySetterAfterLoadLeavesTheTextControlUnchanged() throws Exception {
onFx(() -> {
@@ -84,6 +99,9 @@ class ShowAndEditOneAttributeTest {
});
}
/**
* Binding a read only getter fails the load.
*/
@Test
void bindingAReadOnlyGetterFailsTheLoad() throws Exception {
onFx(() -> {
@@ -97,6 +115,9 @@ class ShowAndEditOneAttributeTest {
});
}
/**
* Binding a method declared on object fails the load.
*/
@Test
void bindingAMethodDeclaredOnObjectFailsTheLoad() throws Exception {
onFx(() -> {
@@ -110,6 +131,9 @@ class ShowAndEditOneAttributeTest {
});
}
/**
* Null integer attribute uses an integer property.
*/
@Test
void nullIntegerAttributeUsesAnIntegerProperty() throws Exception {
onFx(() -> {
@@ -122,6 +146,11 @@ class ShowAndEditOneAttributeTest {
});
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -153,8 +182,16 @@ class ShowAndEditOneAttributeTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -29,8 +29,14 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.fail;
/**
* A message stays on the view model until the developer asks for a dialog.
*/
class ShowMessagesWhenAskedTest {
/**
* Starts the JavaFX toolkit once for this class.
*/
@BeforeAll
static void startJavaFx() throws InterruptedException {
Platform.setImplicitExit(false);
@@ -45,6 +51,9 @@ class ShowMessagesWhenAskedTest {
}
}
/**
* Adding a message does not open a popup or fill a status bar.
*/
@Test
void addingAMessageDoesNotOpenAPopupOrFillAStatusBar() throws Exception {
onFx(() -> {
@@ -64,6 +73,9 @@ class ShowMessagesWhenAskedTest {
});
}
/**
* Direct binding shows the latest message text.
*/
@Test
void directBindingShowsTheLatestMessageText() throws Exception {
onFx(() -> {
@@ -82,6 +94,9 @@ class ShowMessagesWhenAskedTest {
});
}
/**
* Opted in helper shows a new message in a popup.
*/
@Test
void optedInHelperShowsANewMessageInAPopup() throws Exception {
onFx(() -> {
@@ -104,6 +119,9 @@ class ShowMessagesWhenAskedTest {
});
}
/**
* Updating a binding failure does not open another popup.
*/
@Test
void updatingABindingFailureDoesNotOpenAnotherPopup() throws Exception {
onFx(() -> {
@@ -140,10 +158,22 @@ class ShowMessagesWhenAskedTest {
});
}
/**
* Returns the windows open before a check.
*
* @return the windows that are open
*/
private static Set<Window> snapshotWindows() {
return new HashSet<>(Window.getWindows());
}
/**
* Returns the window opened during a check whose content is the given text.
*
* @param text the text
* @param alreadyOpen the windows open before the check
* @return the window, or {@code null} when none shows the text
*/
private static Window windowShowing(String text, Set<Window> alreadyOpen) {
for (Window window : Window.getWindows()) {
if (!alreadyOpen.contains(window) && windowShows(window, text)) {
@@ -153,6 +183,13 @@ class ShowMessagesWhenAskedTest {
return null;
}
/**
* Returns whether a window's scene shows the given text.
*
* @param window the window
* @param text the text
* @return {@code true} when the window shows the text
*/
private static boolean windowShows(Window window, String text) {
if (window.getScene() == null || !(window.getScene().getRoot() instanceof Parent root)) {
return false;
@@ -168,10 +205,23 @@ class ShowMessagesWhenAskedTest {
return false;
}
/**
* Returns whether a labeled node shows the given text.
*
* @param node the node
* @param text the text
* @return {@code true} when the node shows the text
*/
private static boolean nodeShows(Node node, String text) {
return node instanceof Labeled labeled && text.equals(labeled.getText());
}
/**
* Returns the windows that were not open in the earlier snapshot.
*
* @param alreadyOpen the windows open before the check
* @return the windows opened since the snapshot
*/
private static List<Window> windowsOpenedSince(Set<Window> alreadyOpen) {
List<Window> opened = new ArrayList<>();
for (Window window : Window.getWindows()) {
@@ -182,6 +232,11 @@ class ShowMessagesWhenAskedTest {
return opened;
}
/**
* Closes the windows opened during a check.
*
* @param alreadyOpen the windows open before the check
*/
private static void closeWindowsOpenedSince(Set<Window> alreadyOpen) {
List<Window> open = new ArrayList<>(Window.getWindows());
for (Window window : open) {
@@ -191,6 +246,12 @@ class ShowMessagesWhenAskedTest {
}
}
/**
* Fails when the given text is visible in the scene or in a dialog.
*
* @param root the loaded scene
* @param text the text
*/
private static void assertMessageIsNotShown(Parent root, String text) {
for (Node node : root.lookupAll("*")) {
if (node instanceof Labeled labeled) {
@@ -202,6 +263,11 @@ class ShowMessagesWhenAskedTest {
}
}
/**
* Runs one check on the JavaFX application thread.
*
* @param action the check
*/
private static void onFx(FxAction action) throws Exception {
if (Platform.isFxApplicationThread()) {
action.run();
@@ -233,8 +299,16 @@ class ShowMessagesWhenAskedTest {
}
}
/**
* One check that runs on the JavaFX application thread.
*/
@FunctionalInterface
private interface FxAction {
/**
* Runs the check.
*
* @throws Exception when the check fails
*/
void run() throws Exception;
}
}
@@ -5,11 +5,14 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
/**
* Replacement for the library ViewModel. It exposes a badge property by name and does not
* Replacement for the library viewmodel. it exposes a badge property by name and does not
* extend {@link de.neitzel.fx.view.ViewModel}.
*/
public class BadgeViewModel {
/**
* The badge text this view model adds beside the model attributes.
*/
private final StringProperty badge = new SimpleStringProperty();
/**
@@ -23,7 +26,7 @@ public class BadgeViewModel {
}
/**
* Returns the badge property a Binding element addresses by name.
* Returns the badge property a binding element addresses by name.
*
* @return the badge property
*/
@@ -13,10 +13,13 @@ import javafx.scene.layout.VBox;
@ViewModelClass(StreetTitleViewModel.class)
public class CaptionAddressForm extends VBox {
/**
* The model this component edits. A parent view or a repeat sets it once.
*/
private final ObjectProperty<Object> model = new SimpleObjectProperty<>(this, "model");
/**
* Returns the model property a parent View sets with a Direct binding.
* Returns the model property a parent view sets with a direct binding.
*
* @return the model property
*/
@@ -9,6 +9,9 @@ import jakarta.inject.Singleton;
@Singleton
public class DeskController {
/**
* The service the greeting method reads.
*/
private final DeskGreeting greeting;
/**
@@ -3,7 +3,7 @@ package de.neitzel.fx.view.chosen;
import jakarta.inject.Singleton;
/**
* Service whose text a Controller must show, so a test can see that injection ran.
* Service whose text a controller must show, so a test can see that injection ran.
*/
@Singleton
public class DeskGreeting {
@@ -10,12 +10,15 @@ import jakarta.inject.Singleton;
@Singleton
public class HandedNameController implements HasViewModel {
/**
* The name handed to this controller before the bindings run.
*/
private String handed;
/**
* Records a label value that is available only from the handed ViewModel.
*
* @param viewModel the ViewModel for this View
* @param viewModel the view model
*/
@Override
public void setViewModel(ViewModel viewModel) {
@@ -10,6 +10,9 @@ import javafx.beans.property.StringProperty;
*/
public class StreetTitleViewModel extends ViewModel {
/**
* The caption this view model adds for the street.
*/
private final StringProperty caption = new SimpleStringProperty();
/**
@@ -24,7 +27,7 @@ public class StreetTitleViewModel extends ViewModel {
}
/**
* Returns the caption property a Binding element addresses by name.
* Returns the caption property a binding element addresses by name.
*
* @return the caption property
*/
@@ -4,7 +4,7 @@ import de.neitzel.fx.view.ViewModelClass;
import jakarta.inject.Singleton;
/**
* Controller that names {@link TitledViewModel} for its View.
* Controller that names {@link titledviewmodel} for its view.
*/
@Singleton
@ViewModelClass(TitledViewModel.class)
@@ -10,6 +10,9 @@ import javafx.beans.property.StringProperty;
*/
public class TitledViewModel extends ViewModel {
/**
* The title this view model adds beside the model attributes.
*/
private final StringProperty title = new SimpleStringProperty();
/**
@@ -24,7 +27,7 @@ public class TitledViewModel extends ViewModel {
}
/**
* Returns the title property a Binding element addresses by name.
* Returns the title property a binding element addresses by name.
*
* @return the title property
*/
@@ -0,0 +1,53 @@
package de.neitzel.fx.view.component;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.layout.HBox;
/**
* A Row with street and city fields and a control after them.
*/
@Singleton
public class ActionRow extends HBox {
/**
* The visit this row shows.
*/
private final ObjectProperty<Object> model = new SimpleObjectProperty<>(this, "model");
/**
* Creates a row.
*/
@Inject
public ActionRow() {
}
/**
* Returns the model property.
*
* @return the model property
*/
public ObjectProperty<Object> modelProperty() {
return model;
}
/**
* Returns the visit this row shows.
*
* @return the visit, or {@code null}
*/
public Object getModel() {
return model.get();
}
/**
* Sets the visit this row shows.
*
* @param model the visit
*/
public void setModel(Object model) {
this.model.set(model);
}
}
@@ -14,21 +14,39 @@ import javafx.scene.layout.VBox;
/**
* Component that shows one address.
* <p>
* The container injects the caption service. The street label shows that service's prefix.
* The container injects the caption service. the street label shows that service's prefix.
*/
@Singleton
public class AddressForm extends VBox implements HasViewModel {
/**
* The service that supplies the street caption.
*/
private final StreetCaption captions;
/**
* The model this component edits. A parent view or a repeat sets it once.
*/
private final ObjectProperty<Object> model = new SimpleObjectProperty<>(this, "model");
/**
* The label filled by the component's own binding.
*/
@FXML
private Label streetLabel;
/**
* The street field filled by the component's own binding.
*/
@FXML
private TextField streetField;
/**
* The view model handed over before the component's bindings run.
*/
private ViewModel receivedViewModel;
/**
* The street text visible when the view model is handed over.
*/
private String streetTextAtHandOff;
/**
@@ -50,7 +68,7 @@ public class AddressForm extends VBox implements HasViewModel {
}
/**
* Returns the model property a parent View sets with a Direct binding.
* Returns the model property a parent view sets with a direct binding.
*
* @return the model property
*/
@@ -79,7 +97,7 @@ public class AddressForm extends VBox implements HasViewModel {
/**
* Records the ViewModel handed to this component, and the street text at that moment.
*
* @param viewModel the ViewModel selected for the address
* @param viewModel the view model
*/
@Override
public void setViewModel(ViewModel viewModel) {
@@ -7,6 +7,9 @@ import de.neitzel.fx.view.fixture.Address;
*/
public class Envelope {
/**
* The address this model holds.
*/
private Address address;
/**
@@ -11,10 +11,13 @@ import javafx.scene.layout.VBox;
@Singleton
public class EnvelopeForm extends VBox {
/**
* The model this component edits. A parent view or a repeat sets it once.
*/
private final ObjectProperty<Object> model = new SimpleObjectProperty<>(this, "model");
/**
* Returns the model property a parent View sets with a Direct binding.
* Returns the model property a parent view sets with a direct binding.
*
* @return the model property
*/
@@ -5,6 +5,9 @@ package de.neitzel.fx.view.component;
*/
public class Letter {
/**
* The envelope this letter holds.
*/
private Envelope envelope;
/**
@@ -5,11 +5,14 @@ import javafx.fxml.FXML;
import javafx.scene.control.TextField;
/**
* Controller that derives a label from the name field and does not write the Model.
* Controller that derives a label from the name field and does not write the model.
*/
@Singleton
public class WorkingAgeController {
/**
* The name field a computed binding reads.
*/
@FXML
private TextField nameField;
@@ -10,6 +10,9 @@ import java.util.Objects;
*/
public class Address {
/**
* The street.
*/
private String street;
/**
@@ -39,6 +42,12 @@ public class Address {
this.street = street;
}
/**
* Compares addresses by street.
*
* @param other the other address
* @return {@code true} when the streets are equal
*/
@Override
public boolean equals(Object other) {
if (other instanceof Address address) {
@@ -47,6 +56,11 @@ public class Address {
return false;
}
/**
* Returns a hash code for the street.
*
* @return the hash code
*/
@Override
public int hashCode() {
return Objects.hashCode(street);
@@ -5,6 +5,9 @@ package de.neitzel.fx.view.fixture;
*/
public class Household {
/**
* The person in this household.
*/
private Person person;
/**
@@ -9,6 +9,9 @@ import javafx.scene.layout.Pane;
*/
public class ObjectHolder extends Pane {
/**
* The value a direct binding writes.
*/
private final ObjectProperty<Object> value = new SimpleObjectProperty<>(this, "value");
/**
@@ -10,19 +10,61 @@ import java.util.List;
*/
public class Person {
/**
* The name.
*/
private String name;
/**
* The age in years, or {@code null} when it has not been set.
*/
private Integer age;
/**
* Whether the person is active.
*/
private boolean active;
/**
* The address this model holds.
*/
private Address address;
/**
* The home address.
*/
private Address home;
/**
* The work address.
*/
private Address work;
/**
* Another person, used to follow a cycle.
*/
private Person friend;
/**
* The person's role.
*/
private Role role;
/**
* The birth date.
*/
private LocalDate born;
/**
* The last update.
*/
private Date updated;
/**
* The hire date.
*/
private Calendar hired;
/**
* The tags. after a view loads, this is the list the control watches.
*/
private List<String> tags;
/**
* The addresses. after a view loads, this is the list a repeat watches.
*/
private List<Address> addresses;
/**
* The selected address, or {@code null} when none is selected.
*/
private Address selectedAddress;
/**
@@ -62,7 +104,7 @@ public class Person {
}
/**
* Returns the age. The value may be null.
* Returns the age. the value may be null.
*
* @return the age
*/
@@ -242,7 +284,7 @@ public class Person {
}
/**
* Returns the tags. The value may be null.
* Returns the tags. the value may be null.
*
* @return the tags
*/
@@ -260,7 +302,7 @@ public class Person {
}
/**
* Returns the addresses. The value may be null.
* Returns the addresses. the value may be null.
*
* @return the addresses
*/
@@ -278,7 +320,7 @@ public class Person {
}
/**
* Returns the selected address. Null means nothing is selected.
* Returns the selected address. null means nothing is selected.
*
* @return the selected address, or {@code null}
*/
@@ -10,6 +10,9 @@ import jakarta.inject.Singleton;
@Singleton
public class PrefixedAgeConverter implements Converter {
/**
* The unit written in front of an age.
*/
private final AgeUnit ageUnit;
/**
@@ -4,6 +4,13 @@ package de.neitzel.fx.view.fixture;
* A simple enum Attribute used by view-loading tests.
*/
public enum Role {
/**
* An ordinary member.
*/
MEMBER,
/**
* An administrator.
*/
ADMIN
}
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import de.neitzel.fx.view.BindingList?>
<?import de.neitzel.fx.view.DirectBinding?>
<fx:root type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml" spacing="6">
<fx:define>
<BindingList>
<DirectBinding control="streetField" property="text" path="street" direction="both"/>
<DirectBinding control="cityField" property="text" path="city" direction="both"/>
</BindingList>
</fx:define>
<TextField fx:id="streetField" id="streetField"/>
<TextField fx:id="cityField" id="cityField"/>
<Button fx:id="removeButton" id="removeButton" text="Remove"/>
</fx:root>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import de.neitzel.fx.view.Column?>
<?import de.neitzel.fx.view.Table?>
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
<Table fx:id="visitsTable" id="visitsTable" collection="visits"
row="de.neitzel.fx.view.component.ActionRow" prefWidth="300">
<Column header="Street" attribute="street"/>
<Column header="City" attribute="city"/>
</Table>
</VBox>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import de.neitzel.fx.view.Column?>
<?import de.neitzel.fx.view.Table?>
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
<Table fx:id="visitsTable" id="visitsTable" collection="visits"
row="de.neitzel.fx.view.component.VisitRow" prefWidth="300">
<Column header="Street" attribute="street" width="100"/>
<Column header="City" attribute="city" width="0"/>
</Table>
</VBox>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import de.neitzel.fx.view.Column?>
<?import de.neitzel.fx.view.Table?>
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
<Table fx:id="visitsTable" id="visitsTable" collection="visits"
row="de.neitzel.fx.view.component.VisitRow" prefWidth="300">
<Column header="Street" attribute="street" width="280"/>
<Column header="City" attribute="city" width="1"/>
</Table>
</VBox>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import de.neitzel.fx.view.Column?>
<?import de.neitzel.fx.view.Table?>
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
<Table fx:id="visitsTable" id="visitsTable" collection="visits"
row="de.neitzel.fx.view.component.VisitRow" prefWidth="300">
<Column header="Street" attribute="street" width="100"/>
<Column header="City" attribute="city"/>
</Table>
</VBox>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import de.neitzel.fx.view.Column?>
<?import de.neitzel.fx.view.Table?>
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
<Table fx:id="visitsTable" id="visitsTable" collection="visits"
row="de.neitzel.fx.view.component.VisitRow" prefWidth="300">
<Column header="Street" attribute="street" width="220"/>
<Column header="City" attribute="city" width="80"/>
</Table>
</VBox>