Search code examples
javaswingmodeladempiere

Add confirm (Yes /No) dialog box inside Model class in Adempiere


I want to create confirm dialog box inside Model class. I created window which has several text boxes and after entering the values user can save data. At the point of saving data I want to add a confirm dialog box asking "Are you sure to save these data ?" So inside Model class I tried to put

org.adempiere.webui.window.FDialog.ask(1,null,"Are you sure to save these data ?");

When I add this into my code, it will give errors and I can't build the project.

If anyone knows how to add confirm dialog box in model class? Please help me to do this...


Solution

  • In Adempiere For Swing Class (i.e.) model class you can use by below

     int response = JOptionPane.showConfirmDialog(null, Are you sure to save these data ?
                                "", JOptionPane.YES_NO_OPTION);
     if (response == JOptionPane.YES_OPTION) 
       ;                    
     else
       ;                  
    

    or Adialog in Client modules cann't used in Base modules

    ADialog.ask(WindowNo, null,"Are you sure to save these data ?");
    

    FDialog Should be used only in ZKWebui package, never use zk classes in base/client modules

    org.adempiere.webui.window.FDialog.ask(1,null,"Are you sure to save these data ?")
    

    In window/tab before save you can use "Commit Warning" column in Window,Tab & field (Application Dictionary)

    Hope it will helps you.