filebot/source/net/sourceforge/tuned/ui/notification/NotificationManager.java
Reinhard Pointner 0c674849d8 * refactored and simplified transfer api
* use more GlazedLists stuff (EventList, AutoCompleteSupport) and remove obsolete classes (SimpleListModel, TextCompletion)
* don't use SearchResultCache in EpisodeListClient (was only done for better ui interactions)
* removed caching from ResourceManager
* some improvements based on FindBugs warnings
* use args4j for improved argument parsing
* updated ant build script
* more general MessageBus/Handler (use Object as message type instead of string)
* ChecksumComputationService is not a singleton anymore
* TemporaryFolder is always recreated if it is deleted by the user, or another instance shutting down
* Notifications flicker less when one window is removed and the others are layouted
* lots of other refactoring
2008-07-30 22:37:01 +00:00

49 lines
852 B
Java

/*
* Created on 19.03.2005
*
*/
package net.sourceforge.tuned.ui.notification;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import net.sourceforge.tuned.ui.TunedUtil;
public class NotificationManager {
private final NotificationLayout layout;
public NotificationManager() {
this(new QueueNotificationLayout());
}
public NotificationManager(NotificationLayout layout) {
this.layout = layout;
}
public void show(NotificationWindow notification) {
TunedUtil.checkEventDispatchThread();
notification.addWindowListener(new RemoveListener());
layout.add(notification);
notification.setVisible(true);
}
private class RemoveListener extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
layout.remove((NotificationWindow) e.getWindow());
}
}
}