2007-12-23 19:28:04 +00:00
|
|
|
/*
|
|
|
|
* Created on 19.03.2005
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
package net.sourceforge.tuned.ui.notification;
|
|
|
|
|
|
|
|
|
2008-07-30 22:37:01 +00:00
|
|
|
import java.awt.event.WindowAdapter;
|
|
|
|
import java.awt.event.WindowEvent;
|
|
|
|
|
2009-01-25 00:08:57 +00:00
|
|
|
import net.sourceforge.tuned.ui.TunedUtilities;
|
2007-12-23 19:28:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
public class NotificationManager {
|
|
|
|
|
2008-07-30 22:37:01 +00:00
|
|
|
private final NotificationLayout layout;
|
2007-12-23 19:28:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
public NotificationManager() {
|
|
|
|
this(new QueueNotificationLayout());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public NotificationManager(NotificationLayout layout) {
|
|
|
|
this.layout = layout;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void show(NotificationWindow notification) {
|
2009-01-25 00:08:57 +00:00
|
|
|
TunedUtilities.checkEventDispatchThread();
|
2007-12-23 19:28:04 +00:00
|
|
|
|
2008-07-30 22:37:01 +00:00
|
|
|
notification.addWindowListener(new RemoveListener());
|
2007-12-23 19:28:04 +00:00
|
|
|
layout.add(notification);
|
2008-07-30 22:37:01 +00:00
|
|
|
|
2007-12-23 19:28:04 +00:00
|
|
|
notification.setVisible(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-30 22:37:01 +00:00
|
|
|
private class RemoveListener extends WindowAdapter {
|
2007-12-23 19:28:04 +00:00
|
|
|
|
2008-04-27 17:36:27 +00:00
|
|
|
@Override
|
2008-07-30 22:37:01 +00:00
|
|
|
public void windowClosing(WindowEvent e) {
|
|
|
|
layout.remove((NotificationWindow) e.getWindow());
|
2007-12-23 19:28:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|