Browse Source

Switch Window to TextFrame in the frame managers.

pull/96/head
Greg Holmes 9 years ago
parent
commit
5a7ad699ea

+ 1
- 2
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/ctrltab/CtrlTabWindowManager.java View File

@@ -40,7 +40,6 @@ import com.dmdirc.addons.ui_swing.framemanager.tree.TreeViewModel;
40 40
 import com.dmdirc.addons.ui_swing.framemanager.tree.TreeViewNode;
41 41
 import com.dmdirc.events.UserErrorEvent;
42 42
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
43
-import com.dmdirc.interfaces.ui.Window;
44 43
 import com.dmdirc.logger.ErrorLevel;
45 44
 
46 45
 import java.awt.event.InputEvent;
@@ -69,7 +68,7 @@ import net.engio.mbassy.listener.Invoke;
69 68
 public class CtrlTabWindowManager {
70 69
 
71 70
     /** Node storage, used for adding and deleting nodes correctly. */
72
-    private final Map<Window, TreeViewNode> nodes;
71
+    private final Map<TextFrame, TreeViewNode> nodes;
73 72
     /** Data model. */
74 73
     private final TreeViewModel model;
75 74
     /** Tree Scroller. */

+ 3
- 3
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/NodeLabel.java View File

@@ -24,11 +24,11 @@ package com.dmdirc.addons.ui_swing.framemanager.tree;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
26 26
 import com.dmdirc.addons.ui_swing.components.ImageButton;
27
+import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
27 28
 import com.dmdirc.addons.ui_swing.events.SwingWindowSelectedEvent;
28 29
 import com.dmdirc.events.FrameIconChangedEvent;
29 30
 import com.dmdirc.events.FrameNameChangedEvent;
30 31
 import com.dmdirc.events.NotificationSetEvent;
31
-import com.dmdirc.interfaces.ui.Window;
32 32
 import com.dmdirc.ui.IconManager;
33 33
 import com.dmdirc.ui.messages.Styliser;
34 34
 
@@ -53,7 +53,7 @@ public class NodeLabel extends JPanel {
53 53
     /** A version number for this class. */
54 54
     private static final long serialVersionUID = 1;
55 55
     /** The window this node represents in the tree. */
56
-    private final Window window;
56
+    private final TextFrame window;
57 57
     /** Colour used to show if the mouse is over this node. */
58 58
     private boolean rollover;
59 59
     /** Colour used to show if this node has an active notification. */
@@ -74,7 +74,7 @@ public class NodeLabel extends JPanel {
74 74
      *
75 75
      * @param window Window for this node
76 76
      */
77
-    public NodeLabel(final Window window, final IconManager iconManager) {
77
+    public NodeLabel(final TextFrame window, final IconManager iconManager) {
78 78
         this.window = window;
79 79
         this.iconManager = iconManager;
80 80
 

+ 0
- 6
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java View File

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.framemanager.tree;
24 24
 
25
-import com.dmdirc.addons.ui_swing.SwingWindowFactory;
26 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
27 26
 import com.dmdirc.addons.ui_swing.actions.CloseWindowAction;
28 27
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
@@ -73,8 +72,6 @@ public class Tree extends JTree implements MouseMotionListener,
73 72
     private boolean dragButton;
74 73
     /** Show handles. */
75 74
     private boolean showHandles;
76
-    /** Factory to use to retrieve swing windows. */
77
-    private final SwingWindowFactory windowFactory;
78 75
 
79 76
     /**
80 77
      * Specialised JTree for frame manager.
@@ -84,20 +81,17 @@ public class Tree extends JTree implements MouseMotionListener,
84 81
      * @param eventBus          The swing event bus to post events to.
85 82
      * @param globalConfig      The config to read settings from.
86 83
      * @param domain            The domain to read settings from.
87
-     * @param windowFactory     The factory to use to get swing windows.
88 84
      */
89 85
     public Tree(
90 86
             final TreeFrameManager manager,
91 87
             final TreeModel model,
92 88
             final SwingEventBus eventBus,
93 89
             final AggregateConfigProvider globalConfig,
94
-            final SwingWindowFactory windowFactory,
95 90
             final String domain) {
96 91
         super(model);
97 92
 
98 93
         this.manager = manager;
99 94
         this.config = globalConfig;
100
-        this.windowFactory = windowFactory;
101 95
         this.eventBus = eventBus;
102 96
 
103 97
         putClientProperty("JTree.lineStyle", "Angled");

+ 2
- 3
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeFrameManager.java View File

@@ -132,8 +132,7 @@ public class TreeFrameManager implements FrameManager, Serializable, ConfigChang
132 132
             @Override
133 133
             public void run() {
134 134
                 model = new TreeViewModel(config, new TreeViewNode(null, null));
135
-                tree = new Tree(TreeFrameManager.this, model, swingEventBus, globalConfig,
136
-                        windowFactory, domain);
135
+                tree = new Tree(TreeFrameManager.this, model, swingEventBus, globalConfig, domain);
137 136
                 tree.setCellRenderer(
138 137
                         new TreeViewTreeCellRenderer(config, colourManager, TreeFrameManager.this));
139 138
                 tree.setVisible(true);
@@ -229,7 +228,7 @@ public class TreeFrameManager implements FrameManager, Serializable, ConfigChang
229 228
      * @param parent Parent node
230 229
      * @param window Window to add
231 230
      */
232
-    public void addWindow(final MutableTreeNode parent, final Window window) {
231
+    public void addWindow(final MutableTreeNode parent, final TextFrame window) {
233 232
         UIUtilities.invokeAndWait(new Runnable() {
234 233
 
235 234
             @Override

+ 3
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewModel.java View File

@@ -75,7 +75,7 @@ public class TreeViewModel extends DefaultTreeModel {
75 75
      * @return index where new node is to be inserted.
76 76
      */
77 77
     private int getIndex(final TreeViewNode newChild, final TreeNode parent) {
78
-        if (newChild.getWindow() instanceof GlobalWindow) {
78
+        if (newChild.getWindow().getContainer() instanceof GlobalWindow) {
79 79
             return 0;
80 80
         }
81 81
 
@@ -107,8 +107,7 @@ public class TreeViewModel extends DefaultTreeModel {
107 107
      *
108 108
      * @return True iff newChild should be sorted before child
109 109
      */
110
-    private boolean sortBefore(final TreeViewNode newChild,
111
-            final TreeViewNode child) {
110
+    private boolean sortBefore(final TreeViewNode newChild, final TreeViewNode child) {
112 111
         return comparator.compare(newChild.getWindow(), child.
113 112
                 getWindow()) <= -1;
114 113
     }
@@ -122,8 +121,7 @@ public class TreeViewModel extends DefaultTreeModel {
122 121
      *
123 122
      * @return True iff newChild should be sorted before child
124 123
      */
125
-    private boolean sortAfter(final TreeViewNode newChild,
126
-            final TreeViewNode child) {
124
+    private boolean sortAfter(final TreeViewNode newChild, final TreeViewNode child) {
127 125
         return comparator.compare(newChild.getWindow(), child.
128 126
                 getWindow()) >= 1;
129 127
     }

+ 4
- 4
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewNode.java View File

@@ -22,7 +22,7 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.framemanager.tree;
24 24
 
25
-import com.dmdirc.interfaces.ui.Window;
25
+import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
26 26
 
27 27
 import javax.swing.tree.DefaultMutableTreeNode;
28 28
 
@@ -36,7 +36,7 @@ public class TreeViewNode extends DefaultMutableTreeNode {
36 36
     /** Node's label. */
37 37
     private final NodeLabel label;
38 38
     /** Node's frame container. */
39
-    private final Window window;
39
+    private final TextFrame window;
40 40
 
41 41
     /**
42 42
      * Instantiates a new tree view node.
@@ -44,7 +44,7 @@ public class TreeViewNode extends DefaultMutableTreeNode {
44 44
      * @param label  Node label
45 45
      * @param window Node window
46 46
      */
47
-    public TreeViewNode(final NodeLabel label, final Window window) {
47
+    public TreeViewNode(final NodeLabel label, final TextFrame window) {
48 48
 
49 49
         this.label = label;
50 50
         this.window = window;
@@ -64,7 +64,7 @@ public class TreeViewNode extends DefaultMutableTreeNode {
64 64
      *
65 65
      * @return Node window
66 66
      */
67
-    public Window getWindow() {
67
+    public TextFrame getWindow() {
68 68
         return window;
69 69
     }
70 70
 

+ 3
- 4
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/WindowMenuFrameManager.java View File

@@ -30,7 +30,6 @@ import com.dmdirc.addons.ui_swing.events.SwingEventBus;
30 30
 import com.dmdirc.addons.ui_swing.events.SwingWindowAddedEvent;
31 31
 import com.dmdirc.addons.ui_swing.events.SwingWindowDeletedEvent;
32 32
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
33
-import com.dmdirc.interfaces.ui.Window;
34 33
 import com.dmdirc.plugins.PluginDomain;
35 34
 
36 35
 import com.google.common.collect.Maps;
@@ -59,7 +58,7 @@ public class WindowMenuFrameManager extends JMenu {
59 58
     /** Window selection font changer. */
60 59
     private final WindowSelectionFontChangerFactory windowSelectionFontChanger;
61 60
     /** Window to item mapping. */
62
-    private final Map<Window, AbstractButton> menuItems;
61
+    private final Map<TextFrame, AbstractButton> menuItems;
63 62
     /** Swing event bus. */
64 63
     private final SwingEventBus swingEventBus;
65 64
     /** Close menu item. */
@@ -156,11 +155,11 @@ public class WindowMenuFrameManager extends JMenu {
156 155
         add(item);
157 156
     }
158 157
 
159
-    private void deleteTopLevelWindow(final Window window) {
158
+    private void deleteTopLevelWindow(final TextFrame window) {
160 159
         remove(menuItems.get(window));
161 160
     }
162 161
 
163
-    private void deleteChildWindow(final Window parent, final Window child) {
162
+    private void deleteChildWindow(final TextFrame parent, final TextFrame child) {
164 163
         menuItems.get(parent).remove(menuItems.get(child));
165 164
     }
166 165
 }

+ 3
- 3
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/WindowSelectionFontChanger.java View File

@@ -23,10 +23,10 @@
23 23
 package com.dmdirc.addons.ui_swing.framemanager.windowmenu;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.EdtHandlerInvocation;
26
+import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
26 27
 import com.dmdirc.addons.ui_swing.events.SwingEventBus;
27 28
 import com.dmdirc.addons.ui_swing.events.SwingWindowSelectedEvent;
28 29
 import com.dmdirc.addons.ui_swing.interfaces.ActiveFrameManager;
29
-import com.dmdirc.interfaces.ui.Window;
30 30
 
31 31
 import java.awt.Font;
32 32
 import java.util.Optional;
@@ -46,9 +46,9 @@ import net.engio.mbassy.listener.References;
46 46
 public class WindowSelectionFontChanger {
47 47
 
48 48
     private final JComponent component;
49
-    private final Window window;
49
+    private final TextFrame window;
50 50
 
51
-    public WindowSelectionFontChanger(final JComponent component, final Window window) {
51
+    public WindowSelectionFontChanger(final JComponent component, final TextFrame window) {
52 52
         this.component = component;
53 53
         this.window = window;
54 54
     }

+ 2
- 2
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/WindowSelectionFontChangerFactory.java View File

@@ -22,9 +22,9 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.framemanager.windowmenu;
24 24
 
25
+import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
25 26
 import com.dmdirc.addons.ui_swing.events.SwingEventBus;
26 27
 import com.dmdirc.addons.ui_swing.interfaces.ActiveFrameManager;
27
-import com.dmdirc.interfaces.ui.Window;
28 28
 
29 29
 import javax.inject.Inject;
30 30
 import javax.swing.JComponent;
@@ -45,7 +45,7 @@ public class WindowSelectionFontChangerFactory {
45 45
     }
46 46
 
47 47
     public WindowSelectionFontChanger getWindowSelectionFontChanger(final JComponent component,
48
-            final Window window) {
48
+            final TextFrame window) {
49 49
         final WindowSelectionFontChanger windowSelectionFontChanger
50 50
                 = new WindowSelectionFontChanger(component, window);
51 51
         windowSelectionFontChanger.init(activeFrameManager, swingEventBus);

Loading…
Cancel
Save