Browse Source

Remove unused DisplayableEvent properties.

Now everything is using events, we don't need the legacy
format identifier.
pull/653/head
Chris Smith 8 years ago
parent
commit
9ccf14368a

+ 0
- 13
src/com/dmdirc/events/BaseDisplayableEvent.java View File

25
 import com.dmdirc.interfaces.WindowModel;
25
 import com.dmdirc.interfaces.WindowModel;
26
 
26
 
27
 import java.util.Optional;
27
 import java.util.Optional;
28
-import java.util.concurrent.atomic.AtomicReference;
29
 
28
 
30
 /**
29
 /**
31
  * Base class for miscallenous displayable events.
30
  * Base class for miscallenous displayable events.
32
  */
31
  */
33
 public abstract class BaseDisplayableEvent extends DMDircEvent implements DisplayableEvent {
32
 public abstract class BaseDisplayableEvent extends DMDircEvent implements DisplayableEvent {
34
 
33
 
35
-    /** The display format to use for this event. */
36
-    private final AtomicReference<String> displayFormatRef = new AtomicReference<>("");
37
     /** The properties associated with this event. */
34
     /** The properties associated with this event. */
38
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
35
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
39
     /** The frame container that caused this event. */
36
     /** The frame container that caused this event. */
48
         this.source = source;
45
         this.source = source;
49
     }
46
     }
50
 
47
 
51
-    @Override
52
-    public String getDisplayFormat() {
53
-        return displayFormatRef.get();
54
-    }
55
-
56
-    @Override
57
-    public void setDisplayFormat(final String format) {
58
-        displayFormatRef.set(format);
59
-    }
60
-
61
     @Override
48
     @Override
62
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
49
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
63
         properties.put(property, value);
50
         properties.put(property, value);

+ 0
- 13
src/com/dmdirc/events/ChannelDisplayableEvent.java View File

26
 import com.dmdirc.interfaces.WindowModel;
26
 import com.dmdirc.interfaces.WindowModel;
27
 
27
 
28
 import java.util.Optional;
28
 import java.util.Optional;
29
-import java.util.concurrent.atomic.AtomicReference;
30
 
29
 
31
 /**
30
 /**
32
  * Base type for displayable events that occur in channels.
31
  * Base type for displayable events that occur in channels.
33
  */
32
  */
34
 public abstract class ChannelDisplayableEvent extends ChannelEvent implements DisplayableEvent {
33
 public abstract class ChannelDisplayableEvent extends ChannelEvent implements DisplayableEvent {
35
 
34
 
36
-    /** The display format to use for this event. */
37
-    private final AtomicReference<String> displayFormatRef = new AtomicReference<>("");
38
     /** The properties associated with this event. */
35
     /** The properties associated with this event. */
39
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
36
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
40
 
37
 
46
         super(channel);
43
         super(channel);
47
     }
44
     }
48
 
45
 
49
-    @Override
50
-    public String getDisplayFormat() {
51
-        return displayFormatRef.get();
52
-    }
53
-
54
-    @Override
55
-    public void setDisplayFormat(final String format) {
56
-        displayFormatRef.set(format);
57
-    }
58
-
59
     @Override
46
     @Override
60
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
47
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
61
         properties.put(property, value);
48
         properties.put(property, value);

+ 0
- 14
src/com/dmdirc/events/DisplayableEvent.java View File

31
  */
31
  */
