Revision 7c3f1a46
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CellEditorDataConversionConfiguration.java | ||
---|---|---|
24 | 24 |
import eu.etaxonomy.cdm.model.description.Feature; |
25 | 25 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical.CategoricalDataCellEditor; |
26 | 26 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical.CategoricalDataDisplayConverter; |
27 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataCellEditor; |
|
27 | 28 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataDialogEditor; |
28 | 29 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataEditModeDisplayConverter; |
29 | 30 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataNormalModeDisplayConverter; |
... | ... | |
70 | 71 |
|
71 | 72 |
//---register cell editors--- |
72 | 73 |
|
73 |
//categorical cell editor |
|
74 |
/** |
|
75 |
* categorical cell editor |
|
76 |
*/ |
|
74 | 77 |
//make cell editable |
75 | 78 |
configRegistry.registerConfigAttribute( |
76 | 79 |
EditConfigAttributes.CELL_EDITABLE_RULE, |
... | ... | |
87 | 90 |
); |
88 | 91 |
|
89 | 92 |
|
90 |
//quantitative cell editor |
|
93 |
/** |
|
94 |
* quantitative cell editor |
|
95 |
*/ |
|
91 | 96 |
//make cell editable |
92 | 97 |
configRegistry.registerConfigAttribute( |
93 | 98 |
EditConfigAttributes.CELL_EDITABLE_RULE, |
... | ... | |
95 | 100 |
DisplayMode.EDIT, |
96 | 101 |
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE |
97 | 102 |
); |
98 |
//add display converter for string representation |
|
103 |
//add display converter for string representation
|
|
99 | 104 |
configRegistry.registerConfigAttribute( |
100 | 105 |
CellConfigAttributes.DISPLAY_CONVERTER, |
101 | 106 |
new QuantitativeDataEditModeDisplayConverter(), |
... | ... | |
106 | 111 |
new QuantitativeDataNormalModeDisplayConverter(), |
107 | 112 |
DisplayMode.NORMAL, |
108 | 113 |
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE); |
109 |
//Open cell editorin dialog |
|
114 |
|
|
115 |
/** |
|
116 |
* exact value editor |
|
117 |
*/ |
|
118 |
//Open cell editor in dialog |
|
110 | 119 |
configRegistry.registerConfigAttribute( |
111 | 120 |
EditConfigAttributes.OPEN_IN_DIALOG, |
112 | 121 |
Boolean.TRUE, |
113 | 122 |
DisplayMode.EDIT, |
114 |
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE);
|
|
123 |
CharacterMatrixConfigLabelAccumulator.QUANT_EXACT);
|
|
115 | 124 |
//register quantitative editor |
116 | 125 |
configRegistry.registerConfigAttribute( |
117 | 126 |
EditConfigAttributes.CELL_EDITOR, |
118 | 127 |
new QuantitativeDataDialogEditor(matrix), |
119 | 128 |
DisplayMode.EDIT, |
120 |
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE);
|
|
129 |
CharacterMatrixConfigLabelAccumulator.QUANT_EXACT);
|
|
121 | 130 |
// configure custom dialog settings |
122 | 131 |
Map<String, Object> editDialogSettings = new HashMap<>(); |
123 | 132 |
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_TITLE, "Quantitative Data"); |
... | ... | |
136 | 145 |
EditConfigAttributes.EDIT_DIALOG_SETTINGS, |
137 | 146 |
editDialogSettings, |
138 | 147 |
DisplayMode.EDIT, |
139 |
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE);
|
|
148 |
CharacterMatrixConfigLabelAccumulator.QUANT_EXACT);
|
|
140 | 149 |
|
141 | 150 |
|
142 | 151 |
//TODO: this for loop can maybe be avoided |
... | ... | |
144 | 153 |
} |
145 | 154 |
|
146 | 155 |
private void registerColumnConfiguration(Feature feature, IConfigRegistry configRegistry) { |
147 |
if(feature.isSupportsCategoricalData()){ |
|
156 |
if(feature.isSupportsQuantitativeData()){ |
|
157 |
/** |
|
158 |
* aggregated value editor |
|
159 |
*/ |
|
160 |
configRegistry.registerConfigAttribute( |
|
161 |
EditConfigAttributes.CELL_EDITOR, |
|
162 |
new QuantitativeDataCellEditor(feature, matrix), |
|
163 |
DisplayMode.EDIT, |
|
164 |
CharacterMatrixConfigLabelAccumulator.QUANT_AGGREGATED); |
|
165 |
} |
|
166 |
else if(feature.isSupportsCategoricalData()){ |
|
148 | 167 |
//add combo box cell editor |
149 | 168 |
//register editor |
150 | 169 |
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java | ||
---|---|---|
162 | 162 |
|
163 | 163 |
private boolean isShowTooltips = true; |
164 | 164 |
|
165 |
private boolean isExactQuantitativeValue = true; |
|
166 |
|
|
165 | 167 |
public CharacterMatrix(Composite parent, CharacterMatrixPart part) { |
166 | 168 |
super(parent, SWT.NONE); |
167 | 169 |
this.part = part; |
... | ... | |
644 | 646 |
return isShowTooltips; |
645 | 647 |
} |
646 | 648 |
|
649 |
public void toogleExactQuantitativeValue() { |
|
650 |
this.isExactQuantitativeValue = !this.isExactQuantitativeValue; |
|
651 |
} |
|
652 |
|
|
653 |
public boolean isExactQuantitativeValue() { |
|
654 |
return isExactQuantitativeValue; |
|
655 |
} |
|
656 |
|
|
647 | 657 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixConfigLabelAccumulator.java | ||
---|---|---|
22 | 22 |
public class CharacterMatrixConfigLabelAccumulator implements IConfigLabelAccumulator { |
23 | 23 |
|
24 | 24 |
public static final String QUANTITATIVE = "QUANTITATIVE"; |
25 |
public static final String QUANT_AGGREGATED = QUANTITATIVE+"_AGGREGATED"; |
|
26 |
public static final String QUANT_EXACT = QUANTITATIVE+"_EXACT"; |
|
25 | 27 |
public static final String CATEGORICAL = "CATEGORICAL"; |
26 | 28 |
|
27 | 29 |
private CharacterMatrix matrix; |
... | ... | |
58 | 60 |
} |
59 | 61 |
else if(feature.isSupportsQuantitativeData()){ |
60 | 62 |
configLabels.addLabel(QUANTITATIVE); |
63 |
configLabels.addLabel(matrix.isExactQuantitativeValue()?QUANT_EXACT:QUANT_AGGREGATED); |
|
61 | 64 |
} |
62 | 65 |
} |
63 | 66 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixToolbar.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
private void init() { |
64 | 64 |
setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
65 |
setLayout(new GridLayout(10, false));
|
|
65 |
setLayout(new GridLayout(11, false));
|
|
66 | 66 |
|
67 | 67 |
wsLabel = new Label(this, SWT.NONE); |
68 | 68 |
|
69 |
Button btnToggleExactQuantValue = new Button(this, SWT.TOGGLE); |
|
69 | 70 |
Button btnToggleTooltips = new Button(this, SWT.TOGGLE); |
70 | 71 |
Button btnToggleTree = new Button(this, SWT.PUSH); |
71 | 72 |
Button btnToggleFlat = new Button(this, SWT.PUSH); |
... | ... | |
77 | 78 |
Button btnExcelExport = new Button(this, SWT.PUSH); |
78 | 79 |
|
79 | 80 |
/** |
81 |
* Toggle exact quantitative value |
|
82 |
*/ |
|
83 |
initButton( |
|
84 |
btnToggleExactQuantValue, |
|
85 |
null, |
|
86 |
"Show exact values", |
|
87 |
"Exact/Aggregate", |
|
88 |
true, |
|
89 |
true, |
|
90 |
(e)->matrix.toogleExactQuantitativeValue() |
|
91 |
); |
|
92 |
/** |
|
80 | 93 |
* Toggle tooltips button |
81 | 94 |
*/ |
82 | 95 |
initButton( |
Also available in: Unified diff
ref #7575 Add toggle button for aggregated/exact quant data editing