1 /**********************************************************************
2 * Copyright (c) 2005, 2006 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
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
.preferences
.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
31 public class ExecutionOccurrence
extends BasicExecutionOccurrence
implements ITimeRange
{
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
37 * Set the red, green and blue value of the optional color to be used for filling the execution occurrence.
39 protected int[] fillRGB
;
41 * Set the red, green and blue value of the optional color to be used for drawing the execution occurrence
43 protected int[] strokeRGB
;
45 * The occurrence image.
47 protected IImage image
;
49 * The top ellipses image.
51 protected IImage ellipsesImage
;
53 * The start time stamp.
55 protected ITmfTimestamp startTime
;
59 protected ITmfTimestamp endTime
;
61 * Flag to indicate whether time information is available or not.
63 protected boolean hasTime
;
65 // ------------------------------------------------------------------------
67 // ------------------------------------------------------------------------
70 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BasicExecutionOccurrence#setLifeline(org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline)
73 public void setLifeline(Lifeline theLifeline
) {
74 super.setLifeline(theLifeline
);
75 if (lifeline
!= null && hasTime
) {
76 lifeline
.hasTime
= true;
77 if (lifeline
.getFrame() != null) {
78 lifeline
.getFrame().setHasTimeInfo(true);
84 * Set the red, green and blue value of the optional color to be used for filling the execution occurrence.
86 * @param _r A value for red.
87 * @param _g A green value for green.
88 * @param _b A value blue.
90 public void setFillColor(int _r
, int _g
, int _b
) {
98 * Set the red, green and blue value of the optional color to be used for drawing the execution occurrence
100 * @param _r A value for red.
101 * @param _g A green value for green.
102 * @param _b A value blue.
104 public void setStrokeColor(int _r
, int _g
, int _b
) {
105 strokeRGB
= new int[3];
112 * Set the corresponding image.
114 * @param image_ A image to set.
116 public void setImage(IImage image_
) {
121 * Set the top ellipses image.
123 * @param image_ A image to set.
125 public void setTopEllipsesImage(IImage image_
) {
126 ellipsesImage
= image_
;
130 * Set the time when the execution occurrence starts.
132 * @param time the time when the execution occurrence starts
134 public void setStartTime(ITmfTimestamp time
) {
135 startTime
= time
.clone();
137 if (lifeline
!= null) {
138 lifeline
.setTimeInfo(true);
143 * Set the time when the execution occurrence ends.
145 * @param time the time when the execution occurrence ends
147 public void setEndTime(ITmfTimestamp time
) {
148 endTime
= time
.clone();
150 if (lifeline
!= null) {
151 lifeline
.setTimeInfo(true);
157 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#getStartTime()
160 public ITmfTimestamp
getStartTime() {
166 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#getEndTime()
169 public ITmfTimestamp
getEndTime() {
175 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange#hasTimeInfo()
178 public boolean hasTimeInfo() {
184 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BasicExecutionOccurrence#draw(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
187 public void draw(IGC context
) {
191 int width
= getWidth();
192 int height
= getHeight();
194 context
.drawImage(image
, x
+ width
- 4, y
+ height
- 11, 8, 11);
196 if (ellipsesImage
!= null) {
197 context
.drawImage(ellipsesImage
, x
+ width
, y
, 40, 10);
203 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BasicExecutionOccurrence#setUnselectedFillColor(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
206 protected IColor
setUnselectedFillColor(IGC context
) {
207 if (fillRGB
!= null) {
208 IColor tempFillColor
= context
.createColor(fillRGB
[0], fillRGB
[1], fillRGB
[2]);
209 if (Frame
.getUserPref().useGradienColor()) {
210 context
.setGradientColor(tempFillColor
);
211 context
.setForeground(Frame
.getUserPref().getForeGroundColor(ISDPreferences
.PREF_EXEC
));
212 context
.setBackground(Frame
.getUserPref().getBackGroundColor(ISDPreferences
.PREF_FRAME
));
214 context
.setBackground(tempFillColor
);
216 return tempFillColor
;
218 return super.setUnselectedFillColor(context
);
224 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BasicExecutionOccurrence#setUnselectedStrokeColor(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
227 protected IColor
setUnselectedStrokeColor(IGC context
) {
228 if (strokeRGB
!= null) {
229 IColor tempStrokeColor
= context
.createColor(strokeRGB
[0], strokeRGB
[1], strokeRGB
[2]);
230 context
.setForeground(tempStrokeColor
);
231 return tempStrokeColor
;
233 return super.setUnselectedStrokeColor(context
);
This page took 0.038012 seconds and 6 git commands to generate.