1 |
278a5e0a
|
Katja Luther
|
/**
|
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.edit.EditConfigAttributes;
|
15 |
|
|
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
|
16 |
|
|
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataLayer;
|
17 |
|
|
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowTextCellEditor;
|
18 |
|
|
import org.eclipse.nebula.widgets.nattable.filterrow.TextMatchingMode;
|
19 |
|
|
import org.eclipse.nebula.widgets.nattable.filterrow.config.FilterRowConfigAttributes;
|
20 |
|
|
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
|
21 |
|
|
|
22 |
|
|
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.supplementalInfo.SupplementalInfoDisplayConverter;
|
23 |
|
|
|
24 |
|
|
/**
|
25 |
|
|
* @author k.luther
|
26 |
|
|
* @since 13.12.2018
|
27 |
|
|
*
|
28 |
|
|
*/
|
29 |
|
|
public class FilterRowConfiguration extends AbstractRegistryConfiguration {
|
30 |
|
|
|
31 |
|
|
DistributionEditor editor;
|
32 |
|
|
|
33 |
|
|
/**
|
34 |
|
|
* @param distributionEditor
|
35 |
|
|
*/
|
36 |
|
|
public FilterRowConfiguration(DistributionEditor distributionEditor) {
|
37 |
|
|
editor = distributionEditor;
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
@Override
|
41 |
|
|
public void configureRegistry(IConfigRegistry configRegistry) {
|
42 |
|
|
|
43 |
|
|
// register the FilterRowTextCellEditor in the first column which
|
44 |
|
|
// immediately commits on key press
|
45 |
|
|
configRegistry.registerConfigAttribute(
|
46 |
|
|
EditConfigAttributes.CELL_EDITOR,
|
47 |
|
|
new FilterRowTextCellEditor(),
|
48 |
|
|
DisplayMode.NORMAL,
|
49 |
|
|
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 1);
|
50 |
|
|
|
51 |
|
|
configRegistry.registerConfigAttribute(
|
52 |
|
|
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
|
53 |
|
|
TextMatchingMode.CONTAINS,
|
54 |
|
|
DisplayMode.NORMAL,
|
55 |
|
|
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 1);
|
56 |
|
|
|
57 |
|
|
configRegistry.registerConfigAttribute(
|
58 |
|
|
CellConfigAttributes.DISPLAY_CONVERTER,
|
59 |
|
|
new SupplementalInfoDisplayConverter(),
|
60 |
|
|
DisplayMode.NORMAL,
|
61 |
|
|
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 1);
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
// Register a combo box editor to be displayed in the filter row
|
65 |
|
|
// cell when a value is selected from the combo, the object is
|
66 |
|
|
// converted to a string using the converter (registered below)
|
67 |
|
|
StatusComboBoxDataProvider dataProvider;
|
68 |
|
|
for (int i = 1; i <= editor.areas.size(); ++i) {
|
69 |
|
|
dataProvider = new StatusComboBoxDataProvider(editor);
|
70 |
10aaa73f
|
Katja Luther
|
ComboBoxCellEditor cellEditor = new ComboBoxCellEditor(dataProvider, dataProvider.getMaxVisibleItems());
|
71 |
|
|
cellEditor.setFreeEdit(true);
|
72 |
278a5e0a
|
Katja Luther
|
configRegistry.registerConfigAttribute(
|
73 |
|
|
EditConfigAttributes.CELL_EDITOR,
|
74 |
10aaa73f
|
Katja Luther
|
cellEditor,
|
75 |
278a5e0a
|
Katja Luther
|
DisplayMode.NORMAL,
|
76 |
|
|
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + i);
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
configRegistry.registerConfigAttribute(
|
81 |
|
|
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
|
82 |
|
|
new StatusDisplayConverter(),
|
83 |
|
|
DisplayMode.NORMAL,
|
84 |
|
|
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX+i);
|
85 |
|
|
|
86 |
|
|
configRegistry.registerConfigAttribute(
|
87 |
|
|
CellConfigAttributes.DISPLAY_CONVERTER,
|
88 |
|
|
new StatusDisplayConverter(),
|
89 |
|
|
DisplayMode.NORMAL,
|
90 |
|
|
DistributionEditorConfigLabelAccumulator.STATUS);
|
91 |
|
|
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
// // register the FilterRowTextCellEditor in the first column which
|
96 |
|
|
// // immediately commits on key press
|
97 |
|
|
// configRegistry.registerConfigAttribute(
|
98 |
|
|
// EditConfigAttributes.CELL_EDITOR,
|
99 |
|
|
// new FilterRowTextCellEditor(),
|
100 |
|
|
// DisplayMode.NORMAL,
|
101 |
|
|
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
|
102 |
|
|
// + DistributionEditorConfigLabelAccumulator.STATUS);
|
103 |
|
|
//
|
104 |
|
|
// configRegistry.registerConfigAttribute(
|
105 |
|
|
// FilterRowConfigAttributes.TEXT_MATCHING_MODE,
|
106 |
|
|
// TextMatchingMode.CONTAINS,
|
107 |
|
|
// DisplayMode.NORMAL,
|
108 |
|
|
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
|
109 |
|
|
// + DistributionEditorConfigLabelAccumulator.STATUS);
|
110 |
|
|
//
|
111 |
|
|
// configRegistry.registerConfigAttribute(
|
112 |
|
|
// CellConfigAttributes.DISPLAY_CONVERTER,
|
113 |
|
|
// new StatusDisplayConverter(),
|
114 |
|
|
// DisplayMode.NORMAL,
|
115 |
|
|
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
|
116 |
|
|
// + DistributionEditorConfigLabelAccumulator.STATUS);
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
configRegistry.registerConfigAttribute(
|
123 |
|
|
FilterRowConfigAttributes.TEXT_DELIMITER, "&"); //$NON-NLS-1$
|
124 |
|
|
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
}
|