an Application Framework for implementing the MVVM Pattern with JavaFX

Related tags

GUI mvvmFX
Overview

image

mvvmFX is an application framework which provides you necessary components to implement the MVVM pattern with JavaFX.

MVVM is the enhanced version of the Presentation Model pattern and was created by Microsoft engineers for WPF. JavaFX and WPF does have similarities like data binding and descriptive UI declaration (FXML/XAML). Because of this fact we adopted best practices of the development with the Microsoft technology and introduced new helpers to support the development of applications with JavaFX and MVVM.

Commercial Support Build Status

Howto

Maven dependency

Stable Release

This is the stable release that can be used in production.

<dependency>
		<groupId>de.saxsys</groupId>
		<artifactId>mvvmfx</artifactId>
		<version>1.8.0</version>
</dependency>

Bugfix Development Snapshot

Here we make bug fixes for the current stable release.

<dependency>
		<groupId>de.saxsys</groupId>
		<artifactId>mvvmfx</artifactId>
		<version>1.8.1-SNAPSHOT</version>
</dependency>

Development Snapshot

Here we develop new features. This release is unstable and shouldn't be used in production.

<dependency>
		<groupId>de.saxsys</groupId>
		<artifactId>mvvmfx</artifactId>
		<version>1.9.0-SNAPSHOT</version>
</dependency>

Snapshot repository

We use the Sonatype snapshot repository. Maybe you have to add this repository to your <repository> section of the pom.xml.

<repository>
		<id>sonatype-snapshots</id>
		<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
</repository>

Get Help

The best way to get help with mvvmFX is to either ask questions on StackOverflow using the tag "mvvmfx" or to use our Google Groups mailing list. Additionally you can create issues, report bugs and add feature requests on the issue tracker at github.

Links

