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 17 years ago
parent
commit
896afd3621

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

57
 
57
 
58
 import java.awt.Color;
58
 import java.awt.Color;
59
 import java.io.Serializable;
59
 import java.io.Serializable;
60
-import java.lang.reflect.InvocationTargetException;
61
 import java.util.ArrayList;
60
 import java.util.ArrayList;
62
 import java.util.Map;
61
 import java.util.Map;
63
 
62
 

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

41
     
41
     
42
     /** The title of our window. */
42
     /** The title of our window. */
43
     private final String title;
43
     private final String title;
44
-    
45
-    /** The server we're associated with. */
46
-    private final Server server;
47
-    
44
+       
48
     /** The window we're using. */
45
     /** The window we're using. */
49
     private final Window myWindow;
46
     private final Window myWindow;
50
     
47
     
48
+    /** Our parent window. */
49
+    private final Window parent;
50
+    
51
     /**
51
     /**
52
      * Creates a new HistoryWindow.
52
      * Creates a new HistoryWindow.
53
      *
53
      *
54
      * @param title The title of the window
54
      * @param title The title of the window
55
      * @param reader The reader to use to get the history
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
         super();
59
         super();
60
         
60
         
61
         this.title = title;
61
         this.title = title;
62
-        this.server = server;
62
+        this.parent = parent;
63
         
63
         
64
         icon = IconManager.getIconManager().getIcon("raw");
64
         icon = IconManager.getIconManager().getIcon("raw");
65
         
65
         
66
         myWindow = Main.getUI().getWindow(this);
66
         myWindow = Main.getUI().getWindow(this);
67
         
67
         
68
-        WindowManager.addWindow(server.getFrame(), myWindow);
68
+        WindowManager.addWindow(parent, myWindow);
69
         
69
         
70
         myWindow.setTitle(title);
70
         myWindow.setTitle(title);
71
         myWindow.setFrameIcon(icon);
71
         myWindow.setFrameIcon(icon);
97
     
97
     
98
     /** {@inheritDoc} */
98
     /** {@inheritDoc} */
99
     public Server getServer() {
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
 			return false;
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
 		return true;
852
 		return true;
853
 	}
853
 	}

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

86
     public static void removeWindow(final Window window) {
86
     public static void removeWindow(final Window window) {
87
         Logger.doAssertion(window != null);
87
         Logger.doAssertion(window != null);
88
         Logger.doAssertion(childWindows.containsKey(window));
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
         childWindows.remove(window);
96
         childWindows.remove(window);
92
         
97
         

Loading…
Cancel
Save