IDEMPIERE-3715 Improve FDialog to receive arguments for the AD_Message in special cases

This commit is contained in:
Diego Ruiz 2018-05-17 14:43:59 +02:00
parent 919b6f34db
commit 5963b4ff32
1 changed files with 7 additions and 2 deletions

View File

@ -373,7 +373,7 @@ public class FDialog
* @return true, if OK * @return true, if OK
*/ */
public static boolean ask(String title, int windowNo, Component comp, String adMessage, final Callback<Boolean> callback) public static boolean ask(String title, int windowNo, Component comp, String adMessage, final Callback<Boolean> callback, Object ... args)
{ {
Callback<Integer> msgCallback = null; Callback<Integer> msgCallback = null;
if (callback != null) if (callback != null)
@ -386,7 +386,12 @@ public class FDialog
} }
}; };
} }
String s = Msg.getMsg(Env.getCtx(), adMessage).replace("\n", "<br>"); String s;
if (args != null && args.length > 0)
s = Msg.getMsg(Env.getCtx(), adMessage, args);
else
s = Msg.getMsg(Env.getCtx(), adMessage);
s = s.replace("\n", "<br>");
int response = Messagebox.showDialog(s, title, int response = Messagebox.showDialog(s, title,
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, msgCallback, (msgCallback == null)); Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, msgCallback, (msgCallback == null));