How do I share a container or node using Between a controller and class using DataFX concepts ?

32 views
Skip to first unread message

ed.shee...@gmail.com

unread,
Apr 26, 2018, 10:10:22 PM4/26/18
to DataFX
I'm newbie in DataFX ,I'm trying shared a JFXDialog between two controllers so in first controller I have :

@ViewController(value = "/com/javafx/pattern/mvc/view/parent/fxml/SignUp.fxml")
public class SignUpController {
.......
.......
    @ActionMethod("onClickSignUp")
    public void showSignUpForm() throws IOException, FlowException {
        ViewConfiguration configuration = new ViewConfiguration();
        configuration.setResources(ResourceBundleRegister.SIGN_UP_FORM_BUNDLE_ENG);
        StackPane stackPane = FlowContextController.buildFlow(RegistrationController.class, configuration, context, STYLE_SHEET); //FlowContextController has a reponsibilty of flow mangement
        JFXDialog registrationDialog = new JFXDialog();
        registrationDialog.setContent(stackPane);
        registrationDialog.setDialogContainer((StackPane) rootTabPane.getScene().getRoot());
        registrationDialog.setTransitionType(JFXDialog.DialogTransition.LEFT);
        registrationDialog.show();      
        context.register(registrationDialog);

    }
...
.......
....
}
In second controller "ErrorController"  (has not a view ) ,It is a standart class can display errors ....


public class SharedErrorController {
 public static void pinErrorPopOver(Node node, String errorMessage) {
        JFXDialog dialog = FlowContextController.getFlowHandler().getFlowContext().getRegisteredObject(JFXDialog.class); //My question is about this line
        //Hide error popover in case of leaving window
        node.getScene().getWindow().focusedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
            if (!newValue) {
                errorPopOver.hide();
            }
        });
..
..............
}

}
With this piece of code am I in DataFX concepts ? if not ,please give a sample how to share a node between controller and other class . Thank you .
Reply all
Reply to author
Forward
0 new messages