Revision d12e0f5d
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CellEditorDataConversionConfiguration.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix; |
11 | 11 |
|
12 |
import java.util.HashMap; |
|
13 |
import java.util.Map; |
|
14 |
|
|
12 | 15 |
import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration; |
13 | 16 |
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; |
14 | 17 |
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; |
15 | 18 |
import org.eclipse.nebula.widgets.nattable.config.IEditableRule; |
16 | 19 |
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; |
20 |
import org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog; |
|
17 | 21 |
import org.eclipse.nebula.widgets.nattable.style.DisplayMode; |
22 |
import org.eclipse.swt.graphics.Point; |
|
18 | 23 |
|
19 | 24 |
import eu.etaxonomy.cdm.model.description.Feature; |
20 | 25 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical.CategoricalDataCellEditor; |
21 | 26 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical.CategoricalDataDisplayConverter; |
22 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataCellEditor; |
|
23 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataDisplayConverter; |
|
27 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataDialogEditor; |
|
28 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataNormalModeDisplayConverter; |
|
29 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataEditModeDisplayConverter; |
|
24 | 30 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.supplementalInfo.SupplementalInfoDisplayConverter; |
25 | 31 |
|
26 | 32 |
/** |
... | ... | |
28 | 34 |
* @date 09.07.2018 |
29 | 35 |
* |
30 | 36 |
*/ |
31 |
final class DataConversionConfiguration extends AbstractRegistryConfiguration { |
|
37 |
final class CellEditorDataConversionConfiguration extends AbstractRegistryConfiguration {
|
|
32 | 38 |
|
33 | 39 |
private CharacterMatrix matrix; |
34 | 40 |
|
35 |
public DataConversionConfiguration(CharacterMatrix matrix) { |
|
41 |
public CellEditorDataConversionConfiguration(CharacterMatrix matrix) {
|
|
36 | 42 |
super(); |
37 | 43 |
this.matrix = matrix; |
38 | 44 |
} |
... | ... | |
76 | 82 |
//add display converter for string representation |
77 | 83 |
configRegistry.registerConfigAttribute( |
78 | 84 |
CellConfigAttributes.DISPLAY_CONVERTER, |
79 |
new QuantitativeDataDisplayConverter(), |
|
85 |
new QuantitativeDataEditModeDisplayConverter(), |
|
86 |
DisplayMode.EDIT, |
|
87 |
MatrixUtility.getProperty(feature)); |
|
88 |
configRegistry.registerConfigAttribute( |
|
89 |
CellConfigAttributes.DISPLAY_CONVERTER, |
|
90 |
new QuantitativeDataNormalModeDisplayConverter(), |
|
80 | 91 |
DisplayMode.NORMAL, |
81 | 92 |
MatrixUtility.getProperty(feature)); |
93 |
//Open cell editorin dialog |
|
94 |
configRegistry.registerConfigAttribute( |
|
95 |
EditConfigAttributes.OPEN_IN_DIALOG, |
|
96 |
Boolean.TRUE, |
|
97 |
DisplayMode.EDIT, |
|
98 |
MatrixUtility.getProperty(feature)); |
|
82 | 99 |
//register quantitative editor |
83 | 100 |
configRegistry.registerConfigAttribute( |
84 | 101 |
EditConfigAttributes.CELL_EDITOR, |
85 |
new QuantitativeDataCellEditor(feature, matrix),
|
|
102 |
new QuantitativeDataDialogEditor(matrix),
|
|
86 | 103 |
DisplayMode.EDIT, |
87 | 104 |
MatrixUtility.getProperty(feature)); |
105 |
// configure custom dialog settings |
|
106 |
Map<String, Object> editDialogSettings = new HashMap<>(); |
|
107 |
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_TITLE, "Quantitative Data"); |
|
108 |
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_RESIZABLE, Boolean.TRUE); |
|
109 |
|
|
110 |
Point size = new Point(230, 300); |
|
111 |
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_SIZE, size); |
|
112 |
|
|
113 |
// add custum message |
|
114 |
//FIXME: this is not displayed because the cell editor |
|
115 |
//is already a dialog. Maybe the cell editor and the |
|
116 |
//dialog can be merged |
|
117 |
editDialogSettings.put(ICellEditDialog.DIALOG_MESSAGE, "Enter exact values:"); |
|
118 |
|
|
119 |
configRegistry.registerConfigAttribute( |
|
120 |
EditConfigAttributes.EDIT_DIALOG_SETTINGS, |
|
121 |
editDialogSettings, |
|
122 |
DisplayMode.EDIT, |
|
123 |
MatrixUtility.getProperty(feature)); |
|
124 |
|
|
88 | 125 |
} |
89 | 126 |
else if(feature.isSupportsCategoricalData()){ |
90 | 127 |
//add display converter for string representation |
Also available in: Unified diff
ref #7575 Enable quantitative dialog cell editor