Project

General

Profile

Revision 1f677abd

ID1f677abd3ea026eab1835f317828d8be5ad6bd65
Parent 528d11e6
Child 61cd8ee1

Added by Patrick Plitzner about 3 years ago

fix #7660 Add icons to bulk editor for deduplication target/candidate

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorConfigLabelAccumulator.java
42 42
        }
43 43
        CdmBase rowObject = dataProvider.getRowObject(rowPosition);
44 44
        if(input.getMergeCandidates().contains(rowObject)){
45
            configLabels.addLabel(BulkEditorE4Composite.CANDIDATE_LABEL);
45
            configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE);
46
            if(columnPosition==0){
47
                configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE_ICON);
48
            }
46 49
        }
47 50
        else if(input.getMergeTarget()==rowObject){
48
            configLabels.addLabel(BulkEditorE4Composite.TARGET_LABEL);
51
            configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET);
52
            if(columnPosition==0){
53
                configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET_ICON);
54
            }
49 55
        }
50 56
    }
51 57
}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java
95 95

  
96 96
    public static final String UUID_PROPERTY = "Uuid"; //$NON-NLS-1$
97 97

  
98
    public static final String CANDIDATE_LABEL = "candidate"; //$NON-NLS-1$
98
    public static final String LABEL_CANDIDATE = "LABEL_CANDIDATE"; //$NON-NLS-1$
99
    public static final String LABEL_CANDIDATE_ICON = "LABEL_CANDIDATE_ICON"; //$NON-NLS-1$
99 100

  
100
    public static final String TARGET_LABEL = "target"; //$NON-NLS-1$
101
    public static final String LABEL_TARGET = "LABEL_TARGET"; //$NON-NLS-1$
102
    public static final String LABEL_TARGET_ICON = "LABEL_TARGET_ICON"; //$NON-NLS-1$
101 103

  
102 104
    private final List<String> columnList = new ArrayList<>();
103 105

  
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorLabelStyleConfiguration.java
11 11
import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
12 12
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
13 13
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
14
import org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter;
15
import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
16
import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
14 17
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
15 18
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
16 19
import org.eclipse.nebula.widgets.nattable.style.Style;
20
import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
17 21

  
18 22
import eu.etaxonomy.taxeditor.model.ColorResources;
23
import eu.etaxonomy.taxeditor.model.ImageResources;
19 24
import eu.etaxonomy.taxeditor.preference.Resources;
20 25

  
21 26
/**
......
26 31
public final class BulkEditorLabelStyleConfiguration extends AbstractRegistryConfiguration {
27 32
    @Override
28 33
    public void configureRegistry(IConfigRegistry configRegistry) {
29
        Style cellStyle = new Style();
30
        cellStyle.setAttributeValue(
34
        //deduplication candidate style
35
        Style candidateCellStyle = new Style();
36
        candidateCellStyle.setAttributeValue(
31 37
                CellStyleAttributes.BACKGROUND_COLOR,
32 38
                ColorResources.getColor(Resources.COLOR_BULK_EDITOR_CANDIDATE));
33 39
        configRegistry.registerConfigAttribute(
34
                CellConfigAttributes.CELL_STYLE, cellStyle,
35
                DisplayMode.NORMAL, BulkEditorE4Composite.CANDIDATE_LABEL);
40
                CellConfigAttributes.CELL_STYLE,
41
                candidateCellStyle,
42
                DisplayMode.NORMAL,
43
                BulkEditorE4Composite.LABEL_CANDIDATE);
44
        configRegistry.registerConfigAttribute(
45
                CellConfigAttributes.CELL_PAINTER,
46
                new CellPainterDecorator(
47
                        new TextPainter(),
48
                        CellEdgeEnum.BOTTOM_RIGHT,
49
                        new ImagePainter(ImageResources.getImage(ImageResources.ACTIVE_DELETE_ICON)),
50
                        false),
51
                DisplayMode.NORMAL,
52
                BulkEditorE4Composite.LABEL_CANDIDATE_ICON);
36 53

  
37
        cellStyle = new Style();
38
        cellStyle.setAttributeValue(
54
        //deduplication target style
55
        Style targetCellStyle = new Style();
56
        targetCellStyle.setAttributeValue(
39 57
                CellStyleAttributes.BACKGROUND_COLOR,
40 58
                ColorResources.getColor(Resources.COLOR_BULK_EDITOR_TARGET));
41 59
        configRegistry.registerConfigAttribute(
42
                CellConfigAttributes.CELL_STYLE, cellStyle,
43
                DisplayMode.NORMAL, BulkEditorE4Composite.TARGET_LABEL);
60
                CellConfigAttributes.CELL_STYLE, targetCellStyle,
61
                DisplayMode.NORMAL, BulkEditorE4Composite.LABEL_TARGET);
62
        configRegistry.registerConfigAttribute(
63
                CellConfigAttributes.CELL_PAINTER,
64
                new CellPainterDecorator(
65
                        new TextPainter(),
66
                        CellEdgeEnum.BOTTOM_RIGHT,
67
                        new ImagePainter(ImageResources.getImage(ImageResources.IMPORT)),
68
                        false),
69
                DisplayMode.NORMAL,
70
                BulkEditorE4Composite.LABEL_TARGET_ICON);
44 71

  
45 72
    }
46 73
}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorTooltip.java
46 46
        int row = this.natTable.getRowPositionByY(event.y);
47 47

  
48 48
        LabelStack configLabels = natTable.getConfigLabelsByPosition(col, row);
49
        if(configLabels.hasLabel(BulkEditorE4Composite.TARGET_LABEL)){
49
        if(configLabels.hasLabel(BulkEditorE4Composite.LABEL_TARGET)){
50 50
            return Messages.BulkEditorTooltip_TARGET;
51 51
        }
52
        else if(configLabels.hasLabel(BulkEditorE4Composite.CANDIDATE_LABEL)){
52
        else if(configLabels.hasLabel(BulkEditorE4Composite.LABEL_CANDIDATE)){
53 53
            return Messages.BulkEditorTooltip_CANDIDATE;
54 54
        }
55 55
        return ""; //$NON-NLS-1$
......
67 67
        int row = this.natTable.getRowPositionByY(event.y);
68 68

  
69 69
        LabelStack configLabels = natTable.getConfigLabelsByPosition(col, row);
70
        if(configLabels.hasLabel(BulkEditorE4Composite.CANDIDATE_LABEL)
71
                || configLabels.hasLabel(BulkEditorE4Composite.TARGET_LABEL)){
70
        if(configLabels.hasLabel(BulkEditorE4Composite.LABEL_CANDIDATE)
71
                || configLabels.hasLabel(BulkEditorE4Composite.LABEL_TARGET)){
72 72
            return true;
73 73
        }
74 74
        return false;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java
147 147
	public static final String SWITCH_VIEW_TYPE = "switch_view_type";
148 148
	public static final String SETTINGS = "settings";
149 149
	public static final String EXPORT = "export";
150
	public static final String IMPORT = "import";
150 151

  
151 152
	//derivative icons
152 153
	public static final String TISSUE_SAMPLE_DERIVATE = "tissue_sample_derivate";
......
423 424
				"default_derivate-16x16-32.png");
424 425
		registerImage(registry, EXPORT,
425 426
		        "export.gif");
427
		registerImage(registry, IMPORT,
428
		        "import_wiz.gif");
426 429

  
427 430
		registerImage(registry, WEB,
428 431
		        "web.gif");

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)