Ver código fonte

Merge pull request #448 from csmith/master

Use events for raw data in/out.
pull/450/head
Greg Holmes 8 anos atrás
pai
commit
e4cf766c36

+ 5
- 0
debug/res/META-INF/format.yml Ver arquivo

@@ -0,0 +1,5 @@
1
+---
2
+RawDataInEvent:
3
+  format: "<< {{line}}"
4
+RawDataOutEvent:
5
+  format: ">> {{line}}"

+ 48
- 0
debug/src/com/dmdirc/addons/debug/RawDataInEvent.java Ver arquivo

@@ -0,0 +1,48 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.debug;
24
+
25
+import com.dmdirc.events.BaseDisplayableEvent;
26
+import com.dmdirc.interfaces.WindowModel;
27
+
28
+/**
29
+ * Event raised when a raw data in line is displayed.
30
+ */
31
+public class RawDataInEvent extends BaseDisplayableEvent {
32
+
33
+    private final String line;
34
+
35
+    public RawDataInEvent(final long timestamp, final WindowModel source, final String line) {
36
+        super(timestamp, source);
37
+        this.line = line;
38
+    }
39
+
40
+    public RawDataInEvent(final WindowModel source, final String line) {
41
+        super(source);
42
+        this.line = line;
43
+    }
44
+
45
+    public String getLine() {
46
+        return line;
47
+    }
48
+}

+ 49
- 0
debug/src/com/dmdirc/addons/debug/RawDataOutEvent.java Ver arquivo

@@ -0,0 +1,49 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.debug;
24
+
25
+import com.dmdirc.events.BaseDisplayableEvent;
26
+import com.dmdirc.interfaces.WindowModel;
27
+
28
+/**
29
+ * Event raised when a raw data out line is displayed.
30
+ */
31
+public class RawDataOutEvent extends BaseDisplayableEvent {
32
+
33
+    private final String line;
34
+
35
+    public RawDataOutEvent(final long timestamp, final WindowModel source, final String line) {
36
+        super(timestamp, source);
37
+        this.line = line;
38
+    }
39
+
40
+    public RawDataOutEvent(final WindowModel source, final String line) {
41
+        super(source);
42
+        this.line = line;
43
+    }
44
+
45
+    public String getLine() {
46
+        return line;
47
+    }
48
+
49
+}

+ 2
- 2
debug/src/com/dmdirc/addons/debug/RawWindow.java Ver arquivo

@@ -89,12 +89,12 @@ public class RawWindow extends FrameContainer {
89 89
 
90 90
     @Handler
91 91
     private void handleDataIn(final DataInEvent event) {
92
-        addLine("rawIn", event.getDate(), event.getData());
92
+        getEventBus().publishAsync(new RawDataInEvent(this, event.getData()));
93 93
     }
94 94
 
95 95
     @Handler
96 96
     private void handleDataOut(final DataOutEvent event) {
97
-        addLine("rawOut", event.getDate(), event.getData());
97
+        getEventBus().publishAsync(new RawDataOutEvent(this, event.getData()));
98 98
     }
99 99
 
100 100
 }

+ 0
- 6
redirect/src/com/dmdirc/addons/redirect/FakeWriteableFrameContainer.java Ver arquivo

@@ -61,12 +61,6 @@ public class FakeWriteableFrameContainer extends FrameContainer {
61 61
         target.sendLine(line);
62 62
     }
63 63
 
64
-    @Override
65
-    @Deprecated
66
-    public void addLine(final String type, final Date timestamp, final Object... args) {
67
-        addLine(type, args);
68
-    }
69
-
70 64
     @Override
71 65
     @Deprecated
72 66
     public void addLine(final String type, final Object... args) {

Carregando…
Cancelar
Salvar