Browse Source

Last of the abstraction (I think)

git-svn-id: http://svn.dmdirc.com/trunk@1287 00569f92-eb28-0410-84fd-f71c24880f
tags/0.4
Chris Smith 17 years ago
parent
commit
adfe4c03e2

+ 0
- 18
src/uk/org/ownage/dmdirc/Channel.java View File

@@ -830,22 +830,4 @@ public final class Channel extends FrameContainer implements IChannelMessage,
830 830
     public String toString() {
831 831
         return channelInfo.getName();
832 832
     }
833
-    
834
-    /**
835
-     * Formats the specified arguments using the supplied message type, and
836
-     * outputs to the main text area.
837
-     * @param messageType the message type to use
838
-     * @param args the arguments to pass
839
-     */
840
-    public void addLine(final String messageType, final Object... args) {
841
-        frame.addLine(messageType, args);
842
-    }
843
-    
844
-    /**
845
-     * Retrieves the icon used by the channel frame.
846
-     * @return The channel frame's icon
847
-     */
848
-    public ImageIcon getIcon() {
849
-        return imageIcon;
850
-    }
851 833
 }

+ 24
- 10
src/uk/org/ownage/dmdirc/FrameContainer.java View File

@@ -45,7 +45,10 @@ public abstract class FrameContainer implements InternalFrameListener {
45 45
     
46 46
     /** The colour of our frame's notifications. */
47 47
     protected Color notification = Color.BLACK;
48
-            
48
+    
49
+    /** The icon being used for this container's frame. */
50
+    protected ImageIcon imageIcon;
51
+    
49 52
     /**
50 53
      * Returns the internal frame associated with this object.
51 54
      * @return The internal frame associated with this object
@@ -58,13 +61,6 @@ public abstract class FrameContainer implements InternalFrameListener {
58 61
      */
59 62
     public abstract String toString();
60 63
     
61
-    /**
62
-     * Returns a reference to the icon that is currently being used by the
63
-     * frame.
64
-     * @return The frame's icon
65
-     */
66
-    public abstract ImageIcon getIcon();
67
-    
68 64
     /**
69 65
      * Closes this container (and it's associated frame).
70 66
      */
@@ -76,6 +72,24 @@ public abstract class FrameContainer implements InternalFrameListener {
76 72
      */
77 73
     public abstract Server getServer();
78 74
     
75
+    /**
76
+     * Retrieves the icon used by the query frame.
77
+     * @return The query frame's icon
78
+     */
79
+    public ImageIcon getIcon() {
80
+        return imageIcon;
81
+    }
82
+    
83
+    /**
84
+     * Formats the specified arguments using the supplied message type, and
85
+     * outputs to the main text area.
86
+     * @param messageType the message type to use
87
+     * @param args the arguments to pass
88
+     */
89
+    public void addLine(final String messageType, final Object... args) {
90
+        getFrame().addLine(messageType, args);
91
+    }
92
+    
79 93
     /**
80 94
      * Returns the config manager for this container.
81 95
      * @return the associated config manager
@@ -89,7 +103,7 @@ public abstract class FrameContainer implements InternalFrameListener {
89 103
      */
90 104
     public void activateFrame() {
91 105
         MainFrame.getMainFrame().setActiveFrame((JInternalFrame) getFrame());
92
-    }    
106
+    }
93 107
     
94 108
     /**
95 109
      * Clears any outstanding notifications this frame has set.
@@ -124,7 +138,7 @@ public abstract class FrameContainer implements InternalFrameListener {
124 138
      */
125 139
     public Color getNotification() {
126 140
         return notification;
127
-    }    
141
+    }
128 142
     
129 143
     /**
130 144
      * Determines if the specified frame is owned by this object.

+ 2
- 19
src/uk/org/ownage/dmdirc/Query.java View File

@@ -30,7 +30,6 @@ import uk.org.ownage.dmdirc.actions.ActionManager;
30 30
 import uk.org.ownage.dmdirc.actions.CoreActionType;
31 31
 import uk.org.ownage.dmdirc.commandparser.CommandManager;
32 32
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
33
-import uk.org.ownage.dmdirc.identities.ConfigManager;
34 33
 import uk.org.ownage.dmdirc.logger.ErrorLevel;
35 34
 import uk.org.ownage.dmdirc.logger.Logger;
36 35
 import uk.org.ownage.dmdirc.parser.ClientInfo;
@@ -83,6 +82,8 @@ public final class Query extends FrameContainer implements IPrivateAction,
83 82
      * @param newServer The server object that this Query belongs to
84 83
      */
85 84
     public Query(final Server newServer, final String newHost) {
85
+        super();
86
+        
86 87
         this.server = newServer;
87 88
         this.host = newHost;
88 89
         
@@ -308,22 +309,4 @@ public final class Query extends FrameContainer implements IPrivateAction,
308 309
         
309 310
         MainFrame.getMainFrame().setActiveFrame(frame);
310 311
     }
311
-    
312
-    /**
313
-     * Formats the specified arguments using the supplied message type, and
314
-     * outputs to the main text area.
315
-     * @param messageType the message type to use
316
-     * @param args the arguments to pass
317
-     */
318
-    public void addLine(final String messageType, final Object... args) {
319
-        frame.addLine(messageType, args);
320
-    }
321
-    
322
-    /**
323
-     * Retrieves the icon used by the query frame.
324
-     * @return The query frame's icon
325
-     */
326
-    public ImageIcon getIcon() {
327
-        return imageIcon;
328
-    }
329 312
 }

