From 77f6d8d7e3b25cca340b403f1db3269eb2599bb5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 22 Oct 2014 08:37:23 -0500 Subject: [PATCH] IDEMPIERE-2251 Add methods in FDialog for message that must not be translated --- .../webui/panel/WDocActionPanel.java | 2 +- .../org/adempiere/webui/window/FDialog.java | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java index db88c93ae0..314528cada 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java @@ -318,7 +318,7 @@ public class WDocActionPanel extends Window implements EventListener, Dia String docAction = lstDocAction.getSelectedItem().getLabel(); MessageFormat mf = new MessageFormat(Msg.getMsg(Env.getAD_Language(Env.getCtx()), "ConfirmOnDocAction")); Object[] arguments = new Object[]{docAction}; - FDialog.ask(0, this, mf.format(arguments), new Callback() { + FDialog.ask(0, this, "", mf.format(arguments), new Callback() { @Override public void onCallback(Boolean result) { if(result) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java index d58acdac2b..1abe6ab5a9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java @@ -299,7 +299,7 @@ public class FDialog * * @return true, if OK */ - public static boolean ask(int windowNo, Component comp, String adMessage, String msg, Callback callback) + public static boolean ask(int windowNo, Component comp, String adMessage, String msg, final Callback callback) { StringBuilder out = new StringBuilder(); if (adMessage != null && !adMessage.equals("")) @@ -307,7 +307,23 @@ public class FDialog if (msg != null && msg.length() > 0) out.append("\n").append(msg); String s = out.toString().replace("\n", "
"); - return ask(windowNo, comp, s, callback); + + Callback msgCallback = null; + if (callback != null) + { + msgCallback = new Callback() { + @Override + public void onCallback(Integer result) { + boolean b = result != null && result.intValue() == Messagebox.OK; + callback.onCallback(b); + } + }; + } + String title = AEnv.getDialogHeader(Env.getCtx(), windowNo); + int response = Messagebox.showDialog(s, title, + Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, msgCallback, (msgCallback == null)); + + return (response == Messagebox.OK); } /**************************************************************************