Revision 6fde7721
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorBodyLayerConfigLabelAccumulator.java | ||
---|---|---|
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.bulkeditor.e4; |
|
10 |
|
|
11 |
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; |
|
12 |
import org.eclipse.nebula.widgets.nattable.layer.LabelStack; |
|
13 |
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator; |
|
14 |
|
|
15 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
16 |
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput; |
|
17 |
|
|
18 |
/** |
|
19 |
* @author pplitzner |
|
20 |
* @since Jul 6, 2018 |
|
21 |
* |
|
22 |
*/ |
|
23 |
public class BulkEditorBodyLayerConfigLabelAccumulator implements IConfigLabelAccumulator { |
|
24 |
|
|
25 |
private AbstractBulkEditorInput<?> input; |
|
26 |
private ListDataProvider<CdmBase> bodyDataProvider; |
|
27 |
|
|
28 |
public BulkEditorBodyLayerConfigLabelAccumulator(ListDataProvider<CdmBase> bodyDataProvider, |
|
29 |
AbstractBulkEditorInput<?> input) { |
|
30 |
this.input = input; |
|
31 |
this.bodyDataProvider = bodyDataProvider; |
|
32 |
} |
|
33 |
|
|
34 |
|
|
35 |
@Override |
|
36 |
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { |
|
37 |
if(rowPosition<0){ |
|
38 |
return; |
|
39 |
} |
|
40 |
CdmBase rowObject = bodyDataProvider.getRowObject(rowPosition); |
|
41 |
if(input.getMergeCandidates().contains(rowObject)){ |
|
42 |
configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE); |
|
43 |
if(columnPosition==0){ |
|
44 |
configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE_ICON); |
|
45 |
} |
|
46 |
} |
|
47 |
else if(input.getMergeTarget()==rowObject){ |
|
48 |
configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET); |
|
49 |
if(columnPosition==0){ |
|
50 |
configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET_ICON); |
|
51 |
} |
|
52 |
} |
|
53 |
} |
|
54 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorConfigLabelAccumulator.java | ||
---|---|---|
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.bulkeditor.e4; |
|
10 |
|
|
11 |
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; |
|
12 |
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider; |
|
13 |
import org.eclipse.nebula.widgets.nattable.layer.LabelStack; |
|
14 |
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator; |
|
15 |
|
|
16 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
17 |
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput; |
|
18 |
|
|
19 |
/** |
|
20 |
* @author pplitzner |
|
21 |
* @since Jul 6, 2018 |
|
22 |
* |
|
23 |
*/ |
|
24 |
public class BulkEditorConfigLabelAccumulator implements IConfigLabelAccumulator { |
|
25 |
|
|
26 |
private ListDataProvider<CdmBase> dataProvider; |
|
27 |
private AbstractBulkEditorInput input; |
|
28 |
private DefaultColumnHeaderDataProvider colHeaderDataProvider; |
|
29 |
|
|
30 |
public BulkEditorConfigLabelAccumulator(ListDataProvider<CdmBase> dataProvider, |
|
31 |
DefaultColumnHeaderDataProvider colHeaderDataProvider, AbstractBulkEditorInput input) { |
|
32 |
this.dataProvider = dataProvider; |
|
33 |
this.colHeaderDataProvider = colHeaderDataProvider; |
|
34 |
this.input = input; |
|
35 |
} |
|
36 |
|
|
37 |
|
|
38 |
@Override |
|
39 |
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { |
|
40 |
if(rowPosition<0){ |
|
41 |
return; |
|
42 |
} |
|
43 |
if(input.isBooleanProperty(colHeaderDataProvider.getColumnHeaderLabel(columnPosition))){ |
|
44 |
configLabels.addLabel(BulkEditorConfigLabelAccumulatorHeader.BOOLEAN_COLUMN); |
|
45 |
} |
|
46 |
CdmBase rowObject = dataProvider.getRowObject(rowPosition); |
|
47 |
if(input.getMergeCandidates().contains(rowObject)){ |
|
48 |
configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE); |
|
49 |
if(columnPosition==0){ |
|
50 |
configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE_ICON); |
|
51 |
} |
|
52 |
} |
|
53 |
else if(input.getMergeTarget()==rowObject){ |
|
54 |
configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET); |
|
55 |
if(columnPosition==0){ |
|
56 |
configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET_ICON); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
|
60 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorDataLayerConfigLabelAccumulator.java | ||
---|---|---|
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.bulkeditor.e4; |
|
10 |
|
|
11 |
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider; |
|
12 |
import org.eclipse.nebula.widgets.nattable.layer.LabelStack; |
|
13 |
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator; |
|
14 |
|
|
15 |
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput; |
|
16 |
|
|
17 |
/** |
|
18 |
* @author pplitzner |
|
19 |
* @since Jul 6, 2018 |
|
20 |
* |
|
21 |
*/ |
|
22 |
public class BulkEditorDataLayerConfigLabelAccumulator implements IConfigLabelAccumulator { |
|
23 |
|
|
24 |
private AbstractBulkEditorInput<?> input; |
|
25 |
private DefaultColumnHeaderDataProvider colHeaderDataProvider; |
|
26 |
|
|
27 |
public BulkEditorDataLayerConfigLabelAccumulator(DefaultColumnHeaderDataProvider colHeaderDataProvider, |
|
28 |
AbstractBulkEditorInput<?> input) { |
|
29 |
this.colHeaderDataProvider = colHeaderDataProvider; |
|
30 |
this.input = input; |
|
31 |
} |
|
32 |
|
|
33 |
|
|
34 |
@Override |
|
35 |
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { |
|
36 |
if(rowPosition<0){ |
|
37 |
return; |
|
38 |
} |
|
39 |
if(input.isBooleanProperty(colHeaderDataProvider.getColumnHeaderLabel(columnPosition))){ |
|
40 |
configLabels.addLabel(BulkEditorConfigLabelAccumulatorHeader.BOOLEAN_COLUMN); |
|
41 |
} |
|
42 |
} |
|
43 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java | ||
---|---|---|
144 | 144 |
bottomComposite.setLayout(new GridLayout()); |
145 | 145 |
} |
146 | 146 |
|
147 |
@SuppressWarnings("unused") |
|
148 | 147 |
public void init(AbstractBulkEditorInput<?> input){ |
149 | 148 |
|
150 | 149 |
input.getPropertyKeys().forEach(key->columnList.add(key)); |
... | ... | |
174 | 173 |
|
175 | 174 |
} |
176 | 175 |
|
177 |
private void createTable(){ |
|
176 |
@SuppressWarnings({ "unused", "unchecked" }) |
|
177 |
private void createTable(){ |
|
178 | 178 |
ConfigRegistry configRegistry = new ConfigRegistry(); |
179 | 179 |
//property map |
180 | 180 |
Map<String, String> propertyToLabels = new HashMap<>(); |
... | ... | |
249 | 249 |
} |
250 | 250 |
})); |
251 | 251 |
|
252 |
dataLayer.setConfigLabelAccumulator(new BulkEditorConfigLabelAccumulator(bodyDataProvider, colHeaderDataProvider, |
|
252 |
//label accumulator |
|
253 |
dataLayer.setConfigLabelAccumulator(new BulkEditorDataLayerConfigLabelAccumulator(colHeaderDataProvider, |
|
254 |
bulkEditor.getEditorInput())); |
|
255 |
bodyLayer.setConfigLabelAccumulator(new BulkEditorBodyLayerConfigLabelAccumulator(bodyDataProvider, |
|
253 | 256 |
bulkEditor.getEditorInput())); |
254 | 257 |
|
255 | 258 |
natTable.setConfigRegistry(configRegistry); |
... | ... | |
425 | 428 |
} |
426 | 429 |
} |
427 | 430 |
|
431 |
@SuppressWarnings("unchecked") |
|
428 | 432 |
public void copyDataToClipboard() { |
429 | 433 |
String textData = ""; //$NON-NLS-1$ |
430 | 434 |
IStructuredSelection selection = getSelection(); |
Also available in: Unified diff
ref #7847 Fixate deduplication icon to first column