I don't have access to my IDE at the moment but I think something like this should work:
public class GlobalActionsDemo extends Application {
@Override
public void start(Stage stage) throws Exception {
StackPane pane = new StackPane();
DefaultFlowContainer flowContainer = new DefaultFlowContainer(pane);
Flow flow = new Flow(ViewController1.class)
.withGlobalLink("view1ActionId",
ViewController1.class)
.withGlobalLink("view2ActionId",
ViewController1.class);
FlowHandler handler = flow.createHandler();
handler.start(flowContainer);
Button b1 = new Button("View 1");
b1.setOnAction((e) -> handler.handle(("view1ActionId"));
Button b2 = new Button("View 1");
b2.setOnAction((e) -> handler.handle(("view2ActionId"));
VBox box = new VBox();
box.getChildren().addAll(pane, b1, b2);
Scene myScene = new Scene(pane);
stage.setScene(myScene);
stage.show();
}
public static void main(String[] args) {
launch(args);