1
|
/**
|
2
|
* Copyright (C) 2018 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.editor.descriptiveDataSet.matrix;
|
10
|
|
11
|
import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
|
12
|
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
|
13
|
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
|
14
|
import org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter;
|
15
|
import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
|
16
|
import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
|
17
|
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
|
18
|
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
|
19
|
import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum;
|
20
|
import org.eclipse.nebula.widgets.nattable.style.Style;
|
21
|
import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
|
22
|
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
|
23
|
|
24
|
/**
|
25
|
* @author pplitzner
|
26
|
* @since Jul 6, 2018
|
27
|
*
|
28
|
*/
|
29
|
public final class CharacterMatrixLabelStyleConfiguration extends AbstractRegistryConfiguration {
|
30
|
@Override
|
31
|
public void configureRegistry(IConfigRegistry configRegistry) {
|
32
|
//different background color styles
|
33
|
Style taxonRowStyle = new Style();
|
34
|
taxonRowStyle.setAttributeValue(
|
35
|
CellStyleAttributes.BACKGROUND_COLOR,
|
36
|
GUIHelper.COLOR_WIDGET_BACKGROUND);
|
37
|
configRegistry.registerConfigAttribute(
|
38
|
CellConfigAttributes.CELL_STYLE,
|
39
|
taxonRowStyle,
|
40
|
DisplayMode.NORMAL,
|
41
|
CharacterMatrix.LABEL_TAXON_ROW);
|
42
|
|
43
|
Style taxonAggregationStyle = new Style();
|
44
|
taxonAggregationStyle.setAttributeValue(
|
45
|
CellStyleAttributes.BACKGROUND_COLOR,
|
46
|
GUIHelper.getColor(255, 255, 153));
|
47
|
configRegistry.registerConfigAttribute(
|
48
|
CellConfigAttributes.CELL_STYLE,
|
49
|
taxonAggregationStyle,
|
50
|
DisplayMode.NORMAL,
|
51
|
CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION);
|
52
|
|
53
|
Style taxonDefaultDescriptionStyle = new Style();
|
54
|
taxonDefaultDescriptionStyle.setAttributeValue(
|
55
|
CellStyleAttributes.BACKGROUND_COLOR,
|
56
|
GUIHelper.COLOR_WIDGET_BACKGROUND);
|
57
|
configRegistry.registerConfigAttribute(
|
58
|
CellConfigAttributes.CELL_STYLE,
|
59
|
taxonDefaultDescriptionStyle,
|
60
|
DisplayMode.NORMAL,
|
61
|
CharacterMatrix.LABEL_TAXON_DEFAULT_DESCRIPTION);
|
62
|
|
63
|
Style hasDefaultValueStyle = new Style();
|
64
|
hasDefaultValueStyle.setAttributeValue(
|
65
|
CellStyleAttributes.BACKGROUND_COLOR,
|
66
|
GUIHelper.COLOR_WIDGET_LIGHT_SHADOW);
|
67
|
configRegistry.registerConfigAttribute(
|
68
|
CellConfigAttributes.CELL_STYLE,
|
69
|
hasDefaultValueStyle,
|
70
|
DisplayMode.NORMAL,
|
71
|
CharacterMatrixConfigLabelAccumulator.HAS_DEFAULT);
|
72
|
|
73
|
Style notEditableValueStyle = new Style();
|
74
|
notEditableValueStyle.setAttributeValue(
|
75
|
CellStyleAttributes.BACKGROUND_COLOR,
|
76
|
GUIHelper.COLOR_GRAY);
|
77
|
configRegistry.registerConfigAttribute(
|
78
|
CellConfigAttributes.CELL_STYLE,
|
79
|
notEditableValueStyle,
|
80
|
DisplayMode.NORMAL,
|
81
|
CharacterMatrixConfigLabelAccumulator.NOT_EDITABLE);
|
82
|
|
83
|
Style notApplicableValueStyle = new Style();
|
84
|
notApplicableValueStyle.setAttributeValue(
|
85
|
CellStyleAttributes.BACKGROUND_COLOR,
|
86
|
GUIHelper.COLOR_GRAY);
|
87
|
configRegistry.registerConfigAttribute(
|
88
|
CellConfigAttributes.CELL_STYLE,
|
89
|
notApplicableValueStyle,
|
90
|
DisplayMode.NORMAL,
|
91
|
CharacterMatrixConfigLabelAccumulator.NOT_APPLICABLE);
|
92
|
|
93
|
Style defaultOverriddenStyle = new Style();
|
94
|
defaultOverriddenStyle.setAttributeValue(
|
95
|
CellStyleAttributes.BACKGROUND_COLOR,
|
96
|
GUIHelper.getColor(255, 128, 0));
|
97
|
configRegistry.registerConfigAttribute(
|
98
|
CellConfigAttributes.CELL_STYLE,
|
99
|
defaultOverriddenStyle,
|
100
|
DisplayMode.NORMAL,
|
101
|
CharacterMatrixConfigLabelAccumulator.DEFAULT_OVERRIDDEN);
|
102
|
|
103
|
//cell painter for supplemental data
|
104
|
configRegistry.registerConfigAttribute(
|
105
|
CellConfigAttributes.CELL_PAINTER,
|
106
|
new CellPainterDecorator(
|
107
|
new TextPainter(),
|
108
|
CellEdgeEnum.BOTTOM_RIGHT,
|
109
|
new ImagePainter(GUIHelper.getImage("plus")),
|
110
|
false),
|
111
|
DisplayMode.NORMAL,
|
112
|
CharacterMatrix.LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA);
|
113
|
|
114
|
Style style = new Style();
|
115
|
|
116
|
style.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT);
|
117
|
configRegistry.registerConfigAttribute(
|
118
|
CellConfigAttributes.CELL_STYLE,
|
119
|
style,
|
120
|
DisplayMode.NORMAL,
|
121
|
CharacterMatrix.IDENTIFIER_COLUMN);
|
122
|
configRegistry.registerConfigAttribute(
|
123
|
CellConfigAttributes.CELL_STYLE,
|
124
|
style,
|
125
|
DisplayMode.NORMAL,
|
126
|
CharacterMatrix.COLLECTOR_COLUMN);
|
127
|
configRegistry.registerConfigAttribute(
|
128
|
CellConfigAttributes.CELL_STYLE,
|
129
|
style,
|
130
|
DisplayMode.NORMAL,
|
131
|
CharacterMatrix.COUNTRY_COLUMN);
|
132
|
configRegistry.registerConfigAttribute(
|
133
|
CellConfigAttributes.CELL_STYLE,
|
134
|
style,
|
135
|
DisplayMode.NORMAL,
|
136
|
CharacterMatrix.TAXON_COLUMN);
|
137
|
|
138
|
|
139
|
/*
|
140
|
* cell painter for description icons
|
141
|
*/
|
142
|
//literature
|
143
|
configRegistry.registerConfigAttribute(
|
144
|
CellConfigAttributes.CELL_PAINTER,
|
145
|
new CellPainterDecorator(
|
146
|
new TextPainter(),
|
147
|
CellEdgeEnum.LEFT,
|
148
|
new ImagePainter(MatrixUtility.getLiteratureDescriptionIcon()),
|
149
|
true),
|
150
|
DisplayMode.NORMAL,
|
151
|
CharacterMatrix.LABEL_TAXON_LITERATURE_DESCRIPTION_ICON);
|
152
|
//aggregation
|
153
|
configRegistry.registerConfigAttribute(
|
154
|
CellConfigAttributes.CELL_PAINTER,
|
155
|
new CellPainterDecorator(
|
156
|
new TextPainter(),
|
157
|
CellEdgeEnum.LEFT,
|
158
|
new ImagePainter(MatrixUtility.getAggregatedDescriptionIcon()),
|
159
|
true),
|
160
|
DisplayMode.NORMAL,
|
161
|
CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION_ICON);
|
162
|
//default
|
163
|
configRegistry.registerConfigAttribute(
|
164
|
CellConfigAttributes.CELL_PAINTER,
|
165
|
new CellPainterDecorator(
|
166
|
new TextPainter(),
|
167
|
CellEdgeEnum.LEFT,
|
168
|
new ImagePainter(MatrixUtility.getDefaultDescriptionIcon()),
|
169
|
true),
|
170
|
DisplayMode.NORMAL,
|
171
|
CharacterMatrix.LABEL_TAXON_DEFAULT_DESCRIPTION_ICON);
|
172
|
}
|
173
|
}
|