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
.event
.TmfTimestamp
;
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
.drawings
.ISDPreferences
;
22 * ExecutionOccurrence is the UML2 execution occurrence graphical representation. It is a BasicExecutionOccurrence on
23 * which you can customize fill and/or
25 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline Lifeline for more event occurence details
29 public class ExecutionOccurrence
extends BasicExecutionOccurrence
implements ITimeRange
{
31 protected int[] fillRGB
;
32 protected int[] strokeRGB
;
33 protected IImage image
, ellipsesImage
;
35 protected TmfTimestamp startTime
, endTime
;
36 protected boolean hasTime
;
39 * Set the lifeline on which the execution occurrence appears.
41 * @param theLifeline - the parent lifeline
44 public void setLifeline(Lifeline theLifeline
) {
45 super.setLifeline(theLifeline
);
46 if (lifeline
!= null && hasTime
) {
47 lifeline
.hasTime
= true;
48 if (lifeline
.getFrame() != null) {
49 lifeline
.getFrame().setHasTimeInfo(true);
55 * Set the red, green and blue value of the optional color to be used for filling the execution occurrence
61 public void setFillColor(int _r
, int _g
, int _b
) {
69 * Set the red, green and blue value of the optional color to be used for drawing the execution occurrence
75 public void setStrokeColor(int _r
, int _g
, int _b
) {
76 strokeRGB
= new int[3];
82 public void setImage(IImage image_
) {
86 public void setTopEllipsesImage(IImage image_
) {
87 ellipsesImage
= image_
;
91 * Set the time when the execution occurrence starts.<br>
93 * @param time the time when the execution occurrence starts
95 public void setStartTime(TmfTimestamp time
) {
96 startTime
= time
.clone();
98 if (lifeline
!= null) {
99 lifeline
.setTimeInfo(true);
104 * Set the time when the execution occurrence ends.<br>
106 * @param time the time when the execution occurrence ends
108 public void setEndTime(TmfTimestamp time
) {
109 endTime
= time
.clone();
111 if (lifeline
!= null) {
112 lifeline
.setTimeInfo(true);
117 * Returns the time when the execution occurrence starts
122 public TmfTimestamp
getStartTime() {
127 * Returns the time when the execution occurrence ends
132 public TmfTimestamp
getEndTime() {
137 public boolean hasTimeInfo() {
142 public void draw(IGC context
) {
146 int width
= getWidth();
147 int height
= getHeight();
149 context
.drawImage(image
, x
+ width
- 4, y
+ height
- 11, 8, 11);
151 if (ellipsesImage
!= null) {
152 context
.drawImage(ellipsesImage
, x
+ width
, y
, 40, 10);
157 * Extension in order to support customized fill colors
163 protected IColor
setUnselectedFillColor(IGC context
) {
164 if (fillRGB
!= null) {
165 IColor tempFillColor
= context
.createColor(fillRGB
[0], fillRGB
[1], fillRGB
[2]);
166 if (Frame
.getUserPref().useGradienColor()) {
167 context
.setGradientColor(tempFillColor
);
168 context
.setForeground(Frame
.getUserPref().getForeGroundColor(ISDPreferences
.PREF_EXEC
));
169 context
.setBackground(Frame
.getUserPref().getBackGroundColor(ISDPreferences
.PREF_FRAME
));
171 context
.setBackground(tempFillColor
);
172 return tempFillColor
;
174 return super.setUnselectedFillColor(context
);
179 * Extension in order to support customized stroke colors
185 protected IColor
setUnselectedStrokeColor(IGC context
) {
186 if (strokeRGB
!= null) {
187 IColor tempStrokeColor
= context
.createColor(strokeRGB
[0], strokeRGB
[1], strokeRGB
[2]);
188 context
.setForeground(tempStrokeColor
);
189 return tempStrokeColor
;
191 return super.setUnselectedStrokeColor(context
);
This page took 0.035521 seconds and 6 git commands to generate.