Browse Source

some work on issue 617

git-svn-id: http://svn.dmdirc.com/trunk@3116 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Gregory Holmes 16 years ago
parent
commit
27b2fe0fc0

+ 0
- 10
src/com/dmdirc/ui/dummy/DummyMainWindow.java View File

@@ -54,16 +54,6 @@ public final class DummyMainWindow implements MainWindow {
54 54
         //Do nothing.
55 55
     }
56 56
     
57
-    /** {@inheritDoc} */
58
-    public void addChild(final Window window) {
59
-        windows.add(window);
60
-    }
61
-    
62
-    /** {@inheritDoc} */
63
-    public void delChild(final Window window) {
64
-        windows.add(window);
65
-    }
66
-    
67 57
     /** {@inheritDoc} */
68 58
     public void setActiveFrame(final Window frame) {
69 59
         active = frame;

+ 0
- 14
src/com/dmdirc/ui/interfaces/MainWindow.java View File

@@ -30,20 +30,6 @@ import javax.swing.JMenuItem;
30 30
  */
31 31
 public interface MainWindow {
32 32
     
33
-    /**
34
-     * Adds the specified window as a child of the main frame.
35
-     *
36
-     * @param window the window to be added
37
-     */
38
-    void addChild(final Window window);
39
-    
40
-    /**
41
-     * Removes the specified window from our desktop pane.
42
-     *
43
-     * @param window The window to be removed
44
-     */
45
-    void delChild(final Window window);
46
-    
47 33
     /**
48 34
      * Sets the active internal frame to the one specified.
49 35
      *

+ 93
- 37
src/com/dmdirc/ui/swing/MainFrame.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.ui.swing;
24 24
 
25
+import com.dmdirc.FrameContainer;
25 26
 import com.dmdirc.IconManager;
26 27
 import com.dmdirc.Main;
27 28
 import com.dmdirc.ServerManager;
@@ -78,7 +79,7 @@ import javax.swing.WindowConstants;
78 79
  * The main application frame.
79 80
  */
80 81
 public final class MainFrame extends JFrame implements WindowListener,
81
-        MainWindow, ConfigChangeListener {
82
+        MainWindow, ConfigChangeListener, FrameManager {
82 83
 
83 84
     /**
84 85
      * A version number for this class. It should be changed whenever the class
@@ -173,42 +174,6 @@ public final class MainFrame extends JFrame implements WindowListener,
173 174
         });
174 175
     }
175 176
 
176
-    /** {@inheritDoc}. */
177
-    @Override
178
-    public void addChild(final Window window) {
179
-        final JInternalFrame frame = (JInternalFrame) window;
180
-
181
-        // Add the frame
182
-        desktopPane.add(frame);
183
-
184
-        // Make sure it'll fit with our offsets
185
-        if (frame.getWidth() + xOffset > desktopPane.getWidth()) {
186
-            xOffset = 0;
187
-        }
188
-        if (frame.getHeight() + yOffset > desktopPane.getHeight()) {
189
-            yOffset = 0;
190
-        }
191
-
192
-        // Position the frame
193
-        frame.setLocation(xOffset, yOffset);
194
-        frame.moveToFront();
195
-
196
-        // Increase the offsets
197
-        xOffset += FRAME_OPENING_OFFSET;
198
-        yOffset += FRAME_OPENING_OFFSET;
199
-    }
200
-
201
-    /** {@inheritDoc}. */
202
-    @Override
203
-    public void delChild(final Window window) {
204
-        if (desktopPane.getAllFrames().length == 1) {
205
-            setTitle(getTitlePrefix());
206
-        } else {
207
-            setActiveFrame((Window) desktopPane.selectFrame(true));
208
-        }
209
-        desktopPane.remove((JInternalFrame) window);
210
-    }
211
-
212 177
     /** {@inheritDoc}. */
213 178
     @Override
214 179
     public void setActiveFrame(final Window frame) {
@@ -391,6 +356,7 @@ public final class MainFrame extends JFrame implements WindowListener,
391 356
         frameManager.setParent(frameManagerPanel);
392 357
 
393 358
         WindowManager.addFrameManager(new CtrlTabFrameManager(desktopPane));
359
+        WindowManager.addFrameManager(this);
394 360
     }
395 361
 
396 362
     /**
@@ -631,4 +597,94 @@ public final class MainFrame extends JFrame implements WindowListener,
631 597
                 IdentityManager.getGlobalConfig().
632 598
                 getOptionBool("ui", "showversion", false);
633 599
     }
600
+
601
+    /** {@inheritDoc}. */
602
+    @Override
603
+    public void setParent(final JComponent parent) {
604
+        //Ignore
605
+    }
606
+
607
+    /** {@inheritDoc}. */
608
+    @Override
609
+    public boolean canPositionVertically() {
610
+        return true;
611
+    }
612
+
613
+    /** {@inheritDoc}. */
614
+    @Override
615
+    public boolean canPositionHorizontally() {
616
+        return true;
617
+    }
618
+
619
+    /** {@inheritDoc}. */
620
+    @Override
621
+    public void setSelected(final FrameContainer source) {
622
+        //Ignore
623
+    }
624
+
625
+    /** {@inheritDoc}. */
626
+    @Override
627
+    public void showNotification(final FrameContainer source, final Color colour) {
628
+        //Ignore
629
+    }
630
+
631
+    /** {@inheritDoc}. */
632
+    @Override
633
+    public void clearNotification(final FrameContainer source) {
634
+        //Ignore
635
+    }
636
+
637
+    /** {@inheritDoc}. */
638
+    @Override
639
+    public void addWindow(final FrameContainer window) {
640
+        final JInternalFrame frame = (JInternalFrame) window.getFrame();
641
+
642
+        // Add the frame
643
+        desktopPane.add(frame);
644
+
645
+        // Make sure it'll fit with our offsets
646
+        if (frame.getWidth() + xOffset > desktopPane.getWidth()) {
647
+            xOffset = 0;
648
+        }
649
+        if (frame.getHeight() + yOffset > desktopPane.getHeight()) {
650
+            yOffset = 0;
651
+        }
652
+
653
+        // Position the frame
654
+        frame.setLocation(xOffset, yOffset);
655
+        frame.moveToFront();
656
+
657
+        // Increase the offsets
658
+        xOffset += FRAME_OPENING_OFFSET;
659
+        yOffset += FRAME_OPENING_OFFSET;
660
+    }
661
+
662
+    /** {@inheritDoc}. */
663
+    @Override
664
+    public void delWindow(FrameContainer window) {
665
+        if (desktopPane.getAllFrames().length == 1) {
666
+            setTitle(getTitlePrefix());
667
+        } else {
668
+            setActiveFrame((Window) desktopPane.selectFrame(true));
669
+        }
670
+        desktopPane.remove((JInternalFrame) window.getFrame());
671
+    }
672
+
673
+    /** {@inheritDoc}. */
674
+    @Override
675
+    public void addWindow(final FrameContainer parent, final FrameContainer window) {
676
+        addWindow(window);
677
+    }
678
+
679
+    /** {@inheritDoc}. */
680
+    @Override
681
+    public void delWindow(final FrameContainer parent, final FrameContainer window) {
682
+        delWindow(window);
683
+    }
684
+
685
+    /** {@inheritDoc}. */
686
+    @Override
687
+    public void iconUpdated(final FrameContainer window) {
688
+        //Ignore
689
+    }
634 690
 }

+ 0
- 2
src/com/dmdirc/ui/swing/components/TextFrame.java View File

@@ -182,8 +182,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
182 182
         if (pref || Main.getUI().getMainWindow().getMaximised()) {
183 183
             hideTitlebar();
184 184
         }
185
-        
186
-        Main.getUI().getMainWindow().addChild(this);
187 185
     }
188 186
     
189 187
     /** {@inheritDoc} */

Loading…
Cancel
Save