1 /*
2  * aTunes
3  * Copyright (C) Alex Aranda, Sylvain Gaudard and contributors
4  *
5  * See http://www.atunes.org/wiki/index.php?title=Contributing for information about contributors
6  *
7  * http://www.atunes.org
8  * http://sourceforge.net/projects/atunes
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  */
20 
21 package net.sourceforge.atunes.gui.views.dialogs;
22 
23 import java.awt.Component;
24 
25 import javax.swing.JOptionPane;
26 
27 import net.sourceforge.atunes.gui.GuiUtils;
28 import net.sourceforge.atunes.model.IErrorDialog;
29 import net.sourceforge.atunes.model.IFrame;
30 import net.sourceforge.atunes.utils.I18nUtils;
31 
32 /**
33  * Shows different types of error messages
34  * @author alex
35  *
36  */
37 public class ErrorDialog implements IErrorDialog {
38 
39 	private IFrame frame;
40 
41 	/**
42 	 * @param frame
43 	 */
setFrame(IFrame frame)44 	public void setFrame(IFrame frame) {
45 		this.frame = frame;
46 	}
47 
48     @Override
showErrorDialog(final String message)49 	public void showErrorDialog(final String message) {
50     	GuiUtils.callInEventDispatchThread(new ShowMessageDialogRunnable(message, frame));
51     }
52 
53     @Override
showErrorDialog(String message, Component parent)54 	public void showErrorDialog(String message, Component parent) {
55         JOptionPane.showMessageDialog(parent, message, I18nUtils.getString("ERROR"), JOptionPane.ERROR_MESSAGE);
56     }
57 
58     @Override
initialize()59     public void initialize() {
60     	// Do nothing
61     }
62 
63     @Override
hideDialog()64     public void hideDialog() {
65     	throw new UnsupportedOperationException();
66     }
67 
68     @Override
showDialog()69     public void showDialog() {
70     	throw new UnsupportedOperationException();
71     }
72 
73 	@Override
74 	@Deprecated
setTitle(String title)75 	public void setTitle(String title) {
76 		// Not used
77 	}
78 }
79