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.view.checklist.e4;
|
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.config.IEditableRule;
|
15
|
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
|
16
|
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowTextCellEditor;
|
17
|
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
|
18
|
|
19
|
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.supplementalInfo.SupplementalInfoDisplayConverter;
|
20
|
|
21
|
/**
|
22
|
* @author k.luther
|
23
|
* @since 05.12.2018
|
24
|
*
|
25
|
*/
|
26
|
public class DistributionCellEditorDataConversionConfiguration extends AbstractRegistryConfiguration {
|
27
|
private DistributionEditor editor;
|
28
|
|
29
|
public DistributionCellEditorDataConversionConfiguration(DistributionEditor editor) {
|
30
|
super();
|
31
|
this.editor = editor;
|
32
|
}
|
33
|
|
34
|
@Override
|
35
|
public void configureRegistry(IConfigRegistry configRegistry) {
|
36
|
|
37
|
//add display converter for string representation
|
38
|
configRegistry.registerConfigAttribute(
|
39
|
CellConfigAttributes.DISPLAY_CONVERTER,
|
40
|
new SupplementalInfoDisplayConverter(),
|
41
|
DisplayMode.NORMAL,
|
42
|
DistributionEditor.TAXON_COLUMN);
|
43
|
|
44
|
configRegistry.registerConfigAttribute(
|
45
|
CellConfigAttributes.DISPLAY_CONVERTER,
|
46
|
new SupplementalInfoDisplayConverter(),
|
47
|
DisplayMode.NORMAL,
|
48
|
DistributionEditor.RANK_COLUMN);
|
49
|
|
50
|
configRegistry.registerConfigAttribute(
|
51
|
CellConfigAttributes.DISPLAY_CONVERTER,
|
52
|
new StatusDataDisplayConverter(),
|
53
|
DisplayMode.NORMAL,
|
54
|
DistributionEditorConfigLabelAccumulator.STATUS
|
55
|
);
|
56
|
|
57
|
//---register cell editors---
|
58
|
|
59
|
|
60
|
//make cell editable
|
61
|
configRegistry.registerConfigAttribute(
|
62
|
EditConfigAttributes.CELL_EDITABLE_RULE,
|
63
|
IEditableRule.ALWAYS_EDITABLE,
|
64
|
DisplayMode.EDIT,
|
65
|
DistributionEditorConfigLabelAccumulator.STATUS_EDITABLE
|
66
|
);
|
67
|
//add display converter for string representation
|
68
|
configRegistry.registerConfigAttribute(
|
69
|
CellConfigAttributes.DISPLAY_CONVERTER,
|
70
|
new StatusDisplayConverter(),
|
71
|
DisplayMode.NORMAL,
|
72
|
DistributionEditorConfigLabelAccumulator.STATUS
|
73
|
);
|
74
|
//register status editor
|
75
|
|
76
|
StatusDataCellEditor cellEditor = new StatusDataCellEditor(editor, new StatusComboBoxDataProvider(editor));
|
77
|
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR,
|
78
|
cellEditor,
|
79
|
DisplayMode.EDIT,
|
80
|
DistributionEditorConfigLabelAccumulator.STATUS_EDITABLE
|
81
|
);
|
82
|
|
83
|
|
84
|
|
85
|
FilterRowTextCellEditor filterCellEditor = new FilterRowTextCellEditor();
|
86
|
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR,
|
87
|
filterCellEditor,
|
88
|
DisplayMode.EDIT,
|
89
|
DistributionEditorConfigLabelAccumulator.FILTER_EDITABLE
|
90
|
);
|
91
|
|
92
|
|
93
|
|
94
|
|
95
|
|
96
|
|
97
|
|
98
|
}
|
99
|
|
100
|
}
|