Pārlūkot izejas kodu

Change ErrorLevel.getIcon to use strings not swing Icons

Fixes CORE-9

Change-Id: Id43521640e66ee80962d3b2432f652c47b6223c1
Depends-On: Iee0aa1d166b301f56a92f0bc1d3b38c0ed1000dc
Reviewed-on: http://gerrit.dmdirc.com/1521
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: Greg Holmes <greg@dmdirc.com>
tags/0.6.5b1
Chris Smith 13 gadus atpakaļ
vecāks
revīzija
8e2493dd6d

+ 9
- 13
src/com/dmdirc/logger/ErrorLevel.java Parādīt failu

22
 
22
 
23
 package com.dmdirc.logger;
23
 package com.dmdirc.logger;
24
 
24
 
25
-import com.dmdirc.ui.IconManager;
26
-
27
-import javax.swing.Icon;
28
-
29
 /** Specific error levels allowed by Logger. */
25
 /** Specific error levels allowed by Logger. */
30
 public enum ErrorLevel {
26
 public enum ErrorLevel {
31
     /** Fatal error. */
27
     /** Fatal error. */
32
-    FATAL("Fatal", IconManager.getIconManager().getIcon("error")),
28
+    FATAL("Fatal", "error"),
33
     /** High priority error. */
29
     /** High priority error. */
34
-    HIGH("High", IconManager.getIconManager().getIcon("error")),
30
+    HIGH("High", "error"),
35
     /** Medium priority error. */
31
     /** Medium priority error. */
36
-    MEDIUM("Medium", IconManager.getIconManager().getIcon("warning")),
32
+    MEDIUM("Medium", "warning"),
37
     /** Low priority error. */
33
     /** Low priority error. */
38
-    LOW("Low", IconManager.getIconManager().getIcon("info")),
34
+    LOW("Low", "info"),
39
     /** Unknown priority error. */
35
     /** Unknown priority error. */
40
-    UNKNOWN("Unknown", IconManager.getIconManager().getIcon("info"));
36
+    UNKNOWN("Unknown", "info");
41
     
37
     
42
     /** Error level string. */
38
     /** Error level string. */
43
     private String value;
39
     private String value;
44
     /** Error level icon. */
40
     /** Error level icon. */
45
-    private Icon icon;
41
+    private String icon;
46
     
42
     
47
     /** 
43
     /** 
48
      * Instantiates the enum. 
44
      * Instantiates the enum. 
50
      * @param value toString value
46
      * @param value toString value
51
      * @param icon Error level icon
47
      * @param icon Error level icon
52
      */
48
      */
53
-    ErrorLevel(final String value, final Icon icon) {
49
+    ErrorLevel(final String value, final String icon) {
54
         this.value = value;
50
         this.value = value;
55
         this.icon = icon;
51
         this.icon = icon;
56
     }
52
     }
66
      * 
62
      * 
67
      * @return Error levels icon
63
      * @return Error levels icon
68
      */
64
      */
69
-    public Icon getIcon() {
65
+    public String getIcon() {
70
         return icon;
66
         return icon;
71
     }
67
     }
72
     
68
     
75
      *
71
      *
76
      * @param level Error level to compare
72
      * @param level Error level to compare
77
      *
73
      *
78
-     * @return true iif the error is more important
74
+     * @return true iff the error is more important
79
      */
75
      */
80
     public boolean moreImportant(final ErrorLevel level) {
76
     public boolean moreImportant(final ErrorLevel level) {
81
         if (level == null) {
77
         if (level == null) {

+ 0
- 10
test/com/dmdirc/logger/ErrorLevelTest.java Parādīt failu

21
  */
21
  */
22
 package com.dmdirc.logger;
22
 package com.dmdirc.logger;
23
 
23
 
24
-import javax.swing.Icon;
25
 import org.junit.Test;
24
 import org.junit.Test;
26
 import static org.junit.Assert.*;
25
 import static org.junit.Assert.*;
27
 
26
 
36
         assertTrue("Unknown".equalsIgnoreCase(ErrorLevel.UNKNOWN.toString()));
35
         assertTrue("Unknown".equalsIgnoreCase(ErrorLevel.UNKNOWN.toString()));
37
     }
36
     }
38
 
37
 
39
-    @Test
40
-    public void testGetIcon() {
41
-        assertTrue(ErrorLevel.LOW.getIcon() instanceof Icon);
42
-        assertTrue(ErrorLevel.MEDIUM.getIcon() instanceof Icon);
43
-        assertTrue(ErrorLevel.HIGH.getIcon() instanceof Icon);
44
-        assertTrue(ErrorLevel.FATAL.getIcon() instanceof Icon);
45
-        assertTrue(ErrorLevel.UNKNOWN.getIcon() instanceof Icon);
46
-    }
47
-
48
     @Test
38
     @Test
49
     public void testMoreImportantLow() {
39
     public void testMoreImportantLow() {
50
         assertTrue(ErrorLevel.LOW.moreImportant(ErrorLevel.MEDIUM));
40
         assertTrue(ErrorLevel.LOW.moreImportant(ErrorLevel.MEDIUM));

Notiek ielāde…
Atcelt
Saglabāt