Explorar el Código

Change popout handling.

Change-Id: I78acf0de7fab0f34719115a01b9a48525848f2d0
Reviewed-on: http://gerrit.dmdirc.com/3810
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
changes/10/3810/2
Greg Holmes hace 9 años
padre
commit
e290d41cb2

+ 1
- 26
src/com/dmdirc/addons/ui_swing/components/frames/DesktopWindowFrame.java Ver fichero

@@ -22,16 +22,11 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components.frames;
24 24
 
25
-import com.dmdirc.FrameContainer;
26 25
 import com.dmdirc.addons.ui_swing.EdtHandlerInvocation;
27
-import com.dmdirc.addons.ui_swing.UIUtilities;
28 26
 import com.dmdirc.events.FrameIconChangedEvent;
29 27
 import com.dmdirc.events.FrameTitleChangedEvent;
30
-import com.dmdirc.interfaces.FrameCloseListener;
31 28
 
32 29
 import java.awt.Point;
33
-import java.awt.event.WindowAdapter;
34
-import java.awt.event.WindowEvent;
35 30
 
36 31
 import javax.swing.JFrame;
37 32
 
@@ -43,7 +38,7 @@ import net.engio.mbassy.listener.Invoke;
43 38
 /**
44 39
  * Frame that contains popped out windows
45 40
  */
46
-public class DesktopWindowFrame extends JFrame implements FrameCloseListener {
41
+public class DesktopWindowFrame extends JFrame {
47 42
 
48 43
     /** A version number for this class. */
49 44
     private static final long serialVersionUID = 1;
@@ -61,15 +56,6 @@ public class DesktopWindowFrame extends JFrame implements FrameCloseListener {
61 56
         this.windowWindow = windowWindow;
62 57
         initialLocation = windowWindow.getLocationOnScreen();
63 58
 
64
-        addWindowListener(new WindowAdapter() {
65
-
66
-            @Override
67
-            public void windowClosing(final WindowEvent e) {
68
-                windowWindow.setPopout(false);
69
-            }
70
-        });
71
-        windowWindow.getContainer().addCloseListener(this);
72
-
73 59
         setLayout(new MigLayout("fill, ins rel"));
74 60
         add(windowWindow, "grow");
75 61
         setPreferredSize(windowWindow.getSize());
@@ -87,17 +73,6 @@ public class DesktopWindowFrame extends JFrame implements FrameCloseListener {
87 73
         setLocation(initialLocation);
88 74
     }
89 75
 
90
-    @Override
91
-    public void windowClosing(final FrameContainer window) {
92
-        UIUtilities.invokeLater(new Runnable() {
93
-
94
-            @Override
95
-            public void run() {
96
-                windowWindow.setPopout(false);
97
-            }
98
-        });
99
-    }
100
-
101 76
     @Handler(invocation = EdtHandlerInvocation.class, delivery = Invoke.Asynchronously)
102 77
     public void iconChanged(final FrameIconChangedEvent event) {
103 78
         if (event.getContainer().equals(windowWindow.getContainer())) {

+ 12
- 0
src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java Ver fichero

@@ -69,6 +69,8 @@ import java.awt.Window;
69 69
 import java.awt.datatransfer.Clipboard;
70 70
 import java.awt.event.KeyEvent;
71 71
 import java.awt.event.MouseEvent;
72
+import java.awt.event.WindowAdapter;
73
+import java.awt.event.WindowEvent;
72 74
 
73 75
 import javax.inject.Inject;
74 76
 import javax.inject.Provider;
@@ -167,6 +169,13 @@ public abstract class TextFrame extends JPanel implements com.dmdirc.interfaces.
167 169
             popoutPlaceholder = new DesktopPlaceHolderFrame();
168 170
             popoutFrame = new DesktopWindowFrame(this);
169 171
             eventBus.subscribe(popoutFrame);
172
+            popoutFrame.addWindowListener(new WindowAdapter() {
173
+
174
+                @Override
175
+                public void windowClosing(final WindowEvent e) {
176
+                    setPopout(false);
177
+                }
178
+            });
170 179
             popoutFrame.display();
171 180
         } else if (popoutFrame != null) {
172 181
             popoutPlaceholder = null;
@@ -496,6 +505,9 @@ public abstract class TextFrame extends JPanel implements com.dmdirc.interfaces.
496 505
 
497 506
             @Override
498 507
             public void run() {
508
+                if (popout) {
509
+                    setPopout(false);
510
+                }
499 511
                 setVisible(false);
500 512
                 getTextPane().close();
501 513
             }

Loading…
Cancelar
Guardar