32
 public interface DisplayableEvent {
32
 public interface DisplayableEvent {
33
 
33
 
34
-    /**
35
-     * Gets the format name that will be used to display the event.
36
-     *
37
-     * @return The format name to use for the event.
38
-     */
39
-    String getDisplayFormat();
40
-
41
-    /**
42
-     * Sets the format name that should be used to display the event.
43
-     *
44
-     * @param format The format name to use for the event.
45
-     */
46
-    void setDisplayFormat(String format);
47
-
48
     /**
34
     /**
49
      * Sets a property relating to how this event should be displayed.
35
      * Sets a property relating to how this event should be displayed.
50
      *
36
      *

+ 1
- 15
src/com/dmdirc/events/QueryDisplayableEvent.java View File

26
 import com.dmdirc.interfaces.WindowModel;
26
 import com.dmdirc.interfaces.WindowModel;
27
 
27
 
28
 import java.util.Optional;
28
 import java.util.Optional;
29
-import java.util.concurrent.atomic.AtomicReference;
30
 
29
 
31
 /**
30
 /**
32
  * Base type for displayable events that occur in queries.
31
  * Base type for displayable events that occur in queries.
33
  */
32
  */
34
-public abstract class QueryDisplayableEvent extends QueryEvent implements
35
-        DisplayableEvent {
33
+public abstract class QueryDisplayableEvent extends QueryEvent implements DisplayableEvent {
36
 
34
 
37
-    /** The display format to use for this event. */
38
-    private final AtomicReference<String> displayFormatRef = new AtomicReference<>("");
39
     /** The properties associated with this event. */
35
     /** The properties associated with this event. */
40
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
36
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
41
 
37
 
47
         super(query);
43
         super(query);
48
     }
44
     }
49
 
45
 
50
-    @Override
51
-    public String getDisplayFormat() {
52
-        return displayFormatRef.get();
53
-    }
54
-
55
-    @Override
56
-    public void setDisplayFormat(final String format) {
57
-        displayFormatRef.set(format);
58
-    }
59
-
60
     @Override
46
     @Override
61
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
47
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
62
         properties.put(property, value);
48
         properties.put(property, value);

+ 0
- 13
src/com/dmdirc/events/ServerDisplayableEvent.java View File

26
 import com.dmdirc.interfaces.WindowModel;
26
 import com.dmdirc.interfaces.WindowModel;
27
 
27
 
28
 import java.util.Optional;
28
 import java.util.Optional;
29
-import java.util.concurrent.atomic.AtomicReference;
30
 
29
 
31
 
30
 
32
 /**
31
 /**
34
  */
33
  */
35
 public abstract class ServerDisplayableEvent extends ServerEvent implements DisplayableEvent {
34
 public abstract class ServerDisplayableEvent extends ServerEvent implements DisplayableEvent {
36
 
35
 
37
-    /** The display format to use for this event. */
38
-    private final AtomicReference<String> displayFormatRef = new AtomicReference<>("");
39
     /** The properties associated with this event. */
36
     /** The properties associated with this event. */
40
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
37
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
41
 
38
 
47
         super(connection);
44
         super(connection);
48
     }
45
     }
49
 
46
 
50
-    @Override
51
-    public String getDisplayFormat() {
52
-        return displayFormatRef.get();
53
-    }
54
-
55
-    @Override
56
-    public void setDisplayFormat(final String format) {
57
-        displayFormatRef.set(format);
58
-    }
59
-
60
     @Override
47
     @Override
61
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
48
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
62
         properties.put(property, value);
49
         properties.put(property, value);

+ 0
- 13
src/com/dmdirc/events/UnknownCommandEvent.java View File

25
 import com.dmdirc.interfaces.WindowModel;
25
 import com.dmdirc.interfaces.WindowModel;
26
 
26
 
27
 import java.util.Optional;
27
 import java.util.Optional;
28
-import java.util.concurrent.atomic.AtomicReference;
29
 
28
 
30
 import javax.annotation.Nullable;
29
 import javax.annotation.Nullable;
31
 
30
 
34
  */
33
  */
35
 public class UnknownCommandEvent extends DMDircEvent implements DisplayableEvent {
34
 public class UnknownCommandEvent extends DMDircEvent implements DisplayableEvent {
36
 
35
 
37
-    /** The display format to use for this event. */
38
-    private final AtomicReference<String> displayFormatRef = new AtomicReference<>("");
39
     /** The properties associated with this event. */
36
     /** The properties associated with this event. */
40
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
37
     private final DisplayPropertyMap properties = new DisplayPropertyMap();
41
     @Nullable private final WindowModel source;
38
     @Nullable private final WindowModel source;
71
         return arguments;
68
         return arguments;
72
     }
69
     }
73
 
70
 
74
-    @Override
75
-    public String getDisplayFormat() {
76
-        return displayFormatRef.get();
77
-    }
78
-
79
-    @Override
80
-    public void setDisplayFormat(final String format) {
81
-        displayFormatRef.set(format);
82
-    }
83
-
84
     @Override
71
     @Override
85
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
72
     public <T> void setDisplayProperty(final DisplayProperty<T> property, final T value) {
86
         properties.put(property, value);
73
         properties.put(property, value);

+ 0
- 22
src/com/dmdirc/util/EventUtils.java View File

22
 
22
 
23
 package com.dmdirc.util;
23
 package com.dmdirc.util;
24
 
24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.events.DMDircEvent;
27
 import com.dmdirc.events.DisplayableEvent;
25
 import com.dmdirc.events.DisplayableEvent;
28
 
26
 
29
 /**
27
 /**
46
     private EventUtils() {
44
     private EventUtils() {
47
     }
45
     }
48
 
46
 
49
-    /**
50
-     * Posts a displayable event to the bus, and returns the updated display format.
51
-     *
52
-     * @param <T>             The type of event to be displayed
53
-     *
54
-     * @param eventBus      The bus to post events to.
55
-     * @param event         The event to be posted.
56
-     * @param displayFormat The initial, default, display format.
57
-     *
58
-     * @return The event's display format after it has been posted on the event bus.
59
-     */
60
-    public static <T extends DMDircEvent & DisplayableEvent> String postDisplayable(
61
-            final DMDircMBassador eventBus,
62
-            final T event,
63
-            final String displayFormat) {
64
-        event.setDisplayFormat(displayFormat);
65
-        eventBus.publish(event);
66
-        return event.getDisplayFormat();
67
-    }
68
-
69
 }
47
 }

Loading…
Cancel
Save