+ 2
- 14
src/uk/org/ownage/dmdirc/Raw.java View File

@@ -48,10 +48,6 @@ public final class Raw extends FrameContainer implements IDataIn, IDataOut {
48 48
      * A serverframe instance used for displaying the raw data.
49 49
      */
50 50
     private ServerFrame frame;
51
-    /**
52
-     * The icon being used for this raw frame.
53
-     */
54
-    private final ImageIcon imageIcon;
55 51
     
56 52
     /**
57 53
      * Creates a new instance of Raw.
@@ -106,7 +102,7 @@ public final class Raw extends FrameContainer implements IDataIn, IDataOut {
106 102
      * @param data The data that was received
107 103
      */
108 104
     public void onDataIn(final IRCParser parser, final String data) {
109
-        frame.addLine("rawIn", data);
105
+        addLine("rawIn", data);
110 106
     }
111 107
     
112 108
     /**
@@ -118,7 +114,7 @@ public final class Raw extends FrameContainer implements IDataIn, IDataOut {
118 114
      */
119 115
     public void onDataOut(final IRCParser parser, final String data,
120 116
             final boolean fromParser) {
121
-        frame.addLine("rawOut", data);
117
+        addLine("rawOut", data);
122 118
     }
123 119
     
124 120
     /**
@@ -129,14 +125,6 @@ public final class Raw extends FrameContainer implements IDataIn, IDataOut {
129 125
         return "Raw";
130 126
     }
131 127
     
132
-    /**
133
-     * Retrieves the icon used by the raw frame.
134
-     * @return The raw frame's icon
135
-     */
136
-    public ImageIcon getIcon() {
137
-        return imageIcon;
138
-    }
139
-    
140 128
     /**
141 129
      * Returns the server instance associated with this frame.
142 130
      *

+ 6
- 14
src/uk/org/ownage/dmdirc/Server.java View File

@@ -215,7 +215,7 @@ public final class Server extends FrameContainer implements IChannelSelfJoin,
215 215
         imageIcon = new ImageIcon(imageURL);
216 216
         frame.setFrameIcon(imageIcon);
217 217
         
218
-        frame.addLine("serverConnecting", server, port);
218
+        addLine("serverConnecting", server, port);
219 219
         sendNotification();
220 220
         
221 221
         final MyInfo myInfo = new MyInfo();
@@ -656,7 +656,7 @@ public final class Server extends FrameContainer implements IChannelSelfJoin,
656 656
             query.addLine(messageType, args);
657 657
             query.sendNotification();
658 658
         }
659
-        frame.addLine(messageType, args);
659
+        addLine(messageType, args);
660 660
         sendNotification();
661 661
     }
662 662
     
@@ -676,7 +676,7 @@ public final class Server extends FrameContainer implements IChannelSelfJoin,
676 676
             }
677 677
         }
678 678
         if ("server".equals(target)) {
679
-            frame.addLine(messageType, args);
679
+            addLine(messageType, args);
680 680
             sendNotification();
681 681
         } else if ("all".equals(target)) {
682 682
             addLineToAll(messageType, args);
@@ -841,7 +841,7 @@ public final class Server extends FrameContainer implements IChannelSelfJoin,
841 841
      * @param sData The message at the start of the MOTD
842 842
      */
843 843
     public void onMOTDStart(final IRCParser tParser, final String sData) {
844
-        frame.addLine("motdStart", sData);
844
+        addLine("motdStart", sData);
845 845
         sendNotification();
846 846
     }
847 847
     
@@ -851,7 +851,7 @@ public final class Server extends FrameContainer implements IChannelSelfJoin,
851 851
      * @param sData The line of the MOTD
852 852
      */
853 853
     public void onMOTDLine(final IRCParser tParser, final String sData) {
854
-        frame.addLine("motdLine", sData);
854
+        addLine("motdLine", sData);
855 855
         sendNotification();
856 856
     }
857 857
     
@@ -861,7 +861,7 @@ public final class Server extends FrameContainer implements IChannelSelfJoin,
861 861
      * @param noMOTD Indicates that there was no MOTD
862 862
      */
863 863
     public void onMOTDEnd(final IRCParser tParser, final boolean noMOTD) {
864
-        frame.addLine("motdEnd", "End of server's MOTD.");
864
+        addLine("motdEnd", "End of server's MOTD.");
865 865
         sendNotification();
866 866
     }
867 867
     
@@ -1045,14 +1045,6 @@ public final class Server extends FrameContainer implements IChannelSelfJoin,
1045 1045
         return this.server;
1046 1046
     }
1047 1047
     
1048
-    /**
1049
-     * Returns the server frame's icon.
1050
-     * @return The server frame's icon
1051
-     */
1052
-    public ImageIcon getIcon() {
1053
-        return imageIcon;
1054
-    }
1055
-    
1056 1048
     /**
1057 1049
      * Returns the server instance associated with this frame.
1058 1050
      *

Loading…
Cancel
Save