浏览代码

Use new source method for displaying events.

pull/251/head
Chris Smith 9 年前
父节点
当前提交
fa13fc1782
共有 2 个文件被更改,包括 3 次插入5 次删除
  1. 0
    2
      src/com/dmdirc/events/DisplayProperty.java
  2. 3
    3
      src/com/dmdirc/ui/messages/BackBuffer.java

+ 0
- 2
src/com/dmdirc/events/DisplayProperty.java 查看文件

@@ -33,7 +33,5 @@ public final class DisplayProperty<T> {
33 33
     public static final DisplayProperty<Colour> FOREGROUND_COLOUR = new DisplayProperty<>();
34 34
     /** The background colour of text relating to the event. */
35 35
     public static final DisplayProperty<Colour> BACKGROUND_COLOUR = new DisplayProperty<>();
36
-    /** Indicates the event has been successfully handled. */
37
-    public static final DisplayProperty<Boolean> HANDLED = new DisplayProperty<>();
38 36
 
39 37
 }

+ 3
- 3
src/com/dmdirc/ui/messages/BackBuffer.java 查看文件

@@ -25,7 +25,6 @@ package com.dmdirc.ui.messages;
25 25
 import com.dmdirc.DMDircMBassador;
26 26
 import com.dmdirc.FrameContainer;
27 27
 import com.dmdirc.config.ConfigBinding;
28
-import com.dmdirc.events.DisplayProperty;
29 28
 import com.dmdirc.events.DisplayableEvent;
30 29
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
31 30
 
@@ -41,6 +40,7 @@ public class BackBuffer {
41 40
     private final DMDircMBassador eventBus;
42 41
     private final EventFormatter formatter;
43 42
     private final AggregateConfigProvider configProvider;
43
+    private final FrameContainer owner;
44 44
 
45 45
     @ConfigBinding(domain="dev", key="enableNewEvents")
46 46
     private boolean enabled;
@@ -49,6 +49,7 @@ public class BackBuffer {
49 49
             final FrameContainer owner,
50 50
             final ColourManagerFactory colourManagerFactory,
51 51
             final EventFormatter formatter) {
52
+        this.owner = owner;
52 53
         this.styliser = new Styliser(
53 54
                 owner.getConnection().orElse(null),
54 55
                 owner.getConfigManager(),
@@ -82,10 +83,9 @@ public class BackBuffer {
82 83
      */
83 84
     @Handler
84 85
     public void handleDisplayableEvent(final DisplayableEvent event) {
85
-        if (enabled && !event.getDisplayProperty(DisplayProperty.HANDLED).isPresent()) {
86
+        if (enabled && event.getSource().equals(owner)) {
86 87
             formatter.format(event).ifPresent(
87 88
                     t -> document.addText(event.getTimestamp(), event.getDisplayProperties(), t));
88
-            event.setDisplayProperty(DisplayProperty.HANDLED, Boolean.TRUE);
89 89
         }
90 90
     }
91 91
 

正在加载...
取消
保存