Comments
  • Scope Concept

    Scope Concept

    Currently we rethink the behavior of scopes and we tend to adopt the DI-Mechanism from Angular2 for our Scopes.

    The mechanism injects same instances of a type into the views that are in a hierarchy.

    Example

    Given the a Hierarchie of Views:

    ViewHierarchie ParentView -ViewA -ViewC --ViewD -ViewB --ViewC --ViewD

    Szenario 1:

    ViewModelHierarchie ParentViewModel -ViewAViewModel - @InjectScope MyScope scope; (ObjectID = 1) --ViewCViewModel - @InjectScope MyScope scope; (ObjectID = 1) --ViewDViewModel - @InjectScope MyScope scope; (ObjectID = 1) -ViewBViewModel - @InjectScope MyScope scope; (ObjectID = 2) --ViewCViewModel - @InjectScope MyScope scope; (ObjectID = 2) --ViewDViewModel - @InjectScope MyScope scope; (ObjectID = 2)

    Szenario 2:

    ViewModelHierarchie ParentViewModel - @InjectScope MyScope scope; (ObjectID = 1) -ViewAViewModel - @InjectScope MyScope scope; (ObjectID = 1) --ViewCViewModel - @InjectScope MyScope scope; (ObjectID = 1) --ViewDViewModel - @InjectScope MyScope scope; (ObjectID = 1) -ViewBViewModel - @InjectScope MyScope scope; (ObjectID = 1) --ViewCViewModel - @InjectScope MyScope scope; (ObjectID = 1) --ViewDViewModel - @InjectScope MyScope scope; (ObjectID = 1)

    The principle is, that the highest Injection point decides for the subviews which scope instance is used.

    Feature improvement 
    opened by sialcasa 25
  • Discussion, requirements about NetBeansIDE-mvvmFX-Plugin

    Discussion, requirements about NetBeansIDE-mvvmFX-Plugin

    Like suggest from Alexander here a ticket for a planed NetBeans plugin. https://github.com/Naoghuman/NetBeansIDE-mvvmFX-Plugin

    First steps I planed was:

    • Implement the 3 example projects from you (hello world, guice, cdi-weld) in the new Project wizard
    • Implement file generation for mvvmFX (ViewModel, View, fxml) in the right packages.

    I thing for the first version is that okay.

    • Then publish it to NetBeansPortal and UC.
    tooling 
    opened by Naoghuman 18
  • Invalidation Listener for FunctionBasedValidator

    Invalidation Listener for FunctionBasedValidator

    To enable validation logic to fire when dependencies of the source ObservableValue are invalidated for a FunctionBasedValidator, it would be useful to be able to add an InvalidationListener as below:

        private FunctionBasedValidator(ObservableValue<T> source) {
            source.addListener((observable, oldValue, newValue) -> {
                validate(newValue);
            });
            source.addListener( (InvalidationListener) (evt -> validate( source.getValue() )));
        }
    

    I have tried extending the class but have no access to the validate method.

    I tried making my own ValidationClass re-using the existing logic, but the ValidationStatus class hides #addMessage and #clearMessage.

    Thanks, Grant

    Feature improvement 
    opened by gtnarg 16
  • #538 Using ControlsFxVisualizer causes node graph inconsistencies

    #538 Using ControlsFxVisualizer causes node graph inconsistencies

    Wrapped ValidationVisualizationBase in a Platform.runLater to ensure the node graph completes initialization before any Visualizers are created on top of it.

    Added a test class.

    Added a utility function that allows to pause the Platform thread in order to allow the test code to validate whether or not a function is using runLater. Pausing the thread is required since it is possible that the Runnable be executed before the test has had the time to validate.

    opened by ntherrien 10
  • CompositeValidator valid percentaje

    CompositeValidator valid percentaje

    Hi, guys

    I've come with the need of displaying the percentage of completion of a form and we decided to display the percentage of valid inputs in the form, so I looked on CompositeValidator to see if there was a way to get the validators or at least the number of validators in the composite and there is not.

    Although I know this is just a really really really backlog feature, it would be nice to have it.

    Thanks guys

    improvement 
    opened by jpitchardu 8
  • Lifecycle Concept for View / ViewModels.

    Lifecycle Concept for View / ViewModels.

    There is already a lifecycle hook (Initialize). It would be great to have the possibility to have other phases like a dispose() hook, that is called when the user decided to kill a group of views.

    Dispose should

    • give the user the option to remove Observers from the NotificationCenter or other long living objects
    • allow the user to do house-keeping before the View and ViewModel are killed
    Idea 
    opened by sialcasa 8
  • [notifications]  The notification mechanism between VM and V may leak.

    [notifications] The notification mechanism between VM and V may leak.

    Currently the ViewModel gets referenced in the global Notification Center when the subscribe method in interface ViewModel is called. This may create memory leaks, because the ViewModel is still referenced as an Observer in the Notification Center, when it is expected to be garbage collected.

    This is due to:

    Everything you register as the recipient of an Event, e.g. in GUI frameworks, cannot be garbage collected as long as it is registered and the event source is alive.

    This may introduce memory leaks, if a developer is not aware of that strong reference from the event source to the event subscriber.

    bug improvement 
    opened by sialcasa 8
  • Commands

    Commands

    A command combines an action with a condition. This can be used for example to provide an {@link #execute()}-action which should perform on a button click. The button should be disabled, while the Command is not executable.

    Feature 
    opened by sialcasa 8
  • Update Guice version.

    Update Guice version.

    mvvmfx-guice uses fx-guice:8.0.0 as dependency which itself uses guice:3.0 but the latest release of Guice is version 4.1.

    Update to new version 4.1. This can include a pullrequest to fx-guice project. However, in the long run it would be better to find an independend solution so that we can update our dependencies on our own. Even better would be to provide a solution so that the user of mvvmfx-guice can choose her desired version.

    API breaking change Guice Needs discussion 
    opened by manuel-mauky 7
  • Added utility class for loading fxml views

    Added utility class for loading fxml views

    Some time ago I created a small utility class that was capable of loading and setting the stage up for a fxml view. It might help out other people so I created a pull request. The code is documented but not the methods itself.

    opened by mainrs 7
  • Scopes

    Scopes

    There should be the possibility to define scopes to group views together. This could be implemented in a way that there is a "Scope-ViewModel" that is injected into the viewModels.

    Feature 
    opened by manuel-mauky 7
  • Bump resteasy-client from 3.0.9.Final to 3.14.0.Final in /examples/books-example

    Bump resteasy-client from 3.0.9.Final to 3.14.0.Final in /examples/books-example

    Bumps resteasy-client from 3.0.9.Final to 3.14.0.Final.

    Release notes

    Sourced from resteasy-client's releases.

    v3.9.2.Final

    In this release:

    springboot.ver = 2.5.7 resteasy.ver = 3.15.3.Final

    Commits
    • 460ce3e [RESTEASY-2786] 3.14.0-SNAPSHOT->3.14.0.Final
    • 1918547 [RESTEASY-2772] Backing out changes for RESTEASY-2772. (#2627)
    • 2e6bcbe [RESTEASY-2641] ported nonProxyHost code from master (#2624)
    • 685132a [RESTEASY-1865] ported proposed code changes to branch (#2625)
    • 771f2c6 [RESTEASY-2728] Clients running in a resource method throw safer WebApplicati...
    • 3b2dc7e Fix wfly21 exclusions
    • 7f297ab [RESTEASY-2707] added security block
    • 8a394e4 [RESTEASY-2765] Fix validation of empty array
    • 4c656d1 Update target containers to test against WFLY 21.0.1.Final
    • 1f773f3 [RESTEASY-2772] changed exception type and adjusted unit tests
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • How to get the index in an item of a list view

    How to get the index in an item of a list view

    Currently I use the class CachedView Model Cell Factory.createForFxmlView(MyView.class) and I would like to know how I could get the getIndex method in my MyViewModel.class class since if I use ListCell returns a value of -1

    I would like how this can be used in a listView.

    Item View:

    public class MyView implements FxmlView<MyViewModel> {
    
     @FXML
     private Label lblIndex;
     @InjectViewModel
     private MyViewModel viewModel;
    
     public void initialize() {
      lblIndex.textProperty().bind(viewModel.getIndexProperty());
     }
    
    }
    
    

    Item ViewModel:

    public class MyViewModel implements ViewModel {
    
     private final IntegerProperty indexProperty = new SimpleIntegerProperty();
    
     public MyViewModel(int index){
      indexProperty.set(index);
     }
    
     public IntegerProperty getIndexProperty() {
      return indexProperty;
     }
    
    }
    
    

    Example using ListCell in ViewModel

    public class MyViewModel extends ListCell<T> implements ViewModel {
    
     private final IntegerProperty indexProperty = new SimpleIntegerProperty();
    
     public MyViewModel(){
      indexProperty.set(this.getIndex()); // getIndex return -1 value;
     }
    
     public IntegerProperty getIndexProperty() {
      return indexProperty;
     }
    
    }
    
    

    opened by Jtpatato21 0
  • Crossfield validation's strange behaviour - freeze

    Crossfield validation's strange behaviour - freeze

    Currently I'm using mvvmfx validation ver.1.8.0 for my app. I have two PasswordFields named 'password' and 'confirmPassword' in View ,to which two string properties are binded from the ViewModel.

    I do the following validation:

    Validator passwordValidator = new BlankTextValidator(password, getValidationBundle().getString("cannot_be_blank"));

    where BlankTextValidator is:

    public class BlankTextValidator extends FunctionBasedValidator {

    private static final Predicate<String> isNotBlank = input -> !UtilMethods.isBlank(input);
    
    public BlankTextValidator(ObservableValue<String> source, String message) {
        super(source, isNotBlank, ValidationMessage.error(message));
    }
    

    }

    I use this validator in quite many places and it works just as expected. For confirmation I use ObservableRuleBasedValidator:

    BooleanBinding confirmPasswordNotBlank = Bindings.createBooleanBinding(() -> !UtilMethods.isBlank(confirmPassword.get()), confirmPassword); BooleanBinding passwordMatches = password.isEqualTo(confirmPassword);

    ObservableRuleBasedValidator ruleBasedValidator = new ObservableRuleBasedValidator(); ruleBasedValidator.addRule(confirmPasswordNotBlank,ValidationMessage.error(getValidationBundle().getString("password_confirm_required"))); ruleBasedValidator.addRule(passwordMatches, ValidationMessage.error(getValidationBundle().getString("password_mismatch")));

    I use CompositeValidator, to which i add the abovementioned valiidators. In View i use ControlsFxVisualizer and also add validation for each control.

    ValidationVisualizer visualizer = new ControlsFxVisualizer(); visualizer.initVisualization(adminViewModel.passwordValidation(), passwordField); visualizer.initVisualization(adminViewModel.confirmPasswordValidation(), confirmField);

    So far, so good. PasswordField's validation is ok, but comfirmField's validation freezes on first rule, No matter if the field is blank or not. I have tried your implementation from https://github.com/sialcasa/mvvmFX/wiki/Validation . With the same result!

    Another strange issue: I use checkcombobox and make validation so that at least one of the fields of the list is checked. In this case i bind every checkbox to BooleanProperty in ViewModel.

    The Validation:

    public class CheckComboBoxValidator extends ObservableRuleBasedValidator {

    public CheckComboBoxValidator(Collection<BooleanProperty> booleanProperties, String message) {
        ObservableValue<ValidationMessage> hasAtLeastOneCheck = Bindings.createObjectBinding(() -> {
            boolean hasAtLeastOneChecked = booleanProperties.stream()
                .anyMatch(bp -> bp.getValue().equals(true));
            if (!hasAtLeastOneChecked) {
                return ValidationMessage.error(message);
            }
            return null;
        }, booleanProperties.toArray(new BooleanProperty[0]));
    
        addRule(hasAtLeastOneCheck);
    }
    

    }

    The Validation works, but checkcombobox freezes(becomes not responsive) in case of :

    1. There are peviously checked fields (by default)
    2. Then the user unchecks all of them. The problem resolves when the user selects another control.
    opened by daniel-sarov 2
  • Bump logback-classic from 1.1.2 to 1.2.0 in /examples/contacts-example

    Bump logback-classic from 1.1.2 to 1.2.0 in /examples/contacts-example

    Bumps logback-classic from 1.1.2 to 1.2.0.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump logback-classic from 1.1.2 to 1.2.0 in /examples/books-example

    Bump logback-classic from 1.1.2 to 1.2.0 in /examples/books-example

    Bumps logback-classic from 1.1.2 to 1.2.0.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(mvvmfx-1.7.0)
Owner
Alexander Casall
Alexander Casall
组件化、极简依赖、模块单独运行、mvvm、kotlin、koin、jetpack(livedata、viewmodel、lifecycle、viewbinding、...)、buildsrc、coroutines

相关内容 组件化、支持模块单独运行 androidx mvvm kotlin koin jetpack(livedata、viewmodel、lifecycle、viewbinding、...) buildsrc coroutines liveeventbus ... 项目用到的依赖库 APK下载体

panyy 51 Jan 3, 2023
Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE 8 and provides the functionalities to use and handle easily Tiles in your JavaFX application.

Lib-Tile Intention Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE and provides the functionalities to use and handle easily Tile

Peter Rogge 13 Apr 13, 2022
Desktop/Mobile JavaFX application framework

Basilisk is desktop/mobile application development platform for the JVM. Inspired by Griffon, Basilisk leverages JavaFX and JavafXPorts to bring the s

Basilisk 55 Feb 10, 2022
An image annotation desktop-application written in Java using the JavaFX application platform.

This is an image annotation desktop-application written in Java using the JavaFX application platform. It allows you to create bounding box annotations using rectangular and polygonal shapes. Annotations can be imported and saved from/to JSON files, Pascal VOC format XML-files or YOLO format TXT-files.

Markus Fleischhacker 31 Dec 4, 2022
Tray Icon implementation for JavaFX applications. Say goodbye to using AWT's SystemTray icon, instead use a JavaFX Tray Icon.

FXTrayIcon Library intended for use in JavaFX applications that makes adding a System Tray icon easier. The FXTrayIcon class handles all the messy AWT

Dustin Redmond 248 Dec 30, 2022
DataFX - is a JavaFX frameworks that provides additional features to create MVC based applications in JavaFX by providing routing and a context for CDI.

What you’ve stumbled upon here is a project that intends to make retrieving, massaging, populating, viewing, and editing data in JavaFX UI controls ea

Guigarage 110 Dec 29, 2022
Docking framework for JavaFX platform

Docking framework for JavaFX platform AnchorFX is a gratis and open source library for JavaFX to create graphical interfaces with docking features Anc

Alessio Vinerbi 197 Oct 15, 2022
A Java framework for creating sophisticated calendar views (JavaFX 8, 9, 10, and 11)

CalendarFX A Java framework for creating sophisticated calendar views based on JavaFX. A detailed developer manual can be found online: CalendarFX 8 D

DLSC Software & Consulting GmbH 660 Jan 6, 2023
A JavaFX UI framework to create fully customized undecorated windows

CustomStage A JavaFX undecorated stage which can fully be customized Donations If this project is helpful to you and love my work and feel like showin

Oshan Mendis 186 Jan 6, 2023
A framework for easily creating forms for a JavaFX UI.

FormsFX Forms for business application made easy. Creating forms in Java has never been this easy! Maven To use this framework as part of your Maven b

DLSC Software & Consulting GmbH 534 Dec 30, 2022
Lightweight JavaFX Framework for Kotlin

TornadoFX JavaFX Framework for Kotlin Important: TornadoFX is not yet compatible with Java 9/10 Oracle is intending to decouple JavaFX from the JDK. W

Edvin Syse 3.6k Dec 29, 2022
A lightweight RCP framework for JavaFX applications.

WorkbenchFX The one and only framework to build large JavaFX Applications! Maven To use this framework as part of your Maven build simply add the foll

DLSC Software & Consulting GmbH 471 Jan 8, 2023
😉PrettyZoo is a GUI for Zookeeper created by JavaFX and Apache Curator Framework.

?? Pretty nice Zookeeper GUI, Support Win / Mac / Linux Platform

vran 2.4k Jan 5, 2023
A simple JavaFX application to load, save and edit a CSV file and provide a JSON configuration for columns to check the values in the columns.

SmartCSV.fx Description A simple JavaFX application to load, save and edit a CSV file and provide a JSON Table Schema for columns to check the values

Andreas Billmann 74 Oct 24, 2022
A JavaFX Application mimicking the Matrix green code falling/raining effect.

Matrix Effect A JavaFX application that mimics the falling/raining green code effect. This project has been generated from Gluon at https://start.gluo

Carl Dea 10 Oct 1, 2022
It is a desktop application based on JavaFX to implement a Carmeter-GPS.

CarMeter_JavaFX It is a desktop application based on JavaFX to implement a Carmeter-GPS. Video View more Details about the project.---> Link to Video

Abdullah HAnfy 0 Nov 29, 2022
FXDesktopSearch - a Java and JavaFX based Desktop Search Application

FXDesktopSearch - The free search application for your desktop FXDesktopSearch is a Java and JavaFX based Desktop Search Application. It crawls a conf

Mirko Sertic 162 Oct 14, 2022
A framework for easily creating a UI for application settings / preferences.

PreferencesFX Preference dialogs for business applications made easy. Creating preference dialogs in Java has never been this easy! Table of Contents

DLSC Software & Consulting GmbH 545 Dec 22, 2022
Collection of Binding helpers for JavaFX(8)

Advanced-Bindings for JavaFX (8) advanced-bindings is a collection of useful helpers and custom binding implementations to simplify the development of

Manuel Mauky 63 Nov 19, 2022