Browse Source

Deprecate windowClosed and windowClosing methods.

These are a hold-over from when the core had to have a back-and-forth with
the UI in order to close a window.

Provide stub implementations in FrameContainer, deprecate them, and remove
any unecessary overrides in the core.

Change-Id: Icf9bfc6bc40b66135d161a5047d01d46b2171234
Reviewed-on: http://gerrit.dmdirc.com/3008
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.8rc1
Chris Smith 10 years ago
parent
commit
48af85945c

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

@@ -341,11 +341,6 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
341 341
         server.delChannel(channelInfo.getName());
342 342
     }
343 343
 
344
-    /** {@inheritDoc} */
345
-    @Override
346
-    public void windowClosed() {
347
-    }
348
-
349 344
     /**
350 345
      * Called every {general.whotime} seconds to check if the channel needs
351 346
      * to send a who request.

+ 0
- 15
src/com/dmdirc/CustomWindow.java View File

@@ -59,21 +59,6 @@ public class CustomWindow extends FrameContainer {
59 59
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier()));
60 60
     }
61 61
 
62
-    /** {@inheritDoc} */
63
-    @Override
64
-    public void windowClosing() {
65
-        // 2: Remove any callbacks or listeners
66
-        // 3: Trigger any actions neccessary
67
-        // 4: Trigger action for the window closing
68
-        // 5: Inform any parents that the window is closing
69
-    }
70
-
71
-    /** {@inheritDoc} */
72
-    @Override
73
-    public void windowClosed() {
74
-        // 7: Remove any references to the window and parents
75
-    }
76
-
77 62
     /** {@inheritDoc} */
78 63
     @Override
79 64
     public Connection getConnection() {

+ 10
- 21
src/com/dmdirc/FrameContainer.java View File

@@ -402,7 +402,6 @@ public abstract class FrameContainer {
402 402
      * <p>
403 403
      * Frame containers must perform the following actions in this order:
404 404
      * <ol>
405
-     *  <li>Make the window non-visible (so it appears 'closed' to the user)</li>
406 405
      *  <li>Remove any callbacks or listeners (events should not be processed
407 406
      *      once a window has been requested to close)</li>
408 407
      *  <li>Trigger any actions necessary (terminating any TCP connections,
@@ -412,27 +411,13 @@ public abstract class FrameContainer {
412 411
      *  <li>Inform any parents that the window is closing (this includes
413 412
      *      unregistering the window with any specific managers, or from the
414 413
      *      parent windows if they track children)</li>
415
-     *  <li>Remove the window from the window manager (by calling
416
-     *      {@link WindowManager#removeWindow(com.dmdirc.FrameContainer)}</li>
417 414
      * </ol>
418
-     * <p>
419
-     * <strong>NB:</strong> As of DMDirc 0.6.5, points 1 and 6 (making windows
420
-     * non-visible and removing the window from the window manager) are handled
421
-     * by the caller of this method, and should <strong>not</strong> be
422
-     * implemented by subclasses.
423
-     * </p>
424
-     * <p>
425
-     * While resources may be relinquished in step three, references MUST NOT
426
-     * be removed yet. That is, if a window holds a resource, the resource may
427
-     * be closed, but the relevant object MUST still be available for
428
-     * interrogation at the end of this method.
429
-     * <p>
430
-     * This behaviour is required so that parties receiving windowDeleted events
431
-     * from the WindowManager may inspect the closing window and perform actions
432
-     * on its frame, parser, etc. The resources should be completely freed in
433
-     * the {@link #windowClosed()} method.
415
+     *
416
+     * @deprecated Clearing up should be performed in the {@link #close()} method.
434 417
      */
435
-    protected abstract void windowClosing();
418
+    @Deprecated
419
+    protected void windowClosing() {
420
+    }
436 421
 
437 422
     /**
438 423
      * Invoked when our window has been closed.
@@ -440,8 +425,12 @@ public abstract class FrameContainer {
440 425
      * At this point, all interested parties have been told that the window
441 426
      * has been closed, and therefore any references to frames or other
442 427
      * resources may be completely freed.
428
+     *
429
+     * @deprecated Clearing up should be performed in the {@link #close()} method.
443 430
      */
444
-    public abstract void windowClosed();
431
+    @Deprecated
432
+    public void windowClosed() {
433
+    }
445 434
 
446 435
     /**
447 436
      * Adds a line to this container's window. If the window is null for some

+ 0
- 9
src/com/dmdirc/GlobalWindow.java View File

@@ -77,15 +77,6 @@ public class GlobalWindow extends WritableFrameContainer {
77 77
         return tabCompleter;
78 78
     }
79 79
 
80
-    /** {@inheritDoc} */
81
-    @Override
82
-    public void windowClosing() {
83
-        // 2: Remove any callbacks or listeners
84
-        // 3: Trigger any actions neccessary
85
-        // 4: Trigger action for the window closing
86
-        // 5: Inform any parents that the window is closing
87
-    }
88
-
89 80
     /** {@inheritDoc} */
90 81
     @Override
91 82
     public void windowClosed() {

+ 1
- 8
src/com/dmdirc/Query.java View File

@@ -63,7 +63,7 @@ public class Query extends MessageTarget implements PrivateActionListener,
63 63
         CompositionStateChangeListener {
64 64
 
65 65
     /** The Server this Query is on. */
66
-    private Server server;
66
+    private final Server server;
67 67
 
68 68
     /** The full host and nickname of the client associated with this Query. */
69 69
     private String host, nickname;
@@ -340,13 +340,6 @@ public class Query extends MessageTarget implements PrivateActionListener,
340 340
         }
341 341
     }
342 342
 
343
-    /** {@inheritDoc} */
344
-    @Override
345
-    public void windowClosed() {
346
-        // 7: Remove any references to the window and parents
347
-        server = null;
348
-    }
349
-
350 343
     /**
351 344
      * Returns the host that this query is with.
352 345
      *

+ 1
- 8
src/com/dmdirc/Raw.java View File

@@ -49,7 +49,7 @@ public class Raw extends WritableFrameContainer
49 49
         implements DataInListener, DataOutListener {
50 50
 
51 51
     /** The server object that's being monitored. */
52
-    private Server server;
52
+    private final Server server;
53 53
 
54 54
     /**
55 55
      * Creates a new instance of Raw.
@@ -101,13 +101,6 @@ public class Raw extends WritableFrameContainer
101 101
         server.delRaw();
102 102
     }
103 103
 
104
-    /** {@inheritDoc} */
105
-    @Override
106
-    public void windowClosed() {
107
-        // 7: Remove any references to the window and parents
108
-        server = null;
109
-    }
110
-
111 104
     /** {@inheritDoc} */
112 105
     @Override
113 106
     public void onDataIn(final Parser parser, final Date date, final String data) {

+ 0
- 10
test/com/dmdirc/harness/TestWritableFrameContainer.java View File

@@ -59,16 +59,6 @@ public class TestWritableFrameContainer extends WritableFrameContainer {
59 59
         return lineLength;
60 60
     }
61 61
 
62
-    @Override
63
-    public void windowClosing() {
64
-        // Do nothing
65
-    }
66
-
67
-    @Override
68
-    public void windowClosed() {
69
-        // Do nothing
70
-    }
71
-
72 62
     @Override
73 63
     public Connection getConnection() {
74 64
         return null;

Loading…
Cancel
Save