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.Style;
|
20
|
import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
|
21
|
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
|
22
|
|
23
|
/**
|
24
|
* @author pplitzner
|
25
|
* @since Jul 6, 2018
|
26
|
*
|
27
|
*/
|
28
|
public final class CharacterMatrixLabelStyleConfiguration extends AbstractRegistryConfiguration {
|
29
|
@Override
|
30
|
public void configureRegistry(IConfigRegistry configRegistry) {
|
31
|
//different background color styles
|
32
|
Style taxonRowStyle = new Style();
|
33
|
taxonRowStyle.setAttributeValue(
|
34
|
CellStyleAttributes.BACKGROUND_COLOR,
|
35
|
GUIHelper.COLOR_WIDGET_BACKGROUND);
|
36
|
configRegistry.registerConfigAttribute(
|
37
|
CellConfigAttributes.CELL_STYLE,
|
38
|
taxonRowStyle,
|
39
|
DisplayMode.NORMAL,
|
40
|
CharacterMatrix.LABEL_TAXON_ROW);
|
41
|
|
42
|
Style taxonAggregationStyle = new Style();
|
43
|
taxonAggregationStyle.setAttributeValue(
|
44
|
CellStyleAttributes.BACKGROUND_COLOR,
|
45
|
GUIHelper.getColor(255, 255, 153));
|
46
|
configRegistry.registerConfigAttribute(
|
47
|
CellConfigAttributes.CELL_STYLE,
|
48
|
taxonAggregationStyle,
|
49
|
DisplayMode.NORMAL,
|
50
|
CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION);
|
51
|
|
52
|
Style taxonDefaultDescriptionStyle = new Style();
|
53
|
taxonDefaultDescriptionStyle.setAttributeValue(
|
54
|
CellStyleAttributes.BACKGROUND_COLOR,
|
55
|
GUIHelper.COLOR_WIDGET_BACKGROUND);
|
56
|
configRegistry.registerConfigAttribute(
|
57
|
CellConfigAttributes.CELL_STYLE,
|
58
|
taxonDefaultDescriptionStyle,
|
59
|
DisplayMode.NORMAL,
|
60
|
CharacterMatrix.LABEL_TAXON_DEFAULT_DESCRIPTION);
|
61
|
|
62
|
Style hasDefaultValueStyle = new Style();
|
63
|
hasDefaultValueStyle.setAttributeValue(
|
64
|
CellStyleAttributes.BACKGROUND_COLOR,
|
65
|
GUIHelper.COLOR_GRAY);
|
66
|
configRegistry.registerConfigAttribute(
|
67
|
CellConfigAttributes.CELL_STYLE,
|
68
|
hasDefaultValueStyle,
|
69
|
DisplayMode.NORMAL,
|
70
|
CharacterMatrixConfigLabelAccumulator.HAS_DEFAULT);
|
71
|
|
72
|
Style defaultOverriddenStyle = new Style();
|
73
|
defaultOverriddenStyle.setAttributeValue(
|
74
|
CellStyleAttributes.BACKGROUND_COLOR,
|
75
|
GUIHelper.COLOR_RED);
|
76
|
configRegistry.registerConfigAttribute(
|
77
|
CellConfigAttributes.CELL_STYLE,
|
78
|
defaultOverriddenStyle,
|
79
|
DisplayMode.NORMAL,
|
80
|
CharacterMatrixConfigLabelAccumulator.DEFAULT_OVERRIDDEN);
|
81
|
|
82
|
//cell painter for supplemental data
|
83
|
configRegistry.registerConfigAttribute(
|
84
|
CellConfigAttributes.CELL_PAINTER,
|
85
|
new CellPainterDecorator(
|
86
|
new TextPainter(),
|
87
|
CellEdgeEnum.BOTTOM_RIGHT,
|
88
|
new ImagePainter(GUIHelper.getImage("plus")),
|
89
|
false),
|
90
|
DisplayMode.NORMAL,
|
91
|
CharacterMatrix.LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA);
|
92
|
|
93
|
/*
|
94
|
* cell painter for description icons
|
95
|
*/
|
96
|
//literature
|
97
|
configRegistry.registerConfigAttribute(
|
98
|
CellConfigAttributes.CELL_PAINTER,
|
99
|
new CellPainterDecorator(
|
100
|
new TextPainter(),
|
101
|
CellEdgeEnum.LEFT,
|
102
|
new ImagePainter(MatrixUtility.getLiteratureDescriptionIcon()),
|
103
|
true),
|
104
|
DisplayMode.NORMAL,
|
105
|
CharacterMatrix.LABEL_TAXON_LITERATURE_DESCRIPTION_ICON);
|
106
|
//aggregation
|
107
|
configRegistry.registerConfigAttribute(
|
108
|
CellConfigAttributes.CELL_PAINTER,
|
109
|
new CellPainterDecorator(
|
110
|
new TextPainter(),
|
111
|
CellEdgeEnum.LEFT,
|
112
|
new ImagePainter(MatrixUtility.getAggregatedDescriptionIcon()),
|
113
|
true),
|
114
|
DisplayMode.NORMAL,
|
115
|
CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION_ICON);
|
116
|
//default
|
117
|
configRegistry.registerConfigAttribute(
|
118
|
CellConfigAttributes.CELL_PAINTER,
|
119
|
new CellPainterDecorator(
|
120
|
new TextPainter(),
|
121
|
CellEdgeEnum.LEFT,
|
122
|
new ImagePainter(MatrixUtility.getDefaultDescriptionIcon()),
|
123
|
true),
|
124
|
DisplayMode.NORMAL,
|
125
|
CharacterMatrix.LABEL_TAXON_DEFAULT_DESCRIPTION_ICON);
|
126
|
}
|
127
|
}
|