1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-11 03:45:06 -05:00
filebot/source/net/sourceforge/tuned/ui/notification/NotificationManager.java
Reinhard Pointner b5bee237d6 * refactored matching
* added ProgressDialog for long-running matching
* added delayed invokeLater to TunedUtil
* removed generics from ListEntry (only subclasses where used anyway)
* minor cleanup in notification package
2008-04-27 17:36:27 +00:00

67 lines
1.1 KiB
Java

/*
* Created on 19.03.2005
*
*/
package net.sourceforge.tuned.ui.notification;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
public class NotificationManager {
private NotificationLayout layout;
public NotificationManager() {
this(new QueueNotificationLayout());
}
public NotificationManager(NotificationLayout layout) {
setLayoutManager(layout);
}
public void setLayoutManager(NotificationLayout layout) {
this.layout = layout;
}
public NotificationLayout getLayoutManager() {
return layout;
}
public void show(NotificationWindow notification) {
if (layout == null)
return;
notification.addComponentListener(new RemoveListener(layout));
layout.add(notification);
notification.setVisible(true);
}
private static class RemoveListener extends ComponentAdapter {
private NotificationLayout layout;
public RemoveListener(NotificationLayout layout) {
this.layout = layout;
}
@Override
public void componentHidden(ComponentEvent e) {
NotificationWindow window = (NotificationWindow) e.getSource();
layout.remove(window);
window.dispose();
}
}
}