Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / jigsaw / src / org / w3c / jigadmin / gui / Message.java
diff --git a/JMCR-Stable/real-world application/jigsaw/src/org/w3c/jigadmin/gui/Message.java b/JMCR-Stable/real-world application/jigsaw/src/org/w3c/jigadmin/gui/Message.java
new file mode 100644 (file)
index 0000000..bd7d116
--- /dev/null
@@ -0,0 +1,159 @@
+// Message.java\r
+// $Id: Message.java,v 1.1 2010/06/15 12:21:49 smhuang Exp $\r
+// (c) COPYRIGHT MIT, INRIA and Keio, 1999.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.jigadmin.gui; \r
+\r
+import java.awt.Component;\r
+\r
+import javax.swing.JOptionPane;\r
+\r
+import org.w3c.jigsaw.admin.RemoteAccessException;\r
+import org.w3c.jigadmin.RemoteResourceWrapper;\r
+\r
+/**\r
+ * Messages.\r
+ * @version $Revision: 1.1 $\r
+ * @author  Benoît Mahé (bmahe@w3.org)\r
+ */\r
+public class Message {\r
+\r
+    /**\r
+     * Show an error message\r
+     * @param parent The parent Component\r
+     * @param message The message to show\r
+     * @param title The dialog title\r
+     */\r
+    public static void showErrorMessage(Component parent,\r
+                                       String message,\r
+                                       String title)\r
+    {\r
+       JOptionPane.showMessageDialog(parent, message, \r
+                                     title, JOptionPane.ERROR_MESSAGE);\r
+    }\r
+\r
+    /**\r
+     * Show an error message\r
+     * @param rrw the RemoteResourceWrapper associated to this message\r
+     * @param message The message to show\r
+     * @param title The dialog title\r
+     */\r
+    public static void showErrorMessage(RemoteResourceWrapper rrw,\r
+                                       String message,\r
+                                       String title)\r
+    {\r
+       showErrorMessage(rrw.getServerBrowser(), message, title);\r
+\r
+    }\r
+\r
+    /**\r
+     * Show an error message\r
+     * @param parent The parent Component\r
+     * @param ex the catched exception\r
+     * @param title The dialog title\r
+     */\r
+    public static void showErrorMessage(Component parent,\r
+                                       Exception ex,\r
+                                       String title)\r
+    {\r
+       showErrorMessage(parent, ex.getMessage(), title);\r
+    }\r
+\r
+    /**\r
+     * Show an error message\r
+     * @param rrw the RemoteResourceWrapper associated to this message\r
+     * @param ex the catched exception\r
+     * @param title The dialog title\r
+     */\r
+    public static void showErrorMessage(RemoteResourceWrapper rrw,\r
+                                       Exception ex,\r
+                                       String title)\r
+    {\r
+       showErrorMessage(rrw.getServerBrowser(), ex.getMessage(), title);\r
+    }\r
+\r
+    /**\r
+     * Show an error message\r
+     * @param parent The parent Component\r
+     * @param ex the catched exception\r
+     */\r
+    public static void showErrorMessage(Component parent,\r
+                                       RemoteAccessException ex)\r
+    {\r
+       showErrorMessage(parent, ex, "Remote Access Error");\r
+    }\r
+\r
+    /**\r
+     * Show an error message\r
+     * @param rrw the RemoteResourceWrapper associated to this message\r
+     * @param ex the catched exception\r
+     */\r
+    public static void showErrorMessage(RemoteResourceWrapper rrw,\r
+                                       RemoteAccessException ex)\r
+    {\r
+       showErrorMessage(rrw.getServerBrowser(), ex, "Remote Access Error");\r
+    }\r
+\r
+    /**\r
+     * Show an error message\r
+     * @param parent The parent Component\r
+     * @param ex the catched exception\r
+     */\r
+    public static void showErrorMessage(Component parent,\r
+                                       Exception ex)\r
+    {\r
+       showErrorMessage(parent, ex, ex.getClass().getName());\r
+    }\r
+\r
+    /**\r
+     * Show an error message\r
+     * @param rrw the RemoteResourceWrapper associated to this message\r
+     * @param ex the catched exception\r
+     */\r
+    public static void showErrorMessage(RemoteResourceWrapper rrw,\r
+                                       Exception ex)\r
+    {\r
+       showErrorMessage(rrw.getServerBrowser(), ex, ex.getClass().getName());\r
+    }\r
+\r
+    /**\r
+     * Show a message\r
+     * @param parent The parent Component\r
+     * @param message The message to show\r
+     * @param title The dialog title\r
+     */\r
+    public static void showInformationMessage(Component parent,\r
+                                             String message,\r
+                                             String title)\r
+    {\r
+       \r
+       JOptionPane.showMessageDialog(parent, message, \r
+                                     title, JOptionPane.INFORMATION_MESSAGE);\r
+    }\r
+\r
+    /**\r
+     * Show a message\r
+     * @param rrw the RemoteResourceWrapper associated to this message\r
+     * @param message The message to show\r
+     * @param title The dialog title\r
+     */\r
+    public static void showInformationMessage(RemoteResourceWrapper rrw,\r
+                                             String message,\r
+                                             String title)\r
+    {\r
+       showInformationMessage(rrw.getServerBrowser(), message, title);\r
+    }\r
+\r
+    /**\r
+     * Show a message\r
+     * @param parent The parent Component\r
+     * @param message The message to show\r
+     */\r
+    public static void showInformationMessage(Component parent,\r
+                                             String message)\r
+    {\r
+       JOptionPane.showMessageDialog(parent, message);\r
+    }\r
+\r
+}\r