Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0445201a03c2852c115581fa246f7c3e287df520 (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
/*****************************************************************************
 * Copyright (c) 2018 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.uml.diagram.sequence.figures;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
import org.eclipse.swt.graphics.Color;
import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.TimeObservation;

/**
 * Specific figure for the {@link TimeConstraint} & {@link TimeObservation}. This may be simplified later as a single line only
 */
public class TimeConstraintFigure extends DefaultSizeNodeFigure implements IPapyrusNodeFigure {

	public TimeConstraintFigure() {
		super(60, 1);
	}

	@Override
	public void paintFigure(Graphics graphics) {
		super.paintFigure(graphics);

		graphics.pushState();

		Rectangle clipRectangle = new Rectangle();
		graphics.getClip(clipRectangle);
		graphics.setClip(clipRectangle.expand(Math.max(0, getLineWidth()), Math.max(0, getLineWidth())));

		graphics.setLineWidth(getLineWidth());
		graphics.drawLine(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y);

		graphics.popState();
	}


	@Override
	public Color getBorderColor() {
		return null;
	}

	@Override
	public boolean isShadow() {
		return false;
	}

	@Override
	public void setBorderColor(Color borderColor) {

	}

	@Override
	public void setShadow(boolean shadow) {

	}

}

Back to the top