I am using an MVC model where I initialize all the action listeners for the view in the controller. For example:
The view:
public void addStartDateListener(ChangeListener<Boolean>e){
startDate.focusedProperty().addListener(e);
}
public void addFinishDateListener(ChangeListener<Boolean>e){
finishDate.focusedProperty().addListener(e);
}
The controller:
this.theView.addStartDateListener(new startDateFocusListener());
this.theView.addFinishDateListener(new finishDateFocusListener());
class finishDateFocusListener implements ChangeListener<Boolean> {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue)
{
if (newPropertyValue)
{
System.out.println("Finish date");
}
else
{
System.out.println("Finish date");
}
}
}
//focus listener to update the date whenever the focus is lost
class startDateFocusListener implements ChangeListener<Boolean> {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue)
{
if (newPropertyValue)
{
System.out.println("start date");
}
else
{
System.out.println("start date");
}
}
As the stage(which is the view) appears I need for the application to wait till it gets closed and not allow the user to perform any other action on other stages. If however I use "showAndWait()" with "initModality(Modality.APPLICATION_MODAL);" The action listeners do not get added to the view, but if I use only "initModality(Modality.APPLICATION_MODAL);" it does not allow the user to perform any actions on other stages except the one and all the action listener are fully functional, but I still need to wait till the stage gets closed and only then continue further as the rest is depending on the output of the stage that is being created. So my question is how can I do it?
I have so far tried to use Task with "setOnSucced" and etc. However no luck. I am fairly new to the MVC concept as well.