Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java44
1 files changed, 1 insertions, 43 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java
index 1c161e61e66..04b794def12 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java
@@ -14,30 +14,23 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.painter;
-import java.util.Collection;
-import java.util.Iterator;
-
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand;
import org.eclipse.nebula.widgets.nattable.style.CellStyleUtil;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.style.IStyle;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.Problem;
import org.eclipse.papyrus.infra.nattable.utils.Constants;
import org.eclipse.papyrus.infra.nattable.utils.ILabelProviderContextElementWrapper;
import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
/**
* Custom CellPainter to define the LabelProvider to use
@@ -46,12 +39,7 @@ import org.eclipse.swt.widgets.Display;
*
*/
//TODO : we should use the TextPainter itself, now with the GenericDisplayConverter, it should works fine
-public class CustomizedCellPainter extends TextPainter {
-
- /**
- * the color used for error;
- */
- private final Color errorColor = new Color(Display.getDefault(), 255, 0, 0);
+public class CustomizedCellPainter extends CellPainterWithUnderlinedError {
/**
*
@@ -133,34 +121,4 @@ public class CustomizedCellPainter extends TextPainter {
}
}
}
-
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundPainter#getBackgroundColour(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell,
- * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
- *
- * @param cell
- * @param configRegistry
- * @return
- */
- @Override
- protected Color getBackgroundColour(final ILayerCell cell, final IConfigRegistry configRegistry) {
- Object value = cell.getDataValue();
- boolean hasError = false;
- if(value instanceof Problem) {
- hasError = true;
- } else if(value instanceof Collection<?>) {
- final Iterator<?> iter = ((Collection<?>)value).iterator();
- while(!hasError && iter.hasNext()) {
- hasError = iter.next() instanceof Problem;
- }
- }
-
- if(hasError) {
- return this.errorColor;
- }
- return super.getBackgroundColour(cell, configRegistry);
- }
-
}

Back to the top