Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: cd6a434e18515ed0646c6798714a400230f7843c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*****************************************************************************
 * Copyright (c) 2014 CEA LIST and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   CEA LIST - Initial API and implementation
 *
 *****************************************************************************/

package org.eclipse.papyrus.infra.nattable.painter;

import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
import org.eclipse.nebula.widgets.nattable.layer.cell.TranslatedLayerCell;
import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator;
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;

/**
 * @author Vincent Lorenzo
 *
 */
public class PapyrusBeveledBorderDecorator extends BeveledBorderDecorator {

	/**
	 * Constructor.
	 *
	 * @param interiorPainter
	 */
	public PapyrusBeveledBorderDecorator(ICellPainter interiorPainter) {
		super(interiorPainter);
	}

	/**
	 * Constructor.
	 *
	 * @param interiorPainter
	 * @param uplift
	 */
	public PapyrusBeveledBorderDecorator(ICellPainter interiorPainter, boolean uplift) {
		super(interiorPainter, uplift);
	}

	/**
	 *
	 * @see org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator#paintCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
	 *      org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
	 *
	 * @param cell
	 * @param gc
	 * @param adjustedCellBounds
	 * @param configRegistry
	 */
	@Override
	public void paintCell(ILayerCell cell, GC gc, Rectangle adjustedCellBounds, IConfigRegistry configRegistry) {
		LabelStack labels = null;
		if (cell instanceof TranslatedLayerCell) {
			labels = cell.getConfigLabels();
		}
		if (labels != null) {
			if (!labels.hasLabel(TreeLayer.TREE_COLUMN_CELL)) {
				super.paintCell(cell, gc, adjustedCellBounds, configRegistry);
				return;
			} else {
				if (getWrappedPainter() != null) {
					getWrappedPainter().paintCell(cell, gc, adjustedCellBounds, configRegistry);
				}
			}
		}
	}
}

Back to the top