public class CustomizeMessageBox {
private static final String MSG_TITLE = "Customized";
/**
* Displays a message
*
* @param message Message text
* @param title Message title
* @param icon MessageBox.INFO, MessageBox.ERROR, MessageBox.QUESTION, MessageBox.WARNING
* @param callback task to perform after response
*/
public static void alert(final String message, final String title, final String icon, final MessageBox.PromptCallback callback) {
MessageBox.show(
new MessageBoxConfig() {
{
setMsg(message);
setTitle(title);
setIconCls(icon);
setButtons(MessageBox.OK);
setCallback(callback);
}
}
);
}
/**
* Displays a message
*
* @param message Message text
* @param title Message title
* @param icon MessageBox.INFO, MessageBox.ERROR, MessageBox.QUESTION, MessageBox.WARNING
*/
public static void alert(String message, String title, String icon) {
alert(message, title, icon, null);
}
/**
* Displays a message
*
* @param message Message text
* @param icon MessageBox.INFO, MessageBox.ERROR, MessageBox.QUESTION, MessageBox.WARNING
*/
public static void alert(String message, String icon) {
alert(message, MSG_TITLE, icon);
}
/**
* Displays a message
*
* @param message Message text
*/
public static void alert(String message) {
alert(message, MessageBox.INFO);
}
/**
* Displays a message
*
* @param message Message text
* @param callback task to perform after response
*/
public static void alert(String message, MessageBox.PromptCallback callback) {
alert(message, MSG_TITLE, MessageBox.INFO, callback);
}
}
No comments:
Post a Comment