fix #7660 Add icons to bulk editor for deduplication target/candidate
authorPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 4 Oct 2018 07:45:02 +0000 (09:45 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 4 Oct 2018 07:45:02 +0000 (09:45 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorConfigLabelAccumulator.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorLabelStyleConfiguration.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorTooltip.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java

index 13a0a4ba751f1cab240bd7f9e9359401fec35ccd..798d4b2d11e15aa7a15dfa739c7683bd83a62f7c 100644 (file)
@@ -42,10 +42,16 @@ public class BulkEditorConfigLabelAccumulator implements IConfigLabelAccumulator
         }
         CdmBase rowObject = dataProvider.getRowObject(rowPosition);
         if(input.getMergeCandidates().contains(rowObject)){
-            configLabels.addLabel(BulkEditorE4Composite.CANDIDATE_LABEL);
+            configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE);
+            if(columnPosition==0){
+                configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE_ICON);
+            }
         }
         else if(input.getMergeTarget()==rowObject){
-            configLabels.addLabel(BulkEditorE4Composite.TARGET_LABEL);
+            configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET);
+            if(columnPosition==0){
+                configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET_ICON);
+            }
         }
     }
 }
index 1476911c19c2743d36a0e4976d118f508c410ded..23a76a9c5d4b24f53e72d0d655bb53193f437e2a 100644 (file)
@@ -95,9 +95,11 @@ public class BulkEditorE4Composite extends Composite {
 
     public static final String UUID_PROPERTY = "Uuid"; //$NON-NLS-1$
 
-    public static final String CANDIDATE_LABEL = "candidate"; //$NON-NLS-1$
+    public static final String LABEL_CANDIDATE = "LABEL_CANDIDATE"; //$NON-NLS-1$
+    public static final String LABEL_CANDIDATE_ICON = "LABEL_CANDIDATE_ICON"; //$NON-NLS-1$
 
-    public static final String TARGET_LABEL = "target"; //$NON-NLS-1$
+    public static final String LABEL_TARGET = "LABEL_TARGET"; //$NON-NLS-1$
+    public static final String LABEL_TARGET_ICON = "LABEL_TARGET_ICON"; //$NON-NLS-1$
 
     private final List<String> columnList = new ArrayList<>();
 
index 9cd189f211f2eb32d45183a420ca917da088e7fd..511f1b266064c5a3cd8a9be90fb832ee7dc01866 100644 (file)
@@ -11,11 +11,16 @@ package eu.etaxonomy.taxeditor.bulkeditor.e4;
 import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
 import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
 import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
 import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
 import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
 import org.eclipse.nebula.widgets.nattable.style.Style;
+import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
 
 import eu.etaxonomy.taxeditor.model.ColorResources;
+import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.preference.Resources;
 
 /**
@@ -26,21 +31,43 @@ import eu.etaxonomy.taxeditor.preference.Resources;
 public final class BulkEditorLabelStyleConfiguration extends AbstractRegistryConfiguration {
     @Override
     public void configureRegistry(IConfigRegistry configRegistry) {
-        Style cellStyle = new Style();
-        cellStyle.setAttributeValue(
+        //deduplication candidate style
+        Style candidateCellStyle = new Style();
+        candidateCellStyle.setAttributeValue(
                 CellStyleAttributes.BACKGROUND_COLOR,
                 ColorResources.getColor(Resources.COLOR_BULK_EDITOR_CANDIDATE));
         configRegistry.registerConfigAttribute(
-                CellConfigAttributes.CELL_STYLE, cellStyle,
-                DisplayMode.NORMAL, BulkEditorE4Composite.CANDIDATE_LABEL);
+                CellConfigAttributes.CELL_STYLE,
+                candidateCellStyle,
+                DisplayMode.NORMAL,
+                BulkEditorE4Composite.LABEL_CANDIDATE);
+        configRegistry.registerConfigAttribute(
+                CellConfigAttributes.CELL_PAINTER,
+                new CellPainterDecorator(
+                        new TextPainter(),
+                        CellEdgeEnum.BOTTOM_RIGHT,
+                        new ImagePainter(ImageResources.getImage(ImageResources.ACTIVE_DELETE_ICON)),
+                        false),
+                DisplayMode.NORMAL,
+                BulkEditorE4Composite.LABEL_CANDIDATE_ICON);
 
-        cellStyle = new Style();
-        cellStyle.setAttributeValue(
+        //deduplication target style
+        Style targetCellStyle = new Style();
+        targetCellStyle.setAttributeValue(
                 CellStyleAttributes.BACKGROUND_COLOR,
                 ColorResources.getColor(Resources.COLOR_BULK_EDITOR_TARGET));
         configRegistry.registerConfigAttribute(
-                CellConfigAttributes.CELL_STYLE, cellStyle,
-                DisplayMode.NORMAL, BulkEditorE4Composite.TARGET_LABEL);
+                CellConfigAttributes.CELL_STYLE, targetCellStyle,
+                DisplayMode.NORMAL, BulkEditorE4Composite.LABEL_TARGET);
+        configRegistry.registerConfigAttribute(
+                CellConfigAttributes.CELL_PAINTER,
+                new CellPainterDecorator(
+                        new TextPainter(),
+                        CellEdgeEnum.BOTTOM_RIGHT,
+                        new ImagePainter(ImageResources.getImage(ImageResources.IMPORT)),
+                        false),
+                DisplayMode.NORMAL,
+                BulkEditorE4Composite.LABEL_TARGET_ICON);
 
     }
 }
\ No newline at end of file
index 6282dbf7f58d88111e059f1aaee9d8dc1f57c617..172c47d50a1bd5f70aba656fe78138527f348f98 100644 (file)
@@ -46,10 +46,10 @@ public class BulkEditorTooltip extends DefaultToolTip {
         int row = this.natTable.getRowPositionByY(event.y);
 
         LabelStack configLabels = natTable.getConfigLabelsByPosition(col, row);
-        if(configLabels.hasLabel(BulkEditorE4Composite.TARGET_LABEL)){
+        if(configLabels.hasLabel(BulkEditorE4Composite.LABEL_TARGET)){
             return Messages.BulkEditorTooltip_TARGET;
         }
-        else if(configLabels.hasLabel(BulkEditorE4Composite.CANDIDATE_LABEL)){
+        else if(configLabels.hasLabel(BulkEditorE4Composite.LABEL_CANDIDATE)){
             return Messages.BulkEditorTooltip_CANDIDATE;
         }
         return ""; //$NON-NLS-1$
@@ -67,8 +67,8 @@ public class BulkEditorTooltip extends DefaultToolTip {
         int row = this.natTable.getRowPositionByY(event.y);
 
         LabelStack configLabels = natTable.getConfigLabelsByPosition(col, row);
-        if(configLabels.hasLabel(BulkEditorE4Composite.CANDIDATE_LABEL)
-                || configLabels.hasLabel(BulkEditorE4Composite.TARGET_LABEL)){
+        if(configLabels.hasLabel(BulkEditorE4Composite.LABEL_CANDIDATE)
+                || configLabels.hasLabel(BulkEditorE4Composite.LABEL_TARGET)){
             return true;
         }
         return false;
index 871bf041a560b4d1ee754ed29853cf6196056f43..f0642dc578ee3b5eccb8089faa244ef018b08177 100644 (file)
@@ -147,6 +147,7 @@ public class ImageResources {
        public static final String SWITCH_VIEW_TYPE = "switch_view_type";
        public static final String SETTINGS = "settings";
        public static final String EXPORT = "export";
+       public static final String IMPORT = "import";
 
        //derivative icons
        public static final String TISSUE_SAMPLE_DERIVATE = "tissue_sample_derivate";
@@ -423,6 +424,8 @@ public class ImageResources {
                                "default_derivate-16x16-32.png");
                registerImage(registry, EXPORT,
                        "export.gif");
+               registerImage(registry, IMPORT,
+                       "import_wiz.gif");
 
                registerImage(registry, WEB,
                        "web.gif");