IDEMPIERE-2251 Add methods in FDialog for message that must not be translated

This commit is contained in:
Carlos Ruiz 2014-10-22 08:37:23 -05:00
parent 8ead12cbab
commit 77f6d8d7e3
2 changed files with 19 additions and 3 deletions

View File

@ -318,7 +318,7 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
String docAction = lstDocAction.getSelectedItem().getLabel(); String docAction = lstDocAction.getSelectedItem().getLabel();
MessageFormat mf = new MessageFormat(Msg.getMsg(Env.getAD_Language(Env.getCtx()), "ConfirmOnDocAction")); MessageFormat mf = new MessageFormat(Msg.getMsg(Env.getAD_Language(Env.getCtx()), "ConfirmOnDocAction"));
Object[] arguments = new Object[]{docAction}; Object[] arguments = new Object[]{docAction};
FDialog.ask(0, this, mf.format(arguments), new Callback<Boolean>() { FDialog.ask(0, this, "", mf.format(arguments), new Callback<Boolean>() {
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
if(result) if(result)

View File

@ -299,7 +299,7 @@ public class FDialog
* *
* @return true, if OK * @return true, if OK
*/ */
public static boolean ask(int windowNo, Component comp, String adMessage, String msg, Callback<Boolean> callback) public static boolean ask(int windowNo, Component comp, String adMessage, String msg, final Callback<Boolean> callback)
{ {
StringBuilder out = new StringBuilder(); StringBuilder out = new StringBuilder();
if (adMessage != null && !adMessage.equals("")) if (adMessage != null && !adMessage.equals(""))
@ -307,7 +307,23 @@ public class FDialog
if (msg != null && msg.length() > 0) if (msg != null && msg.length() > 0)
out.append("\n").append(msg); out.append("\n").append(msg);
String s = out.toString().replace("\n", "<br>"); String s = out.toString().replace("\n", "<br>");
return ask(windowNo, comp, s, callback);
Callback<Integer> msgCallback = null;
if (callback != null)
{
msgCallback = new Callback<Integer>() {
@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);
} }
/************************************************************************** /**************************************************************************