Browse Source

Logging history window is now a child of the window it's for, rather than a child of the server

The window manager now automatically removes child windows as needed

git-svn-id: http://svn.dmdirc.com/trunk@2454 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5.5
Chris Smith 16 years ago
parent
commit
896afd3621

+ 0
- 1
src/com/dmdirc/Channel.java View File

@@ -57,7 +57,6 @@ import com.dmdirc.ui.messages.Styliser;
57 57
 
58 58
 import java.awt.Color;
59 59
 import java.io.Serializable;
60
-import java.lang.reflect.InvocationTargetException;
61 60
 import java.util.ArrayList;
62 61
 import java.util.Map;
63 62
 

+ 9
- 9
src/com/dmdirc/addons/logging/HistoryWindow.java View File

@@ -41,31 +41,31 @@ public class HistoryWindow extends FrameContainer {
41 41
     
42 42
     /** The title of our window. */
43 43
     private final String title;
44
-    
45
-    /** The server we're associated with. */
46
-    private final Server server;
47
-    
44
+       
48 45
     /** The window we're using. */
49 46
     private final Window myWindow;
50 47
     
48
+    /** Our parent window. */
49
+    private final Window parent;
50
+    
51 51
     /**
52 52
      * Creates a new HistoryWindow.
53 53
      *
54 54
      * @param title The title of the window
55 55
      * @param reader The reader to use to get the history
56
-     * @param server The server we're associated with
56
+     * @param parent The window this history window was opened from
57 57
      */
58
-    public HistoryWindow(final String title, final ReverseFileReader reader, final Server server) {
58
+    public HistoryWindow(final String title, final ReverseFileReader reader, final Window parent) {
59 59
         super();
60 60
         
61 61
         this.title = title;
62
-        this.server = server;
62
+        this.parent = parent;
63 63
         
64 64
         icon = IconManager.getIconManager().getIcon("raw");
65 65
         
66 66
         myWindow = Main.getUI().getWindow(this);
67 67
         
68
-        WindowManager.addWindow(server.getFrame(), myWindow);
68
+        WindowManager.addWindow(parent, myWindow);
69 69
         
70 70
         myWindow.setTitle(title);
71 71
         myWindow.setFrameIcon(icon);
@@ -97,6 +97,6 @@ public class HistoryWindow extends FrameContainer {
97 97
     
98 98
     /** {@inheritDoc} */
99 99
     public Server getServer() {
100
-        return server;
100
+        return parent.getContainer().getServer();
101 101
     }
102 102
 }

+ 1
- 1
src/com/dmdirc/addons/logging/LoggingPlugin.java View File

@@ -847,7 +847,7 @@ public final class LoggingPlugin extends Plugin implements EventPlugin, Preferen
847 847
 			return false;
848 848
 		}
849 849
 		
850
-		new HistoryWindow("History of " + target.getContainer().toString(), reader, target.getContainer().getServer());
850
+		new HistoryWindow("History", reader, target);
851 851
 		
852 852
 		return true;
853 853
 	}

+ 6
- 1
src/com/dmdirc/ui/WindowManager.java View File

@@ -86,7 +86,12 @@ public class WindowManager {
86 86
     public static void removeWindow(final Window window) {
87 87
         Logger.doAssertion(window != null);
88 88
         Logger.doAssertion(childWindows.containsKey(window));
89
-        Logger.doAssertion(childWindows.get(window).isEmpty());
89
+        
90
+        if (!childWindows.get(window).isEmpty()) {
91
+            for (Window child : new ArrayList<Window>(childWindows.get(window))) {
92
+                removeWindow(child);
93
+            }
94
+        }
90 95
         
91 96
         childWindows.remove(window);
92 97
         

Loading…
Cancel
Save