瀏覽代碼

Update plugins with new window closing logic

Change-Id: I97f44a9269288f876a7a71b412302cec4238d9d4
Depends-On: I4ea9fbf6c939a5b16f15ade230255b948e210c2c
Reviewed-on: http://gerrit.dmdirc.com/1601
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.5
Chris Smith 13 年之前
父節點
當前提交
26e8e36006

+ 0
- 7
src/com/dmdirc/addons/dcc/DCCFrameContainer.java 查看文件

@@ -110,17 +110,10 @@ public abstract class DCCFrameContainer<T extends InputWindow> extends WritableF
110 110
     public void windowClosing() {
111 111
         windowClosing = true;
112 112
 
113
-        // 1: Make the window non-visible
114
-        for (Window window : getWindows()) {
115
-            window.setVisible(false);
116
-        }
117
-
118 113
         // 2: Remove any callbacks or listeners
119 114
         // 3: Trigger any actions neccessary
120 115
         // 4: Trigger action for the window closing
121 116
         // 5: Inform any parents that the window is closing
122
-        // 6: Remove the window from the window manager
123
-        WindowManager.removeWindow(this);
124 117
     }
125 118
 
126 119
     /** {@inheritDoc} */

+ 0
- 8
src/com/dmdirc/addons/dcc/PlaceholderContainer.java 查看文件

