ref #9816: add tooltip to disabled fields and change color of fields with default...
authorKatja Luther <k.luther@bgbm.org>
Wed, 27 Oct 2021 11:25:03 +0000 (13:25 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 27 Oct 2021 11:25:03 +0000 (13:25 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixLabelStyleConfiguration.java

index e1f01632358034fea55c108064d6b68b35b71179..3e418f81f125c55359566a9bd35ece74834e3221 100644 (file)
@@ -60,6 +60,7 @@ import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedList
 import org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer;
 import org.eclipse.nebula.widgets.nattable.freeze.FreezeHelper;
 import org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
 import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand;
 import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
 import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
@@ -75,12 +76,14 @@ import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel;
 import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer;
 import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
 import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
 import org.eclipse.nebula.widgets.nattable.persistence.gui.PersistenceDialog;
 import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
 import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
 import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer;
 import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration;
 import org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration;
+import org.eclipse.nebula.widgets.nattable.tooltip.NatTableContentTooltip;
 import org.eclipse.nebula.widgets.nattable.tree.ITreeRowModel;
 import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
 import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandToLevelCommand;
@@ -94,6 +97,7 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Menu;
 
 import ca.odell.glazedlists.BasicEventList;
@@ -288,7 +292,19 @@ public class CharacterMatrix extends Composite {
                 natTable.doCommand(new TreeExpandToLevelCommand(deepestTaxonLevel-2));
             }
         }
-
+        new NatTableContentTooltip(natTable, GridRegion.BODY) {
+               protected String getText(Event event) {
+                       int col = this.natTable.getColumnPositionByX(event.x);
+               int row = this.natTable.getRowPositionByY(event.y);
+
+               ILayerCell cell = this.natTable.getCellByPosition(col, row);
+               if (cell.getConfigLabels().getLabels().contains(CharacterMatrixConfigLabelAccumulator.NOT_EDITABLE)){
+                       return "More than one element available, please check in factual data view.";
+               }
+                       return null;
+               }
+       };
+    
 
         // clean up table state
         getNatTableState().remove(NatTable.INITIAL_PAINT_COMPLETE_FLAG);
index ebd618838bc24cff1d345a6c730ab9ccaa88102f..eaf4f6d6733023fe9924dd07f75051f0b95b626f 100644 (file)
@@ -63,7 +63,7 @@ public final class CharacterMatrixLabelStyleConfiguration extends AbstractRegist
         Style hasDefaultValueStyle = new Style();
         hasDefaultValueStyle.setAttributeValue(
                 CellStyleAttributes.BACKGROUND_COLOR,
-                GUIHelper.COLOR_GRAY);
+                GUIHelper.COLOR_WIDGET_LIGHT_SHADOW);
         configRegistry.registerConfigAttribute(
                 CellConfigAttributes.CELL_STYLE,
                 hasDefaultValueStyle,