1 /**********************************************************************
2 * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
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
9 * IBM - Initial API and implementation
10 * Bernd Hufmann - Updated for TMF
11 **********************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
;
15 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.ITmfTimestamp
;
16 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IColor
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IGC
;
18 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IImage
;
19 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.preferences
.ISDPreferences
;
20 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.preferences
.SDViewPref
;
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 // ------------------------------------------------------------------------
38 * Set the red, green and blue value of the optional color to be used for filling the execution occurrence.
40 protected int[] fFillRGB
;
42 * Set the red, green and blue value of the optional color to be used for drawing the execution occurrence
44 protected int[] fStrokeRGB
;
46 * The occurrence image.
48 protected IImage fImage
;
50 * The top ellipses image.
52 protected IImage fEllipsesImage
;
54 * The start time stamp.
56 protected ITmfTimestamp fStartTime
;
60 protected ITmfTimestamp fEndTime
;
62 * Flag to indicate whether time information is available or not.
64 protected boolean fHasTimeInfo
;
66 // ------------------------------------------------------------------------
68 // ------------------------------------------------------------------------
71 public void setLifeline(Lifeline theLifeline
) {
72 super.setLifeline(theLifeline
);
73 if (fLifeline
!= null && fHasTimeInfo
) {
74 fLifeline
.fHasTimeInfo
= true;
75 if (fLifeline
.getFrame() != null) {
76 fLifeline
.getFrame().setHasTimeInfo(true);
82 * Set the red, green and blue value of the optional color to be used for filling the execution occurrence.
84 * @param red A value for red.
85 * @param green A green value for green.
86 * @param blue A value blue.
88 public void setFillColor(int red
, int green
, int blue
) {
89 fFillRGB
= new int[3];
96 * Set the red, green and blue value of the optional color to be used for drawing the execution occurrence
98 * @param red A value for red.
99 * @param green A green value for green.
100 * @param blue A value blue.
102 public void setStrokeColor(int red
, int green
, int blue
) {
103 fStrokeRGB
= new int[3];
105 fStrokeRGB
[1] = green
;
106 fStrokeRGB
[2] = blue
;
110 * Set the corresponding image.
112 * @param image A image to set.
114 public void setImage(IImage image
) {
119 * Set the top ellipses image.
121 * @param image A image to set.
123 public void setTopEllipsesImage(IImage image
) {
124 fEllipsesImage
= image
;
128 * Set the time when the execution occurrence starts.
130 * @param time the time when the execution occurrence starts
133 public void setStartTime(ITmfTimestamp time
) {
136 if (fLifeline
!= null) {
137 fLifeline
.setTimeInfo(true);
142 * Set the time when the execution occurrence ends.
144 * @param time the time when the execution occurrence ends
147 public void setEndTime(ITmfTimestamp time
) {
150 if (fLifeline
!= null) {
151 fLifeline
.setTimeInfo(true);
159 public ITmfTimestamp
getStartTime() {
167 public ITmfTimestamp
getEndTime() {
172 public boolean hasTimeInfo() {
177 public void draw(IGC context
) {
181 int width
= getWidth();
182 int height
= getHeight();
183 if (fImage
!= null) {
184 context
.drawImage(fImage
, x
+ width
- 4, y
+ height
- 11, 8, 11);
186 if (fEllipsesImage
!= null) {
187 context
.drawImage(fEllipsesImage
, x
+ width
, y
, 40, 10);
192 protected IColor
setUnselectedFillColor(IGC context
) {
193 ISDPreferences pref
= SDViewPref
.getInstance();
194 if (fFillRGB
!= null) {
195 IColor tempFillColor
= context
.createColor(fFillRGB
[0], fFillRGB
[1], fFillRGB
[2]);
196 if (pref
.useGradienColor()) {
197 context
.setGradientColor(tempFillColor
);
198 context
.setForeground(pref
.getForeGroundColor(ISDPreferences
.PREF_EXEC
));
199 context
.setBackground(pref
.getBackGroundColor(ISDPreferences
.PREF_FRAME
));
201 context
.setBackground(tempFillColor
);
203 return tempFillColor
;
205 return super.setUnselectedFillColor(context
);
209 protected IColor
setUnselectedStrokeColor(IGC context
) {
210 if (fStrokeRGB
!= null) {
211 IColor tempStrokeColor
= context
.createColor(fStrokeRGB
[0], fStrokeRGB
[1], fStrokeRGB
[2]);
212 context
.setForeground(tempStrokeColor
);
213 return tempStrokeColor
;
215 return super.setUnselectedStrokeColor(context
);
This page took 0.036707 seconds and 6 git commands to generate.