@@ -107,19 +107,11 @@ public class PlaceholderContainer extends FrameContainer<PlaceholderWindow> {
107 107
     /** {@inheritDoc} */
108 108
     @Override
109 109
     public void windowClosing() {
110
-        // 1: Make the window non-visible
111
-        for (Window window : getWindows()) {
112
-            window.setVisible(false);
113
-        }
114
-
115 110
         // 2: Remove any callbacks or listeners
116 111
         // 3: Trigger any actions neccessary
117 112
         // 4: Trigger action for the window closing
118 113
         // 5: Inform any parents that the window is closing
119 114
         plugin.removeContainer();
120
-
121
-        // 6: Remove the window from the window manager
122
-        WindowManager.removeWindow(this);
123 115
     }
124 116
 
125 117
     /** {@inheritDoc} */

+ 0
- 7
src/com/dmdirc/addons/dcc/TransferContainer.java 查看文件

@@ -344,19 +344,12 @@ public class TransferContainer extends FrameContainer<TransferWindow> implements
344 344
     public void windowClosing() {
345 345
         windowClosing = true;
346 346
 
347
-        // 1: Make the window non-visible
348
-        for (Window window : getWindows()) {
349
-            window.setVisible(false);
350
-        }
351
-
352 347
         // 2: Remove any callbacks or listeners
353 348
         // 3: Trigger any actions neccessary
354 349
         dcc.removeFromTransfers();
355 350
         
356 351
         // 4: Trigger action for the window closing
357 352
         // 5: Inform any parents that the window is closing
358
-        // 6: Remove the window from the window manager
359
-        WindowManager.removeWindow(this);
360 353
     }
361 354
 
362 355
     /** {@inheritDoc} */

+ 0
- 8
src/com/dmdirc/addons/logging/HistoryWindow.java 查看文件

@@ -57,18 +57,10 @@ public class HistoryWindow extends FrameContainer<Window> {
57 57
     /** {@inheritDoc} */
58 58
     @Override
59 59
     public void windowClosing() {
60
-        // 1: Make the window non-visible
61
-        for (Window window : getWindows()) {
62
-            window.setVisible(false);
63
-        }
64
-
65 60
         // 2: Remove any callbacks or listeners
66 61
         // 3: Trigger any actions neccessary
67 62
         // 4: Trigger action for the window closing
68 63
         // 5: Inform any parents that the window is closing
69
-
70
-        // 6: Remove the window from the window manager
71
-        WindowManager.removeWindow(this);
72 64
     }
73 65
 
74 66
     /** {@inheritDoc} */

+ 5
- 13
src/com/dmdirc/addons/parserdebug/DebugWindow.java 查看文件

@@ -42,7 +42,7 @@ public class DebugWindow extends FrameContainer<Window> {
42 42
     protected Parser parser;
43 43
     /** The Server window we are a child of */
44 44
     protected Server server;
45
-    
45
+
46 46
     /**
47 47
      * Creates a new instance of DebugWindow.
48 48
      *
@@ -59,7 +59,7 @@ public class DebugWindow extends FrameContainer<Window> {
59 59
 
60 60
         WindowManager.addWindow(server, this);
61 61
     }
62
-       
62
+
63 63
     /**
64 64
      * Returns the server instance associated with this container.
65 65
      *
@@ -69,7 +69,7 @@ public class DebugWindow extends FrameContainer<Window> {
69 69
     public Server getServer() {
70 70
         return server;
71 71
     }
72
-    
72
+
73 73
     /**
74 74
      * Set the parser to null to stop us holding onto parsers when the server
75 75
      * connection is closed.
@@ -79,29 +79,21 @@ public class DebugWindow extends FrameContainer<Window> {
79 79
         addLine("Unset parser: "+parser, true);
80 80
         parser = null;
81 81
     }
82
-    
82
+
83 83
 
84 84
     /**
85 85
      * Closes this container (and it's associated frame).
86 86
      */
87 87
     @Override
88 88
     public void windowClosing() {
89
-        // 1: Make the window non-visible
90
-        for (Window window : getWindows()) {
91
-            window.setVisible(false);
92
-        }
93
-        
94 89
         // 2: Remove any callbacks or listeners
95 90
         if (parser != null) {
96 91
             parser.getCallbackManager().delCallback(DebugInfoListener.class, plugin);
97 92
         }
98
-        
93
+
99 94
         // 3: Trigger any actions neccessary
100 95
         // 4: Trigger action for the window closing
101 96
         // 5: Inform any parents that the window is closing
102
-        
103
-        // 6: Remove the window from the window manager
104
-        WindowManager.removeWindow(this);
105 97
     }
106 98
 
107 99
     /** {@inheritDoc} */

+ 2
- 1
src/com/dmdirc/addons/ui_dummy/DummyInputWindow.java 查看文件

@@ -127,6 +127,7 @@ public class DummyInputWindow implements InputWindow {
127 127
 
128 128
     /** {@inheritDoc} */
129 129
     @Override
130
+    @Deprecated
130 131
     public void setVisible(final boolean isVisible) {
131 132
         visible = isVisible;
132 133
     }
@@ -176,7 +177,7 @@ public class DummyInputWindow implements InputWindow {
176 177
     /** {@inheritDoc} */
177 178
     @Override
178 179
     public void close() {
179
-        container.windowClosing();
180
+        container.handleWindowClosing();
180 181
     }
181 182
 
182 183
     /** {@inheritDoc} */

+ 11
- 2
src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java 查看文件

@@ -53,6 +53,7 @@ import com.dmdirc.commandparser.parsers.CommandParser;
53 53
 import com.dmdirc.commandparser.parsers.GlobalCommandParser;
54 54
 import com.dmdirc.config.ConfigManager;
55 55
 import com.dmdirc.interfaces.ConfigChangeListener;
56
+import com.dmdirc.interfaces.FrameCloseListener;
56 57
 import com.dmdirc.interfaces.FrameInfoListener;
57 58
 import com.dmdirc.logger.ErrorLevel;
58 59
 import com.dmdirc.logger.Logger;
@@ -102,7 +103,7 @@ import net.miginfocom.swing.MigLayout;
102 103
  */
103 104
 public abstract class TextFrame extends JInternalFrame implements Window,
104 105
         PropertyChangeListener, InternalFrameListener, ConfigChangeListener,
105
-        FrameInfoListener, TextPaneListener {
106
+        FrameInfoListener, TextPaneListener, FrameCloseListener {
106 107
 
107 108
     /** Logger to use. */
108 109
     private static final java.util.logging.Logger LOGGER =
@@ -149,6 +150,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
149 150
         setFrameIcon(IconManager.getIconManager().getIcon(owner.getIcon()));
150 151
 
151 152
         owner.addFrameInfoListener(this);
153
+        owner.addCloseListener(this);
152 154
         owner.setTitle(frameParent.getTitle());
153 155
 
154 156
         try {
@@ -251,6 +253,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
251 253
 
252 254
     /** {@inheritDoc} */
253 255
     @Override
256
+    @Deprecated
254 257
     public void setVisible(final boolean isVisible) {
255 258
         UIUtilities.invokeLater(new Runnable() {
256 259
 
@@ -668,7 +671,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
668 671
             /** {@inheritDoc} */
669 672
             @Override
670 673
             protected Object doInBackground() {
671
-                frameParent.windowClosing();
674
+                frameParent.handleWindowClosing();
672 675
                 return null;
673 676
             }
674 677
         }.executeInExecutor();
@@ -1058,6 +1061,12 @@ public abstract class TextFrame extends JInternalFrame implements Window,
1058 1061
         });
1059 1062
     }
1060 1063
 
1064
+    /** {@inheritDoc} */
1065
+    @Override
1066
+    public void windowClosing(final FrameContainer<?> window) {
1067
+        setVisible(false);
1068
+    }
1069
+
1061 1070
     /** {@inheritDoc} */
1062 1071
     @Override
1063 1072
     public SwingController getController() {

+ 2
- 0
src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java 查看文件

@@ -148,12 +148,14 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
148 148
 
149 149
     /** {@inheritDoc} */
150 150
     @Override
151
+    @Deprecated
151 152
     public boolean isVisible() {
152 153
         return true;
153 154
     }
154 155
 
155 156
     /** {@inheritDoc} */
156 157
     @Override
158
+    @Deprecated
157 159
     public void setVisible(boolean isVisible) {
158 160
         // Do nothing
159 161
     }

Loading…
取消
儲存