Project

General

Profile

Download (5.14 KB) Statistics
| Branch: | Tag: | Revision:
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.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
                configRegistry.registerConfigAttribute(
71
                        EditConfigAttributes.CELL_EDITOR,
72
                        new ComboBoxCellEditor(dataProvider, dataProvider.getMaxVisibleItems()),
73
                        DisplayMode.NORMAL,
74
                        FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + i);
75

    
76

    
77

    
78
            configRegistry.registerConfigAttribute(
79
                    FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
80
                    new StatusDisplayConverter(),
81
                    DisplayMode.NORMAL,
82
                    FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX+i);
83

    
84
            configRegistry.registerConfigAttribute(
85
                    CellConfigAttributes.DISPLAY_CONVERTER,
86
                    new StatusDisplayConverter(),
87
                    DisplayMode.NORMAL,
88
                    DistributionEditorConfigLabelAccumulator.STATUS);
89

    
90
            }
91

    
92

    
93
//            // register the FilterRowTextCellEditor in the first column which
94
//            // immediately commits on key press
95
//            configRegistry.registerConfigAttribute(
96
//                    EditConfigAttributes.CELL_EDITOR,
97
//                    new FilterRowTextCellEditor(),
98
//                    DisplayMode.NORMAL,
99
//                    FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
100
//                            + DistributionEditorConfigLabelAccumulator.STATUS);
101
//
102
//            configRegistry.registerConfigAttribute(
103
//                    FilterRowConfigAttributes.TEXT_MATCHING_MODE,
104
//                    TextMatchingMode.CONTAINS,
105
//                    DisplayMode.NORMAL,
106
//                    FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
107
//                    + DistributionEditorConfigLabelAccumulator.STATUS);
108
//
109
//            configRegistry.registerConfigAttribute(
110
//                    CellConfigAttributes.DISPLAY_CONVERTER,
111
//                    new StatusDisplayConverter(),
112
//                    DisplayMode.NORMAL,
113
//                    FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
114
//                    + DistributionEditorConfigLabelAccumulator.STATUS);
115

    
116

    
117

    
118

    
119

    
120
            configRegistry.registerConfigAttribute(
121
                    FilterRowConfigAttributes.TEXT_DELIMITER, "&"); //$NON-NLS-1$
122

    
123
        }
124

    
125
}
(14-14/19)