|
@@ -25,9 +25,11 @@ package com.dmdirc.ui.swing.framemanager.tree;
|
25
|
25
|
import com.dmdirc.FrameContainer;
|
26
|
26
|
import com.dmdirc.config.ConfigChangeListener;
|
27
|
27
|
import com.dmdirc.config.IdentityManager;
|
|
28
|
+import com.dmdirc.interfaces.NotificationListener;
|
28
|
29
|
import com.dmdirc.logger.ErrorLevel;
|
29
|
30
|
import com.dmdirc.logger.Logger;
|
30
|
31
|
import com.dmdirc.ui.interfaces.FrameManager;
|
|
32
|
+import com.dmdirc.ui.interfaces.Window;
|
31
|
33
|
import com.dmdirc.ui.swing.components.TreeScroller;
|
32
|
34
|
import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
|
33
|
35
|
|
|
@@ -66,14 +68,14 @@ import javax.swing.tree.TreeSelectionModel;
|
66
|
68
|
*/
|
67
|
69
|
public final class TreeFrameManager implements FrameManager, MouseListener,
|
68
|
70
|
ActionListener, MouseMotionListener, AdjustmentListener, Serializable,
|
69
|
|
- ConfigChangeListener, TreeSelectionListener {
|
|
71
|
+ ConfigChangeListener, TreeSelectionListener, NotificationListener {
|
70
|
72
|
|
71
|
73
|
/**
|
72
|
74
|
* A version number for this class. It should be changed whenever the class
|
73
|
75
|
* structure is changed (or anything else that would prevent serialized
|
74
|
76
|
* objects being unserialized with the new class).
|
75
|
77
|
*/
|
76
|
|
- private static final long serialVersionUID = 3;
|
|
78
|
+ private static final long serialVersionUID = 4;
|
77
|
79
|
|
78
|
80
|
/** display tree. */
|
79
|
81
|
private final JTree tree;
|
|
@@ -247,6 +249,7 @@ public final class TreeFrameManager implements FrameManager, MouseListener,
|
247
|
249
|
}
|
248
|
250
|
nodes.remove(window);
|
249
|
251
|
labels.remove(node);
|
|
252
|
+ window.removeNotificationListener(this);
|
250
|
253
|
}
|
251
|
254
|
}
|
252
|
255
|
|
|
@@ -265,6 +268,7 @@ public final class TreeFrameManager implements FrameManager, MouseListener,
|
265
|
268
|
tree.expandPath(new TreePath(node.getPath()).getParentPath());
|
266
|
269
|
final Rectangle view = tree.getRowBounds(tree.getRowForPath(new TreePath(node.getPath())));
|
267
|
270
|
tree.scrollRectToVisible(new Rectangle(0, (int) view.getY(), 0, 0));
|
|
271
|
+ window.addNotificationListener(this);
|
268
|
272
|
}
|
269
|
273
|
|
270
|
274
|
/** {@inheritDoc} */
|
|
@@ -446,5 +450,18 @@ public final class TreeFrameManager implements FrameManager, MouseListener,
|
446
|
450
|
((FrameContainer )((DefaultMutableTreeNode) e.getPath().
|
447
|
451
|
getLastPathComponent()).getUserObject()).activateFrame();
|
448
|
452
|
}
|
449
|
|
-
|
|
453
|
+
|
|
454
|
+ /** {@inheritDoc} */
|
|
455
|
+ @Override
|
|
456
|
+ public void notificationSet(final Window window, final Color colour) {
|
|
457
|
+ notificationColours.put(window.getContainer(), colour);
|
|
458
|
+ tree.repaint();
|
|
459
|
+ }
|
|
460
|
+
|
|
461
|
+ /** {@inheritDoc} */
|
|
462
|
+ @Override
|
|
463
|
+ public void notificationCleared(final Window window) {
|
|
464
|
+ notificationColours.remove(window.getContainer());
|
|
465
|
+ tree.repaint();
|
|
466
|
+ }
|
450
|
467
|
}
|