IDEMPIERE-976 Impossible to set a title for FDialog.error

This commit is contained in:
Nicolas Micoud 2014-02-15 11:22:42 -05:00
parent 36b7d1a0c5
commit 900f6bd76e
1 changed files with 65 additions and 7 deletions

View File

@ -212,13 +212,42 @@ public class FDialog
* @param adMessage Message to be translated * @param adMessage Message to be translated
* @param message Additional message * @param message Additional message
* @param callback * @param callback
*/
public static void error(int windowNo, Component comp, String adMessage, String message, Callback<Integer> callback)
{
error(windowNo, comp, adMessage, message, callback, null);
}
/**
* Display error with error icon.
*
* @param windowNo Number of Window
* @param comp Component (unused)
* @param adMessage Message to be translated
* @param message Additional message
* @param title If none then one will be generated
*/
public static void error(int windowNo, Component comp, String adMessage, String message, String title)
{
error(windowNo, comp, adMessage, message, (Callback<Integer>)null, title);
}
/**
* Display error with error icon.
*
* @param windowNo Number of Window
* @param comp Component (unused)
* @param adMessage Message to be translated
* @param message Additional message
* @param callback
* @param title If none then one will be generated
* *
* @see #error(int, String) * @see #error(int, String)
* @see #error(int, Component, String) * @see #error(int, Component, String)
* @see #error(int, String, String) * @see #error(int, String, String)
*/ */
public static void error(int windowNo, Component comp, String adMessage, String message, Callback<Integer> callback) public static void error(int windowNo, Component comp, String adMessage, String message, Callback<Integer> callback, String title)
{ {
Properties ctx = Env.getCtx(); Properties ctx = Env.getCtx();
StringBuffer out = new StringBuffer(); StringBuffer out = new StringBuffer();
@ -232,8 +261,15 @@ public class FDialog
out = constructMessage(adMessage, message); out = constructMessage(adMessage, message);
String newTitle;
if (title == null)
newTitle = AEnv.getDialogHeader(ctx, windowNo);
else
newTitle = title;
String s = out.toString().replace("\n", "<br>"); String s = out.toString().replace("\n", "<br>");
Messagebox.showDialog(s, AEnv.getDialogHeader(ctx, windowNo), Messagebox.OK, Messagebox.ERROR, callback); Messagebox.showDialog(s, newTitle, Messagebox.OK, Messagebox.ERROR, callback);
return; return;
} }
@ -341,7 +377,6 @@ public class FDialog
return; return;
} }
/** /**
* Display information with information icon. * Display information with information icon.
* *
@ -350,10 +385,27 @@ public class FDialog
* @param adMessage Message to be translated * @param adMessage Message to be translated
* @param message Additional message * @param message Additional message
* *
* @see #info(int, Component, String, String)
*/
public static void info(int windowNo, Component comp, String adMessage, String message)
{
info(windowNo, comp, adMessage, message, null);
}
/**
* Display information with information icon.
*
* @param windowNo Number of Window
* @param comp Component (unused)
* @param adMessage Message to be translated
* @param message Additional message
* @param title If none then one will be generated
*
* @see #info(int, Component, String) * @see #info(int, Component, String)
*/ */
public static void info(int windowNo, Component comp, String adMessage, String message) public static void info(int windowNo, Component comp, String adMessage, String message, String title)
{ {
Properties ctx = Env.getCtx(); Properties ctx = Env.getCtx();
@ -368,9 +420,15 @@ public class FDialog
out = constructMessage(adMessage, message); out = constructMessage(adMessage, message);
String s = out.toString().replace("\n", "<br>"); String newTitle;
Messagebox.showDialog(s, AEnv.getDialogHeader(ctx, windowNo), Messagebox.OK, Messagebox.INFORMATION);
if (title == null)
newTitle = AEnv.getDialogHeader(ctx, windowNo);
else
newTitle = title;
String s = out.toString().replace("\n", "<br>");
Messagebox.showDialog(s, newTitle, Messagebox.OK, Messagebox.INFORMATION);
return; return;
} }
} }