Understanding the Flow API

359 views
Skip to first unread message

Tariq Ahsan

unread,
Jan 23, 2014, 2:33:05 PM1/23/14
to dataf...@googlegroups.com
Trying to understand the datafx-sample's flow example. We already implemented a JavaFX application which has multiple controllers. My question specifically is related to our existing code is FXMLLoader. Can we altogether get rid of using FXMLLoader and use the DataFX context, container and flow instead?
 
Thanks

Hendrik Ebbers

unread,
Jan 24, 2014, 6:24:29 AM1/24/14
to dataf...@googlegroups.com
Can you explain your problem in more detail, please?

Tariq Ahsan

unread,
Jan 28, 2014, 1:20:12 PM1/28/14
to dataf...@googlegroups.com
Here's the part of the code where my question was about replacing FXMLoader -
 
public class JavaFXMain extends Application {
  @Override
  public void start(Stage primaryStage) throws Exception {
  
   // Set the stage title and load FXML panes
   primaryStage.setTitle("Welcome to My App");
   FXMLLoader fxmlLoader1 = new FXMLLoader(getClass().getResource("/fxml/baseScreen.fxml"));
   GridPane baseScreenPane = (GridPane) fxmlLoader1.load();
  
   FXMLLoader fxmlLoader2 = new FXMLLoader(getClass().getResource("/fxml/startScreen.fxml"));
   GridPane mainScreenPane = (GridPane) fxmlLoader2.load();
  
   FXMLLoader fxmlLoader3 = new FXMLLoader(getClass().getResource("/fxml/testedRecordsScreen.fxml"));
         GridPane testedRecordsScreenPane = (GridPane) fxmlLoader3.load();
        
         FXMLLoader fxmlLoader4 = new FXMLLoader(getClass().getResource("/fxml/recordsErrorsScreen.fxml"));
         GridPane recordsErrorsScreenPane = (GridPane) fxmlLoader4.load();
        
   // Get the base controller and register the FXML panes on the controller
   final BaseScreenController baseScreenController = (BaseScreenController) fxmlLoader1.getController();
   baseScreenController.setMainScreenPane(mainScreenPane);
   baseScreenController.setTestedRecordsPane(testedRecordsScreenPane);
   baseScreenController.setRecordsErrorsPane(recordsErrorsScreenPane);
   baseScreenController.setStage(primaryStage);
...
 
Trying to re-write the above using your DataFX Flow API. Could you suggest what would be the best way go about doing so?
 
Thanks
 
Tariq
 

On Thursday, January 23, 2014 2:33:05 PM UTC-5, Tariq Ahsan wrote:
Trying to understand the datafx-sample's flow example. We already implemented a JavaFX application which has multiple controllers. My question specifically is related to our existing code is FXMLLoader. Can we altogether get rid of using FXMLLoader and use the DataFX context, container and flow instead?
 
Thanks

On Thursday, January 23, 2014 2:33:05 PM UTC-5, Tariq Ahsan wrote:
Trying to understand the datafx-sample's flow example. We already implemented a JavaFX application which has multiple controllers. My question specifically is related to our existing code is FXMLLoader. Can we altogether get rid of using FXMLLoader and use the DataFX context, container and flow instead?
 
Thanks

Hendrik Ebbers

unread,
Jan 30, 2014, 3:15:15 PM1/30/14
to dataf...@googlegroups.com
Hi,

with DataFX you can create a flow that contains all your views. You can find a example in the datafx-samples module: https://bitbucket.org/datafx/datafx/src/601dc0abc4231913640208ee7ce67cdb08898953/datafx-samples/src/main/java/org/datafx/samples/masterdetail/?at=default

If you don't want to create a complete Flow you can only use the basic controller API of DataFX.

In your code I can see that all the views that are loaded by FXMLLoader are added to one global view. Is that right?

Tariq Ahsan

unread,
Feb 3, 2014, 9:32:21 AM2/3/14
to dataf...@googlegroups.com
You mentioned -
"If you don't want to create a complete Flow you can only use the basic controller API of DataFX ...".
 
Can you help me out to understand how I can go about still using Basic Controller API of DataFX without using the Flow? It appears what I'm trying to do with the Flow API in my code is becoming a bit complicated
 
Thank you.
Reply all
Reply to author
Forward
0 new messages