popup - User can't navigate if dialogue is open -


if dialogue open , user wants open screen or needs close dialogue first , navigate, otherwise can't.

i having javafx dialogue working unable figured out how restrict user not navigate anywhere else without closing current dialogue.

code:

final textfield templatetexbox = new textfield();          final label templatenamelabel = new label("template name");         final label templatetype = new label("type of template");          final checkbox cb = new checkbox("set default template");          final combobox combobox = new combobox();         combobox.getitems().addall("private", "public");         combobox.setprompttext("select template type");          if (getviewmodel().selectedtemplate().get() != null) {             templatetexbox.settext(getviewmodel().selectedtemplate().get().getpreference().getname());             cb.setselected(getviewmodel().selectedtemplate().get().getdefaulttemplate());              combobox.setvalue(getviewmodel().selectedtemplate().get().gettemplatetype());          }          final stage stage = new stage();          stage.initmodality(modality.window_modal);          final dialog dlg = new dialog(stage, "save template");         dlg.getstyleclass().add(dialog.style_class_cross_platform);         dlg.setresizable(false);         dlg.seticonifiable(false);          templatenamelabel.setwraptext(true);         templatetype.setwraptext(true);         templatenamelabel.setprefwidth(130.0);         templatetype.setprefwidth(130.0);          templatetexbox.setprompttext("enter text");         templatetexbox.focusedproperty().addlistener(new changelistener<boolean>(){             @override             public void changed(observablevalue observable, boolean oldvalue, boolean newvalue) {                  if(!newvalue){                                       optional<templatepreferences> templateoptional = getviewmodel().getalltemplates().stream().filter(template ->template.getpreference().getname().equalsignorecase(templatetexbox.gettext())).findany();                     if(!templateoptional.ispresent()){                         cb.setselected(false);                      }                 }             }           });          hbox tmpnamebox = new hbox(templatenamelabel, templatetexbox);         hbox tmptypebox = new hbox(templatetype, combobox);         hbox tmpdefaultbox = new hbox(cb);         tmpnamebox.setprefheight(40.0);         tmptypebox.setprefheight(40.0);          vbox wrapperbox = new vbox( tmpnamebox, tmptypebox, tmpdefaultbox );          dlg.setcontent(wrapperbox);         dlg.getactions().addall(dialog.action_ok, dialog.action_cancel);          action action = dlg.show();          if (action == dialog.action_ok) {              if (stringutils.isnotblank(templatetexbox.gettext()) && combobox.getvalue() != null) {                 //savetemplatedata(templatetexbox.gettext(), string.valueof(combobox.getvalue()), cb.isselected());                 savefiltertemplatedata(templatetexbox.gettext(), string.valueof(combobox.getvalue()), cb.isselected());              } else {                  dialogs.create().title("missing required data")                         .message("please populate both template name , template type")                         .styleclass(dialog.style_class_cross_platform).showerror();                 savetemplate();             }          } 

** using class

import org.controlsfx.dialog.dialogs;

i have tried javafx dialog , craete code unable achieve want.

call

dlg.initmodality(modality.none); 

before showing dialog (see docs)


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -