Pārlūkot izejas kodu

DummyChannelWindow and DummyServerWindow now extend DummyInputWindow instead of redeclaring the same methods.

Does not impact functionality.

git-svn-id: http://svn.dmdirc.com/trunk@4298 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Chris Smith 16 gadus atpakaļ
vecāks
revīzija
2a41d1eaf3

+ 3
- 123
src/com/dmdirc/ui/dummy/DummyChannelWindow.java Parādīt failu

@@ -23,32 +23,19 @@
23 23
 package com.dmdirc.ui.dummy;
24 24
 
25 25
 import com.dmdirc.Channel;
26
-import com.dmdirc.WritableFrameContainer;
27 26
 import com.dmdirc.commandparser.parsers.ChannelCommandParser;
28
-import com.dmdirc.commandparser.parsers.CommandParser;
29
-import com.dmdirc.config.ConfigManager;
30 27
 import com.dmdirc.parser.ChannelClientInfo;
31
-import com.dmdirc.ui.input.InputHandler;
32 28
 import com.dmdirc.ui.interfaces.ChannelWindow;
33
-import com.dmdirc.util.StringTranscoder;
34 29
 
35
-import java.beans.PropertyVetoException;
36
-import java.nio.charset.Charset;
37
-import java.util.Arrays;
38 30
 import java.util.List;
39 31
 
40 32
 /**
41 33
  * Dummy channel window, used for testing.
42 34
  */
43
-public final class DummyChannelWindow implements ChannelWindow {
35
+public final class DummyChannelWindow extends DummyInputWindow implements ChannelWindow {
36
+
44 37
     /** Parent channel. */
45 38
     private final Channel parent;
46
-    /** Window title. */
47
-    private String title;
48
-    /** is maximised? */
49
-    private boolean maximised;
50
-    /** is visible? */
51
-    private boolean visible;
52 39
 
53 40
     /** 
54 41
      * Instantiates a new DummyChannelWindow. 
@@ -56,6 +43,7 @@ public final class DummyChannelWindow implements ChannelWindow {
56 43
      * @param parent Parent channel
57 44
      */
58 45
     public DummyChannelWindow(final Channel parent) {
46
+        super(parent, new ChannelCommandParser(parent.getServer(), parent));
59 47
         this.parent = parent;
60 48
     }
61 49
 
@@ -83,114 +71,6 @@ public final class DummyChannelWindow implements ChannelWindow {
83 71
         // Do nothing
84 72
     }
85 73
 
86
-    /** {@inheritDoc} */
87
-    @Override
88
-    public CommandParser getCommandParser() {
89
-        return new ChannelCommandParser(parent.getServer(), parent);
90
-    }
91
-
92
-    /** {@inheritDoc} */
93
-    @Override
94
-    public InputHandler getInputHandler() {
95
-        return new DummyInputHandler(new DummyInputField(), getCommandParser(), this);
96
-    }
97
-
98
-    /** {@inheritDoc} */
99
-    @Override
100
-    public void setAwayIndicator(final boolean isAway) {
101
-        throw new UnsupportedOperationException("Not supported yet.");
102
-    }
103
-
104
-    /** {@inheritDoc} */
105
-    @Override
106
-    public void addLine(final String messageType, final Object... args) {
107
-        System.out.println("DummyChannelWindow.addLine(" + messageType + ", " + Arrays.toString(args) + ")");
108
-    }
109
-    
110
-    /** {@inheritDoc} */
111
-    @Override
112
-    public void addLine(final StringBuffer messageType, final Object... args) {
113
-        addLine(messageType.toString(), args);
114
-    }
115
-
116
-    /** {@inheritDoc} */
117
-    @Override
118
-    public void addLine(final String line, final boolean timestamp) {
119
-        throw new UnsupportedOperationException("Not supported yet.");
120
-    }
121
-
122
-    /** {@inheritDoc} */
123
-    @Override
124
-    public void clear() {
125
-        throw new UnsupportedOperationException("Not supported yet.");
126
-    }
127
-
128
-    /** {@inheritDoc} */
129
-    @Override
130
-    public ConfigManager getConfigManager() {
131
-        return parent.getConfigManager();
132
-    }
133
-
134
-    /** {@inheritDoc} */
135
-    @Override
136
-    public WritableFrameContainer getContainer() {
137
-        return parent;
138
-    }
139
-
140
-    /** {@inheritDoc} */
141
-    @Override
142
-    public boolean isVisible() {
143
-        return visible;
144
-    }
145
-
146
-    /** {@inheritDoc} */
147
-    @Override
148
-    public void setVisible(final boolean isVisible) {
149
-        visible = isVisible;
150
-    }
151
-
152
-    /** {@inheritDoc} */
153
-    @Override
154
-    public String getTitle() {
155
-        return title;
156
-    }
157
-
158
-    /** {@inheritDoc} */
159
-    @Override
160
-    public boolean isMaximum() {
161
-        return maximised;
162
-    }
163
-
164
-    /** {@inheritDoc} */
165
-    @Override
166
-    public void setMaximum(final boolean b) throws PropertyVetoException {
167
-        maximised = b;
168
-    }
169
-
170
-    /** {@inheritDoc} */
171
-    @Override
172
-    public void setTitle(final String title) {
173
-        this.title = title;
174
-    }
175
-
176
-    /** {@inheritDoc} */
177
-    @Override
178
-    public void open() {
179
-        // Do nothing
180
-    }
181
-
182
-    /** {@inheritDoc} */
183
-    @Override
184
-    public StringTranscoder getTranscoder() {
185
-        return new StringTranscoder(Charset.defaultCharset());
186
-    }
187
-    
188
-    /** {@inheritDoc} */
189
-    @Override
190
-    public void close() {
191
-        parent.windowClosing();
192
-    }
193
-
194 74
     /** {@inheritDoc} */
195 75
     @Override
196 76
     public Channel getChannel() {

+ 3
- 127
src/com/dmdirc/ui/dummy/DummyServerWindow.java Parādīt failu

@@ -23,150 +23,26 @@
23 23
 package com.dmdirc.ui.dummy;
24 24
 
25 25
 import com.dmdirc.Server;
26
-import com.dmdirc.WritableFrameContainer;
27
-import com.dmdirc.commandparser.parsers.CommandParser;
28 26
 import com.dmdirc.commandparser.parsers.ServerCommandParser;
29
-import com.dmdirc.config.ConfigManager;
30
-import com.dmdirc.ui.input.InputHandler;
31 27
 import com.dmdirc.ui.interfaces.ServerWindow;
32
-import com.dmdirc.util.StringTranscoder;
33
-
34
-import java.beans.PropertyVetoException;
35
-import java.nio.charset.Charset;
36
-import java.util.Arrays;
37 28
 
38 29
 /**
39 30
  * Dummy server window, used for testing.
40 31
  */
41
-public final class DummyServerWindow implements ServerWindow {
32
+public final class DummyServerWindow extends DummyInputWindow implements ServerWindow {
42 33
     
43 34
     /** Parent server. */
44 35
     private final Server parent;
45 36
     
46
-    /** Are we visible? */
47
-    private boolean visible;
48
-    
49
-    /** Server window title. */
50
-    private String title;
51
-    
52
-    /** are we maximised? */
53
-    private boolean maximised;
54
-    
55 37
     /** 
56 38
      * Instantiates this DummyServerWindow. 
57 39
      *
58 40
      * @param parent Parent server
59 41
      */
60 42
     public DummyServerWindow(final Server parent) {
43
+        super(parent, new ServerCommandParser(parent));
44
+        
61 45
         this.parent = parent;
62 46
     }
63 47
     
64
-    /** {@inheritDoc} */
65
-    @Override
66
-    public CommandParser getCommandParser() {
67
-        return new ServerCommandParser(parent);
68
-    }
69
-    
70
-    /** {@inheritDoc} */
71
-    @Override
72
-    public InputHandler getInputHandler() {
73
-        return new DummyInputHandler(new DummyInputField(), null, this);
74
-    }
75
-    
76
-    /** {@inheritDoc} */
77
-    @Override
78
-    public void setAwayIndicator(final boolean isAway) {
79
-        // Do nothing
80
-    }
81
-    
82
-    /** {@inheritDoc} */
83
-    @Override
84
-    public void addLine(final String messageType, final Object... args) {
85
-        System.out.println("DummyServerWindow.addLine(" + messageType + ", " + Arrays.toString(args) + ")");
86
-    }
87
-    
88
-    /** {@inheritDoc} */
89
-    @Override
90
-    public void addLine(final StringBuffer messageType, final Object... args) {
91
-        addLine(messageType.toString(), args);
92
-    }
93
-    
94
-    /** {@inheritDoc} */
95
-    @Override
96
-    public void addLine(final String line, final boolean timestamp) {
97
-        throw new UnsupportedOperationException("Not supported yet.");
98
-    }
99
-    
100
-    /** {@inheritDoc} */
101
-    @Override
102
-    public void clear() {
103
-        System.out.println("DummyServerWindow.clear()");
104
-    }
105
-    
106
-    /** {@inheritDoc} */
107
-    @Override
108
-    public ConfigManager getConfigManager() {
109
-        return new ConfigManager("dummy", "dummy", "dummy");
110
-    }
111
-    
112
-    /** {@inheritDoc} */
113
-    @Override
114
-    public WritableFrameContainer getContainer() {
115
-        return parent;
116
-    }
117
-    
118
-    /** {@inheritDoc} */
119
-    @Override
120
-    public boolean isVisible() {
121
-        return visible;
122
-    }
123
-    
124
-    /** {@inheritDoc} */
125
-    @Override
126
-    public void setVisible(final boolean isVisible) {
127
-        visible = isVisible;
128
-    }
129
-    
130
-    /** {@inheritDoc} */
131
-    @Override
132
-    public String getTitle() {
133
-        return title;
134
-    }
135
-    
136
-    /** {@inheritDoc} */
137
-    @Override
138
-    public boolean isMaximum() {
139
-        return maximised;
140
-    }
141
-    
142
-    /** {@inheritDoc} */
143
-    @Override
144
-    public void setMaximum(final boolean b) throws PropertyVetoException {
145
-        maximised = b;
146
-    }
147
-    
148
-    /** {@inheritDoc} */
149
-    @Override
150
-    public void setTitle(final String title) {
151
-        this.title = title;
152
-    }
153
-    
154
-    /** {@inheritDoc} */
155
-    @Override
156
-    public void open() {
157
-        // Do nothing
158
-    }
159
-
160
-    /** {@inheritDoc} */
161
-    @Override
162
-    public StringTranscoder getTranscoder() {
163
-        return new StringTranscoder(Charset.defaultCharset());
164
-    }
165
-    
166
-    /** {@inheritDoc} */
167
-    @Override
168
-    public void close() {
169
-        parent.windowClosing();
170
-    }    
171
-    
172 48
 }

Notiek ielāde…
Atcelt
Saglabāt