1
|
/**
|
2
|
* Copyright (C) 2021 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.element;
|
10
|
|
11
|
import org.eclipse.swt.graphics.Color;
|
12
|
|
13
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
14
|
import eu.etaxonomy.taxeditor.preference.Resources;
|
15
|
|
16
|
/**
|
17
|
* @author a.mueller
|
18
|
* @since 20.01.2021
|
19
|
*/
|
20
|
public enum CacheRelevance{
|
21
|
CACHE1(Resources.COLOR_COMPOSITE_IRRELEVANT1, null),
|
22
|
CACHE2(Resources.COLOR_COMPOSITE_IRRELEVANT2, null),
|
23
|
|
24
|
CACHE1_2(Resources.COLOR_COMPOSITE_IRRELEVANT1_2, null),
|
25
|
CACHE1_LIGHT(Resources.COLOR_COMPOSITE_IRRELEVANT1_LIGHT, CACHE1),
|
26
|
CACHE2_LIGHT(Resources.COLOR_COMPOSITE_IRRELEVANT2_LIGHT, CACHE2),
|
27
|
CACHE1_2_LIGHT(Resources.COLOR_COMPOSITE_IRRELEVANT1_2_LIGHT, CACHE1_2),
|
28
|
NONE(Resources.COLOR_COMPOSITE_BACKGROUND, null),
|
29
|
;
|
30
|
|
31
|
private final Color color;
|
32
|
private CacheRelevance light;
|
33
|
|
34
|
|
35
|
private CacheRelevance(String colorStr, CacheRelevance main){
|
36
|
this.color = AbstractUtility.getColor(colorStr);
|
37
|
light = this;
|
38
|
if (main != null){
|
39
|
main.light = this;
|
40
|
}
|
41
|
}
|
42
|
|
43
|
public Color getColor() {
|
44
|
return color;
|
45
|
}
|
46
|
public Color getColorLight() {
|
47
|
return color;
|
48
|
}
|
49
|
|
50
|
public Color getColor(String alternativeColorForNone) {
|
51
|
if (this == NONE){
|
52
|
return AbstractUtility.getColor(alternativeColorForNone);
|
53
|
}else{
|
54
|
return color;
|
55
|
}
|
56
|
}
|
57
|
|
58
|
public CacheRelevance addCacheRelevance(CacheRelevance that){
|
59
|
if (this == CACHE1 && that == CACHE2 || this == CACHE2 && that == CACHE1){
|
60
|
return CACHE1_2;
|
61
|
} else if (this == CACHE1_LIGHT && that == CACHE2_LIGHT || this == CACHE2_LIGHT && that == CACHE1_LIGHT){
|
62
|
return CACHE1_2_LIGHT;
|
63
|
}else {
|
64
|
return CacheRelevance.values()[Math.min(this.ordinal(), that.ordinal())];
|
65
|
}
|
66
|
}
|
67
|
|
68
|
public CacheRelevance getLight(){
|
69
|
return light;
|
70
|
}
|
71
|
|
72
|
}
|