Add another confirmation message on delete

Help is preferred to those who publish their work as Open Source and not as private branches rejecting collaboration. Such projects are not maintainable and shall be deleted.
Forum rules
This forum is personally pruned to avoid redundant posts. Related topics are grouped together. IF YOU HAVE REGISTERED, you need to send email to red1(a)red1.org with your username in the subject title to get me to activate you.

Add another confirmation message on delete

Postby nmicoud » Mon Nov 12, 2012 7:01 pm

Hi,

I have added some M classes for specific business used and I would like to add another confirmation message before deleting.
For instance, when current record is used more than 3 times, there should be a second dialog box : "This record is used x times, do you wan to delete it ?"

I've starting using beforeDelete method but ADialog is for Swing, FDialog is for webUI. Is there a way to only create a message and let UI display it through the good component ?

Thanks,

Nicolas
nmicoud
Regular
 
Posts: 137
Joined: Fri Oct 07, 2011 6:19 pm

Re: Add another confirmation message on delete

Postby red1 » Sun Nov 18, 2012 7:08 pm

I almost sure that a ModelValidator is perfect for this. I done a Reverse check in http://www.adempiere.com/MyValidatorThailand which i think you can base that with a value counter. I guess the missing gap is how do you count the number of uses to 3.
red1
Site Admin
 
Posts: 2759
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Add another confirmation message on delete

Postby nmicoud » Mon Nov 19, 2012 4:53 pm

Hi,

My question is more than how we can say to users (which can use swing or web) : "This record is used x times, do you wan to delete it ?".
I mean, if i write ADialog... that will be ok for swing but will generate errors in web. Otherwise, i can write FDialog, which will be ok for web, but not for swing.

Is there a common way (web & swing) to code those message ?

Thanks,

Nicolas
nmicoud
Regular
 
Posts: 137
Joined: Fri Oct 07, 2011 6:19 pm

Re: Add another confirmation message on delete

Postby red1 » Tue Nov 20, 2012 6:21 pm

Hm, i see. So did you come across any pop-ups that are applicable for both clients?

Now, if a mere 'condition' box works in both clients, then perhaps your workaround will be to use that box that won't serve as a dialog but just a checking prompt, where you then close it and proceed to delete. This will mean extra step - a 'check first' button.
red1
Site Admin
 
Posts: 2759
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Add another confirmation message on delete

Postby nmicoud » Tue Nov 20, 2012 7:04 pm

That make me thinking : is there a way to detect what UI is used ?
Would it be possible to have something like :

if (Swing)
ADialog.ask(.... "Message")
else // web
nmicoud
Regular
 
Posts: 137
Joined: Fri Oct 07, 2011 6:19 pm

Re: Add another confirmation message on delete

Postby nmicoud » Tue Nov 20, 2012 7:07 pm

In fact, this 2nd message should only appears when there is a specific condition (current record is used more than 3 times)

That make me thinking : is there a way to detect what UI is used ?
Would it be possible to have something like :

Code: Select all
String msg = "Do you really want to delete";
boolean force_delete=false;
if (Swing)
  force_delete = ADialog.ask(.... msg )
else // web
  force_delete = FDialog.ask(... msg )

if (force_delete)
    MXXX.delete;
nmicoud
Regular
 
Posts: 137
Joined: Fri Oct 07, 2011 6:19 pm


Return to HELP ME!!!

Who is online

Users browsing this forum: No registered users and 1 guest

cron