Dialog Support

85 views
Skip to first unread message

gtn...@gmail.com

unread,
Jan 19, 2016, 9:24:18 AM1/19/16
to MvvmFX
Hi, 

I'm evaluating your framework and decided to refactor some existing functionality leveraging your framework.

I have a wizard which is based on a Dialog and a number of DialogPane(s).  Each page of the wizard is displayed by changing out the DialogPane.

The wizard leverages the functionality that comes with Dialog (eg. ResultConverter) and DialogPane (eg. button support ).

The problem I am running into right away is that Dialog isn't a Parent and cannot be considered a valid view from FluentLoader's perspective.  Is there any reason for this restriction?

Thanks
Grant

Manuel Mauky

unread,
Jan 25, 2016, 3:34:14 PM1/25/16
to MvvmFX
Hi,

the main use case for the FluentViewLoader is to load a view and put it into a scene. The constructor of scene takes a root element of type Parent as argument.

Maybe you could try this:
- Define the dialog in FXML with a root container of AnchorPane, HBox, VBox or some other default layout container
- Load the FXML view via FluentViewLoader
- Put the loaded Parent in the dialogPane of the dialog via setContent method.

If this doesn't work for your use case can you please provide an example of a FXML file and the code you are trying?

grant....@gmail.com

unread,
Jan 26, 2016, 9:21:03 AM1/26/16
to MvvmFX
I ended up using FluentViewLoader for the DialogPane(s) which inherit from Parent and it works well.

I realize that I could create my own dialog but want to reuse the functionality provided by javafx.api.javafx.scene.control.Dialog.

I'm treating  the javafx.api.javafx.scene.control.Dialog as a View.   I have subclassed it and it is responsible for loading the DialogPane(s).  If I could load this class through the FluentViewLoader then it could instantiate a separate ViewModel and inject the dependencies for me.  It just means I need to do it manually.  There are perhaps other downstream consequences to doing this that I'm not aware of.

I will provide you a working sample if needed.

Thanks,
Grant
Reply all
Reply to author
Forward
0 new messages