001: // Message.java
002: // $Id: Message.java,v 1.4 2000/08/16 21:37:31 ylafon Exp $
003: // (c) COPYRIGHT MIT, INRIA and Keio, 1999.
004: // Please first read the full copyright statement in file COPYRIGHT.html
005:
006: package org.w3c.jigadmin.gui;
007:
008: import java.awt.Component;
009:
010: import javax.swing.JOptionPane;
011:
012: import org.w3c.jigsaw.admin.RemoteAccessException;
013: import org.w3c.jigadmin.RemoteResourceWrapper;
014:
015: /**
016: * Messages.
017: * @version $Revision: 1.4 $
018: * @author Benoît Mahé (bmahe@w3.org)
019: */
020: public class Message {
021:
022: /**
023: * Show an error message
024: * @param parent The parent Component
025: * @param message The message to show
026: * @param title The dialog title
027: */
028: public static void showErrorMessage(Component parent,
029: String message, String title) {
030: JOptionPane.showMessageDialog(parent, message, title,
031: JOptionPane.ERROR_MESSAGE);
032: }
033:
034: /**
035: * Show an error message
036: * @param rrw the RemoteResourceWrapper associated to this message
037: * @param message The message to show
038: * @param title The dialog title
039: */
040: public static void showErrorMessage(RemoteResourceWrapper rrw,
041: String message, String title) {
042: showErrorMessage(rrw.getServerBrowser(), message, title);
043:
044: }
045:
046: /**
047: * Show an error message
048: * @param parent The parent Component
049: * @param ex the catched exception
050: * @param title The dialog title
051: */
052: public static void showErrorMessage(Component parent, Exception ex,
053: String title) {
054: showErrorMessage(parent, ex.getMessage(), title);
055: }
056:
057: /**
058: * Show an error message
059: * @param rrw the RemoteResourceWrapper associated to this message
060: * @param ex the catched exception
061: * @param title The dialog title
062: */
063: public static void showErrorMessage(RemoteResourceWrapper rrw,
064: Exception ex, String title) {
065: showErrorMessage(rrw.getServerBrowser(), ex.getMessage(), title);
066: }
067:
068: /**
069: * Show an error message
070: * @param parent The parent Component
071: * @param ex the catched exception
072: */
073: public static void showErrorMessage(Component parent,
074: RemoteAccessException ex) {
075: showErrorMessage(parent, ex, "Remote Access Error");
076: }
077:
078: /**
079: * Show an error message
080: * @param rrw the RemoteResourceWrapper associated to this message
081: * @param ex the catched exception
082: */
083: public static void showErrorMessage(RemoteResourceWrapper rrw,
084: RemoteAccessException ex) {
085: showErrorMessage(rrw.getServerBrowser(), ex,
086: "Remote Access Error");
087: }
088:
089: /**
090: * Show an error message
091: * @param parent The parent Component
092: * @param ex the catched exception
093: */
094: public static void showErrorMessage(Component parent, Exception ex) {
095: showErrorMessage(parent, ex, ex.getClass().getName());
096: }
097:
098: /**
099: * Show an error message
100: * @param rrw the RemoteResourceWrapper associated to this message
101: * @param ex the catched exception
102: */
103: public static void showErrorMessage(RemoteResourceWrapper rrw,
104: Exception ex) {
105: showErrorMessage(rrw.getServerBrowser(), ex, ex.getClass()
106: .getName());
107: }
108:
109: /**
110: * Show a message
111: * @param parent The parent Component
112: * @param message The message to show
113: * @param title The dialog title
114: */
115: public static void showInformationMessage(Component parent,
116: String message, String title) {
117:
118: JOptionPane.showMessageDialog(parent, message, title,
119: JOptionPane.INFORMATION_MESSAGE);
120: }
121:
122: /**
123: * Show a message
124: * @param rrw the RemoteResourceWrapper associated to this message
125: * @param message The message to show
126: * @param title The dialog title
127: */
128: public static void showInformationMessage(
129: RemoteResourceWrapper rrw, String message, String title) {
130: showInformationMessage(rrw.getServerBrowser(), message, title);
131: }
132:
133: /**
134: * Show a message
135: * @param parent The parent Component
136: * @param message The message to show
137: */
138: public static void showInformationMessage(Component parent,
139: String message) {
140: JOptionPane.showMessageDialog(parent, message);
141: }
142:
143: }
|