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