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

1.3k views Asked by At

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...

2

There are 2 answers

5
Silviaa On BEST ANSWER

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.

3
Sajeev On

You can use JOptionPane but not ADialog or FDialog. Usage of ADialog throws build error. As its is defined in client folder, you cant use it in the upper hierarchy.

You can find the build order from here