1 /**********************************************************************
2 * Copyright (c) 2005, 2006, 2011 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 * $Id: ExecutionOccurrence.java,v 1.2 2006/09/20 20:56:25 ewchan Exp $
10 * IBM - Initial API and implementation
11 * Bernd Hufmann - Updated for TMF
12 **********************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
;
15 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimestamp
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IColor
;
18 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IGC
;
19 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IImage
;
20 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.ISDPreferences
;
23 * ExecutionOccurrence is the UML2 execution occurrence graphical representation. It is a BasicExecutionOccurrence on
24 * which you can customize fill and/or
26 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline Lifeline for more event occurence details
30 public class ExecutionOccurrence
extends BasicExecutionOccurrence
implements ITimeRange
{
32 protected int[] fillRGB
;
33 protected int[] strokeRGB
;
34 protected IImage image
, ellipsesImage
;
36 protected ITmfTimestamp startTime
, endTime
;
37 protected boolean hasTime
;
40 * Set the lifeline on which the execution occurrence appears.
42 * @param theLifeline - the parent lifeline
45 public void setLifeline(Lifeline theLifeline
) {
46 super.setLifeline(theLifeline
);
47 if (lifeline
!= null && hasTime
) {
48 lifeline
.hasTime
= true;
49 if (lifeline
.getFrame() != null) {
50 lifeline
.getFrame().setHasTimeInfo(true);
56 * Set the red, green and blue value of the optional color to be used for filling the execution occurrence
62 public void setFillColor(int _r
, int _g
, int _b
) {
70 * Set the red, green and blue value of the optional color to be used for drawing the execution occurrence
76 public void setStrokeColor(int _r
, int _g
, int _b
) {
77 strokeRGB
= new int[3];
83 public void setImage(IImage image_
) {
87 public void setTopEllipsesImage(IImage image_
) {
88 ellipsesImage
= image_
;
92 * Set the time when the execution occurrence starts.<br>
94 * @param time the time when the execution occurrence starts
96 public void setStartTime(TmfTimestamp time
) {
97 startTime
= time
.clone();
99 if (lifeline
!= null) {
100 lifeline
.setTimeInfo(true);
105 * Set the time when the execution occurrence ends.<br>
107 * @param time the time when the execution occurrence ends
109 public void setEndTime(TmfTimestamp time
) {
110 endTime
= time
.clone();
112 if (lifeline
!= null) {
113 lifeline
.setTimeInfo(true);
118 * Returns the time when the execution occurrence starts
123 public ITmfTimestamp
getStartTime() {
128 * Returns the time when the execution occurrence ends
133 public ITmfTimestamp
getEndTime() {
138 public boolean hasTimeInfo() {
143 public void draw(IGC context
) {
147 int width
= getWidth();
148 int height
= getHeight();
150 context
.drawImage(image
, x
+ width
- 4, y
+ height
- 11, 8, 11);
152 if (ellipsesImage
!= null) {
153 context
.drawImage(ellipsesImage
, x
+ width
, y
, 40, 10);
158 * Extension in order to support customized fill colors
164 protected IColor
setUnselectedFillColor(IGC context
) {
165 if (fillRGB
!= null) {
166 IColor tempFillColor
= context
.createColor(fillRGB
[0], fillRGB
[1], fillRGB
[2]);
167 if (Frame
.getUserPref().useGradienColor()) {
168 context
.setGradientColor(tempFillColor
);
169 context
.setForeground(Frame
.getUserPref().getForeGroundColor(ISDPreferences
.PREF_EXEC
));
170 context
.setBackground(Frame
.getUserPref().getBackGroundColor(ISDPreferences
.PREF_FRAME
));
172 context
.setBackground(tempFillColor
);
173 return tempFillColor
;
175 return super.setUnselectedFillColor(context
);
180 * Extension in order to support customized stroke colors
186 protected IColor
setUnselectedStrokeColor(IGC context
) {
187 if (strokeRGB
!= null) {
188 IColor tempStrokeColor
= context
.createColor(strokeRGB
[0], strokeRGB
[1], strokeRGB
[2]);
189 context
.setForeground(tempStrokeColor
);
190 return tempStrokeColor
;
192 return super.setUnselectedStrokeColor(context
);
This page took 0.038318 seconds and 6 git commands to generate.