Browse Source

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 years ago
parent
commit
26e8e36006

+ 0
- 7
src/com/dmdirc/addons/dcc/DCCFrameContainer.java View File

110
     public void windowClosing() {
110
     public void windowClosing() {
111
         windowClosing = true;
111
         windowClosing = true;
112
 
112
 
113
-        // 1: Make the window non-visible
114
-        for (Window window : getWindows()) {
115
-            window.setVisible(false);
116
-        }
117
-
118
         // 2: Remove any callbacks or listeners
113
         // 2: Remove any callbacks or listeners
119
         // 3: Trigger any actions neccessary
114
         // 3: Trigger any actions neccessary
120
         // 4: Trigger action for the window closing
115
         // 4: Trigger action for the window closing
121
         // 5: Inform any parents that the window is closing
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
     /** {@inheritDoc} */
119
     /** {@inheritDoc} */

+ 0
- 8
src/com/dmdirc/addons/dcc/PlaceholderContainer.java View File

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

+ 0
- 7
src/com/dmdirc/addons/dcc/TransferContainer.java View File

344
     public void windowClosing() {
344
     public void windowClosing() {
345
         windowClosing = true;
345
         windowClosing = true;
346
 
346
 
347
-        // 1: Make the window non-visible
348
-        for (Window window : getWindows()) {
349
-            window.setVisible(false);
350
-        }
351
-
352
         // 2: Remove any callbacks or listeners
347
         // 2: Remove any callbacks or listeners
353
         // 3: Trigger any actions neccessary
348
         // 3: Trigger any actions neccessary
354
         dcc.removeFromTransfers();
349
         dcc.removeFromTransfers();
355
         
350
         
356
         // 4: Trigger action for the window closing
351
         // 4: Trigger action for the window closing
357
         // 5: Inform any parents that the window is closing
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
     /** {@inheritDoc} */
355
     /** {@inheritDoc} */

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

57
     /** {@inheritDoc} */
57
     /** {@inheritDoc} */
58
     @Override
58
     @Override
59
     public void windowClosing() {
59
     public void windowClosing() {
60
-        // 1: Make the window non-visible
61
-        for (Window window : getWindows()) {
62
-            window.setVisible(false);
63
-        }
64
-
65
         // 2: Remove any callbacks or listeners
60
         // 2: Remove any callbacks or listeners
66
         // 3: Trigger any actions neccessary
61
         // 3: Trigger any actions neccessary
67
         // 4: Trigger action for the window closing
62
         // 4: Trigger action for the window closing
68
         // 5: Inform any parents that the window is closing
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
     /** {@inheritDoc} */
66
     /** {@inheritDoc} */

+ 5
- 13
src/com/dmdirc/addons/parserdebug/DebugWindow.java View File

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

+ 2
- 1
src/com/dmdirc/addons/ui_dummy/DummyInputWindow.java View File

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

+ 11
- 2
src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java View File

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

+ 2
- 0
src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java View File

148
 
148
 
149
     /** {@inheritDoc} */
149
     /** {@inheritDoc} */
150
     @Override
150
     @Override
151
+    @Deprecated
151
     public boolean isVisible() {
152
     public boolean isVisible() {
152
         return true;
153
         return true;
153
     }
154
     }
154
 
155
 
155
     /** {@inheritDoc} */
156
     /** {@inheritDoc} */
156
     @Override
157
     @Override
158
+    @Deprecated
157
     public void setVisible(boolean isVisible) {
159
     public void setVisible(boolean isVisible) {
158
         // Do nothing
160
         // Do nothing
159
     }
161
     }

Loading…
Cancel
Save