Fix for Linux display bugs in TimeGraphCombo.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / BasicFrame.java
CommitLineData
73005152 1/**********************************************************************
df0b8ff4
BH
2 * Copyright (c) 2005, 2008 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
4 *
73005152
BH
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
73005152
BH
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
15
16import java.util.ArrayList;
17import java.util.Iterator;
18import java.util.List;
19
4df4581d 20import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
6c13869b 21import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
73005152 22import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
df0b8ff4 23import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
73005152
BH
24import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
25
26/**
27 * The Frame class is the base sequence diagram graph nodes container.<br>
28 * For instance, only one frame can be drawn in the View.<br>
29 * Lifelines, Messages and Stop which are supposed to represent a Sequence diagram are drawn in a Frame.<br>
30 * Only the graph node added to their representing list will be drawn.
31 *
32 * The lifelines are appended along the X axsis when added in a frame.<br>
33 * The syncMessages are ordered along the Y axsis depending on the event occurrence they are attached to.<br>
34 *
35 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline Lifeline for more event occurence details
36 * @author sveyrier
37 * @version 1.0
38 */
39public class BasicFrame extends GraphNode {
40
df0b8ff4
BH
41 // ------------------------------------------------------------------------
42 // Static Attributes/Constants
43 // ------------------------------------------------------------------------
44 /**
45 * The sequence diagram reference.
46 */
eb63f5ff 47 protected static ISDPreferences fUserPref = null;
df0b8ff4
BH
48
49 // ------------------------------------------------------------------------
50 // Attributes
51 // ------------------------------------------------------------------------
52
73005152
BH
53 /**
54 * Contains the max elapsed time between two consecutive messages in the whole frame
55 */
eb63f5ff 56 protected ITmfTimestamp fMaxTime = new TmfTimestamp(0);
73005152
BH
57 /**
58 * Contains the min elapsed time between two consecutive messages in the whole frame
59 */
eb63f5ff 60 protected ITmfTimestamp fMinTime = new TmfTimestamp(0);
73005152
BH
61 /**
62 * Indicate if the min and max elapsed time between two consecutive messages in the whole frame need to be computed
63 */
eb63f5ff 64 protected boolean fComputeMinMax = true;
73005152
BH
65 /**
66 * Store the preference set by the user regarding the external time. This flag is used determine if the min and max
67 * need to be recomputed in case this preference is changed.
68 */
eb63f5ff 69 protected boolean fLastExternalTimePref = SDViewPref.getInstance().excludeExternalTime();
73005152
BH
70 /**
71 * The greater event occurrence created on graph nodes drawn in this Frame This directly impact the Frame height
72 */
eb63f5ff 73 protected int fVerticalIndex = 0;
73005152
BH
74 /**
75 * The index along the x axis where the next lifeline will is drawn This directly impact the Frame width
76 */
eb63f5ff 77 protected int fHorizontalIndex = 0;
df0b8ff4 78 /**
eb63f5ff 79 * The time information flag.
df0b8ff4 80 */
eb63f5ff 81 protected boolean fHasTimeInfo = false;
73005152 82 /**
df0b8ff4 83 * The current Frame visible area - x coordinates
73005152 84 */
eb63f5ff 85 protected int fVisibleAreaX;
df0b8ff4
BH
86 /**
87 * The current Frame visible area - y coordinates
88 */
eb63f5ff 89 protected int fVisibleAreaY;
df0b8ff4
BH
90 /**
91 * The current Frame visible area - width
92 */
eb63f5ff 93 protected int fVisibleAreaWidth;
df0b8ff4
BH
94 /**
95 * The current Frame visible area - height
96 */
eb63f5ff 97 protected int fVisibleAreaHeight;
df0b8ff4
BH
98 /**
99 * The event occurrence spacing (-1 for none)
100 */
eb63f5ff 101 protected int fForceEventOccurrenceSpacing = -1;
df0b8ff4
BH
102 /**
103 * Flag to indicate customized minumum and maximum.
104 */
eb63f5ff 105 protected boolean fCustomMinMax = false;
df0b8ff4
BH
106 /**
107 * The minimum time between messages of the sequence diagram frame.
108 */
eb63f5ff 109 protected ITmfTimestamp fMinSDTime = new TmfTimestamp();
df0b8ff4
BH
110 /**
111 * The maximum time between messages of the sequence diagram frame.
112 */
eb63f5ff 113 protected ITmfTimestamp fMaxSDTime = new TmfTimestamp();
df0b8ff4
BH
114 /**
115 * Flag to indicate that initial minimum has to be computed.
116 */
eb63f5ff 117 protected boolean fInitSDMin = true;
73005152 118
df0b8ff4
BH
119 // ------------------------------------------------------------------------
120 // Constructors
121 // ------------------------------------------------------------------------
122
73005152
BH
123 /**
124 * Creates an empty frame.
125 */
126 public BasicFrame() {
eb63f5ff 127 Metrics.setForcedEventSpacing(fForceEventOccurrenceSpacing);
73005152
BH
128 }
129
df0b8ff4
BH
130 // ------------------------------------------------------------------------
131 // Methods
132 // ------------------------------------------------------------------------
133
73005152
BH
134 /**
135 *
136 * Returns the greater event occurence known by the Frame
137 *
138 * @return the greater event occurrence
139 */
140 protected int getMaxEventOccurrence() {
eb63f5ff 141 return fVerticalIndex;
73005152
BH
142 }
143
144 /**
145 * Set the greater event occurrence created in GraphNodes included in the frame
146 *
147 * @param eventOccurrence the new greater event occurrence
148 */
149 protected void setMaxEventOccurrence(int eventOccurrence) {
eb63f5ff 150 fVerticalIndex = eventOccurrence;
73005152
BH
151 }
152
153 /**
154 * This method increase the lifeline place holder The return value is usually assign to a lifeline. This can be used
155 * to set the lifelines drawing order. Also, calling this method two times and assigning only the last given index
156 * to a lifeline will increase this lifeline draw spacing (2 times the default spacing) from the last added
157 * lifeline.
158 *
159 * @return a new lifeline index
160 */
161 protected int getNewHorizontalIndex() {
eb63f5ff 162 return ++fHorizontalIndex;
73005152
BH
163 }
164
165 /**
166 * Returns the current horizontal index
167 *
168 * @return the current horizontal index
169 * @see Frame#getNewHorizontalIndex() for horizontal index description
170 */
171 protected int getHorizontalIndex() {
eb63f5ff 172 return fHorizontalIndex;
73005152
BH
173 }
174
df0b8ff4
BH
175 /*
176 * (non-Javadoc)
177 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#addNode(org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode)
73005152
BH
178 */
179 @Override
180 public void addNode(GraphNode nodeToAdd) {
eb63f5ff 181 fComputeMinMax = true;
73005152
BH
182 super.addNode(nodeToAdd);
183 }
184
df0b8ff4
BH
185 /*
186 * (non-Javadoc)
73005152
BH
187 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getX()
188 */
189 @Override
190 public int getX() {
191 return Metrics.FRAME_H_MARGIN;
192 }
193
df0b8ff4
BH
194
195 /*
196 * (non-Javadoc)
197 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getY()
73005152
BH
198 */
199 @Override
200 public int getY() {
201 return Metrics.FRAME_V_MARGIN;
202 }
203
df0b8ff4
BH
204 /*
205 * (non-Javadoc)
73005152
BH
206 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getWidth()
207 */
208 @Override
209 public int getWidth() {
eb63f5ff 210 if (fHorizontalIndex == 0) {
73005152 211 return 3 * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 - Metrics.FRAME_H_MARGIN - Metrics.LIFELINE_SPACING / 2;
df0b8ff4 212 } else {
eb63f5ff 213 return fHorizontalIndex * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 + 1 - Metrics.LIFELINE_SPACING;
df0b8ff4 214 }
73005152
BH
215 }
216
df0b8ff4
BH
217 /*
218 * (non-Javadoc)
73005152
BH
219 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getHeight()
220 */
221 @Override
222 public int getHeight() {
df0b8ff4 223 // The Frame height depends on the maximum number of messages added to a lifeline
eb63f5ff 224 if (fVerticalIndex == 0) {
73005152
BH
225 return 5 * (Metrics.getMessagesSpacing() + Metrics.getMessageFontHeigth()) + Metrics.LIFELINE_NAME_H_MARGIN + Metrics.FRAME_NAME_H_MARGIN + Metrics.getFrameFontHeigth() + Metrics.LIFELINE_VT_MAGIN + Metrics.LIFELINE_VB_MAGIN
226 + Metrics.LIFELINE_NAME_H_MARGIN + Metrics.FRAME_NAME_H_MARGIN + Metrics.getLifelineFontHeigth() * 2;
df0b8ff4 227 }
eb63f5ff
BH
228 if (fForceEventOccurrenceSpacing >= 0) {
229 Metrics.setForcedEventSpacing(fForceEventOccurrenceSpacing);
df0b8ff4 230 }
eb63f5ff 231 return fVerticalIndex * (Metrics.getMessagesSpacing() + Metrics.getMessageFontHeigth()) + Metrics.LIFELINE_NAME_H_MARGIN + Metrics.FRAME_NAME_H_MARGIN + Metrics.getFrameFontHeigth() + Metrics.LIFELINE_VT_MAGIN + Metrics.LIFELINE_VB_MAGIN
73005152
BH
232 + Metrics.LIFELINE_NAME_H_MARGIN + Metrics.FRAME_NAME_H_MARGIN + Metrics.getLifelineFontHeigth() * 2;
233 }
234
235 /**
236 * Returns the graph node which contains the point given in parameter for the given graph node list and starting the
237 * iteration at the given index<br>
238 * WARNING: Only graph nodes with smaller coordinates than the current visible area can be returned.<br>
239 *
240 * @param x the x coordinate of the point to test
241 * @param y the y coordinate of the point to test
242 * @param list the list to search in
243 * @param fromIndex list browsing starting point
244 * @return the graph node containing the point given in parameter, null otherwise
df0b8ff4
BH
245 *
246 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getNodeFromListAt(int, int, java.util.List, int)
73005152
BH
247 */
248 @Override
249 protected GraphNode getNodeFromListAt(int x, int y, List<GraphNode> list, int fromIndex) {
df0b8ff4 250 if (list == null) {
73005152 251 return null;
df0b8ff4 252 }
73005152
BH
253 for (int i = fromIndex; i < list.size(); i++) {
254 GraphNode node = (GraphNode) list.get(i);
255 // only lifeline list is x ordered
256 // Stop browsing the list if the node is outside the visible area
257 // all others nodes will be not visible
eb63f5ff 258 if ((node instanceof Lifeline) && (node.getX() > fVisibleAreaX + fVisibleAreaWidth)) {
73005152 259 break;
df0b8ff4 260 }
73005152 261 if (node.getHeight() < 0) {
eb63f5ff 262 if (node.getY() + node.getHeight() > fVisibleAreaY + fVisibleAreaHeight) {
73005152 263 break;
df0b8ff4 264 }
73005152 265 } else {
eb63f5ff 266 if (node.getY() > fVisibleAreaY + fVisibleAreaHeight) {
73005152 267 break;
df0b8ff4 268 }
73005152 269 }
df0b8ff4 270 if (node.contains(x, y)) {
73005152 271 return node;
df0b8ff4 272 }
73005152
BH
273 }
274 return null;
275 }
276
277 /**
278 * Draw the Frame rectangle
279 *
280 * @param context the context to draw to
281 */
282 protected void drawFrame(IGC context) {
283 context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME));
284 context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_FRAME));
285
286 int x = getX();
287 int y = getY();
288 int w = getWidth();
289 int h = getHeight();
290
291 // Draw the frame main rectangle
292 context.fillRectangle(x, y, w, h);
293 context.drawRectangle(x, y, w, h);
294
295 context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME_NAME));
296 context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_FRAME_NAME));
297 context.setFont(Frame.getUserPref().getFont(ISDPreferences.PREF_FRAME_NAME));
298
299 int nameWidth = context.textExtent(getName()) + 2 * Metrics.FRAME_NAME_V_MARGIN;
300 int nameHeight = Metrics.getFrameFontHeigth() + +Metrics.FRAME_NAME_H_MARGIN * 2;
301
302 // Draw the frame name area
df0b8ff4 303 if (nameWidth > w) {
73005152 304 nameWidth = w;
df0b8ff4 305 }
73005152
BH
306
307 int[] points = { x, y, x + nameWidth, y, x + nameWidth, y - 11 + nameHeight, x - 11 + nameWidth, y + nameHeight, x, y + nameHeight, x, y + nameHeight };
308 context.fillPolygon(points);
309 context.drawPolygon(points);
310 context.drawLine(x, y, x, y + nameHeight);
311
312 context.setForeground(Frame.getUserPref().getFontColor(ISDPreferences.PREF_FRAME_NAME));
313 context.drawTextTruncatedCentred(getName(), x, y, nameWidth - 11, nameHeight, false);
314
315 context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME));
316 context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_FRAME));
317 }
318
df0b8ff4
BH
319 /*
320 * (non-Javadoc)
321 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#draw(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
73005152
BH
322 */
323 @Override
324 public void draw(IGC context) {
325 draw(context, true);
326 }
327
328 /**
329 * Draws the Frame on the given context.<br>
330 * This method start width GraphNodes ordering if needed.<br>
331 * After, depending on the visible area, only visible GraphNodes are drawn.<br>
332 *
333 * @param context the context to draw to
334 * @param drawFrame indicate if the frame rectangle need to be redrawn
335 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#draw(IGC)
336 */
337 protected void draw(IGC context, boolean drawFrame) {
eb63f5ff
BH
338 fVisibleAreaHeight = context.getVisibleHeight();
339 fVisibleAreaWidth = context.getVisibleWidth();
340 fVisibleAreaX = context.getContentsX();
341 fVisibleAreaY = context.getContentsY();
73005152 342
eb63f5ff
BH
343 if (fForceEventOccurrenceSpacing >= 0) {
344 Metrics.setForcedEventSpacing(fForceEventOccurrenceSpacing);
df0b8ff4 345 } else {
73005152 346 Metrics.setForcedEventSpacing(-1);
df0b8ff4 347 }
eb63f5ff 348 if (fUserPref == null) {
73005152 349 return;
df0b8ff4 350 }
73005152
BH
351 super.drawChildenNodes(context);
352 }
353
df0b8ff4
BH
354 /**
355 * Sets the sequence diagram preferences.
356 *
357 * @param pref the preferences to set.
358 */
73005152 359 public static void setUserPref(ISDPreferences pref) {
eb63f5ff 360 fUserPref = pref;
73005152
BH
361 }
362
df0b8ff4
BH
363 /**
364 * Returns the sequence diagram preferences.
365 * @return the sequence diagram preferences.
366 */
73005152 367 public static ISDPreferences getUserPref() {
eb63f5ff 368 return fUserPref;
73005152
BH
369 }
370
df0b8ff4
BH
371 /**
372 * Sets the event occurrence spacing (-1 for none)
373 *
374 * @param space A spacing to set.
375 */
73005152 376 public void forceEventOccurrenceSpacing(int space) {
eb63f5ff 377 fForceEventOccurrenceSpacing = space;
73005152
BH
378 }
379
380 /**
381 * Return the X coordinates of the frame visible area
382 *
383 * @return the X coordinates of the frame visible area
384 */
385 public int getVisibleAreaX() {
eb63f5ff 386 return fVisibleAreaX;
73005152
BH
387 }
388
389 /**
390 * Return the frame visible area width
391 *
392 * @return the frame visible area width
393 */
394 public int getVisibleAreaWidth() {
eb63f5ff 395 return fVisibleAreaWidth;
73005152
BH
396 }
397
398 /**
399 * Return the frame visible area height
400 *
401 * @return the frame visible area height
402 */
403 public int getVisibleAreaHeight() {
eb63f5ff 404 return fVisibleAreaHeight;
73005152
BH
405 }
406
407 /**
408 * Return the X coordinates of the frame visible area
409 *
410 * @return the X coordinates of the frame visible area
411 */
412 public int getVisibleAreaY() {
eb63f5ff 413 return fVisibleAreaY;
73005152
BH
414 }
415
416 /**
417 * Return the minimum time stored in the frame taking all GraphNodes into account
418 *
419 * @return the minimum GraphNode time
420 */
4df4581d 421 public ITmfTimestamp getMinTime() {
eb63f5ff
BH
422 if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
423 fLastExternalTimePref = SDViewPref.getInstance().excludeExternalTime();
424 fComputeMinMax = true;
73005152 425 }
eb63f5ff 426 if ((fComputeMinMax) && (!fCustomMinMax)) {
73005152 427 computeMinMax();
eb63f5ff 428 fComputeMinMax = false;
73005152 429 }
eb63f5ff 430 return fMinTime;
73005152
BH
431 }
432
d7dbf09a 433 public void setMin(ITmfTimestamp min) {
eb63f5ff
BH
434 fMinTime = min;
435 fCustomMinMax = true;
73005152
BH
436 }
437
d7dbf09a 438 public void setMax(ITmfTimestamp max) {
eb63f5ff
BH
439 fMaxTime = max;
440 fCustomMinMax = true;
73005152
BH
441 }
442
443 public void resetCustomMinMax() {
eb63f5ff
BH
444 fCustomMinMax = false;
445 fComputeMinMax = true;
73005152
BH
446 }
447
448 /**
449 * Return the maximum time stored in the frame taking all GraphNodes into account
450 *
451 * @return the maximum GraphNode time
452 */
4df4581d 453 public ITmfTimestamp getMaxTime() {
eb63f5ff
BH
454 if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
455 fLastExternalTimePref = SDViewPref.getInstance().excludeExternalTime();
456 fComputeMinMax = true;
73005152 457 }
eb63f5ff 458 if (fComputeMinMax) {
73005152 459 computeMinMax();
eb63f5ff 460 fComputeMinMax = false;
73005152 461 }
eb63f5ff 462 return fMaxTime;
73005152
BH
463 }
464
df0b8ff4
BH
465 /**
466 * Computes the minimum and maximum time between consecutive messages within the frame.
467 */
73005152 468 protected void computeMaxMinTime() {
eb63f5ff 469 if (!fInitSDMin) {
73005152 470 return;
df0b8ff4 471 }
73005152
BH
472
473 List<SDTimeEvent> timeArray = buildTimeArray();
df0b8ff4 474 if (timeArray == null) {
73005152 475 return;
df0b8ff4 476 }
73005152
BH
477 for (int i = 0; i < timeArray.size(); i++) {
478 SDTimeEvent m = (SDTimeEvent) timeArray.get(i);
479
eb63f5ff
BH
480 if (m.getTime().compareTo(fMaxSDTime, true) > 0) {
481 fMaxSDTime = m.getTime();
73005152
BH
482 }
483
eb63f5ff
BH
484 if ((m.getTime().compareTo(fMinSDTime, true) < 0) || fInitSDMin) {
485 fMinSDTime = m.getTime();
486 fInitSDMin = false;
73005152
BH
487 }
488 }
489 }
490
df0b8ff4
BH
491 /**
492 * Returns the minimum time between consecutive messages.
493 *
494 * @return the minimum time between consecutive messages
495 */
4df4581d 496 public ITmfTimestamp getSDMinTime() {
73005152 497 computeMaxMinTime();
eb63f5ff 498 return fMinSDTime;
73005152
BH
499 }
500
df0b8ff4
BH
501 /**
502 * Returns the maximum time between consecutive messages.
503 *
504 * @return the maximum time between consecutive messages
505 */
4df4581d 506 public ITmfTimestamp getSDMaxTime() {
73005152 507 computeMaxMinTime();
eb63f5ff 508 return fMaxSDTime;
73005152
BH
509 }
510
511 /**
512 * Browse all the GraphNode to compute the min and max times store in the Frame
513 */
514 protected void computeMinMax() {
515 List<SDTimeEvent> timeArray = buildTimeArray();
df0b8ff4 516 if (timeArray == null) {
73005152 517 return;
df0b8ff4 518 }
73005152
BH
519 for (int i = 0; i < timeArray.size() - 1; i++) {
520 SDTimeEvent m1 = (SDTimeEvent) timeArray.get(i);
521 SDTimeEvent m2 = (SDTimeEvent) timeArray.get(i + 1);
522
523 updateMinMax(m1, m2);
73005152
BH
524 }
525 }
526
df0b8ff4
BH
527 /**
528 * Updates the minimum and maximum time between consecutive message within the frame based on the given values.
529 *
530 * @param m1 A first SD time event.
531 * @param m2 A second SD time event.
532 */
73005152 533 protected void updateMinMax(SDTimeEvent m1, SDTimeEvent m2) {
4df4581d 534 ITmfTimestamp delta = m2.getTime().getDelta(m1.getTime());
eb63f5ff
BH
535 if (fComputeMinMax) {
536 fMinTime = delta.clone();
537 if (fMinTime.compareTo(TmfTimestamp.ZERO, false) < 0) {
538 fMinTime = new TmfTimestamp(0, m1.getTime().getScale(), m1.getTime().getPrecision());
73005152 539 }
eb63f5ff
BH
540 fMaxTime = fMinTime.clone();
541 fComputeMinMax = false;
73005152
BH
542 }
543
eb63f5ff
BH
544 if ((delta.compareTo(fMinTime, true) < 0) && (delta.compareTo(TmfTimestamp.ZERO, false) > 0)) {
545 fMinTime = delta.clone();
73005152
BH
546 }
547
eb63f5ff
BH
548 if ((delta.compareTo(fMaxTime, true) > 0) && (delta.compareTo(TmfTimestamp.ZERO, false) > 0)) {
549 fMaxTime = delta.clone();
73005152
BH
550 }
551 }
552
df0b8ff4
BH
553 /**
554 * Builds the time array based on the list of graph nodes.
555 *
556 * @return the time array else <code>null</code>.
557 */
73005152 558 protected List<SDTimeEvent> buildTimeArray() {
eb63f5ff 559 if (!fHasChilden) {
73005152 560 return null;
df0b8ff4 561 }
73005152 562
eb63f5ff 563 Iterator<String> it = fForwardSort.keySet().iterator();
73005152
BH
564 List<SDTimeEvent> timeArray = new ArrayList<SDTimeEvent>();
565 while (it.hasNext()) {
566 String nodeType = it.next();
eb63f5ff 567 List<GraphNode> list = (List<GraphNode>) fNodes.get(nodeType);
73005152
BH
568 for (int i = 0; i < list.size(); i++) {
569 Object timedNode = list.get(i);
570 if ((timedNode instanceof ITimeRange) && ((ITimeRange) timedNode).hasTimeInfo()) {
571 int event = ((GraphNode) list.get(i)).getStartOccurrence();
4df4581d 572 ITmfTimestamp time = ((ITimeRange) list.get(i)).getStartTime();
73005152
BH
573 SDTimeEvent f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
574 timeArray.add(f);
575 if (event != ((GraphNode) list.get(i)).getEndOccurrence()) {
576 event = ((AsyncMessage) list.get(i)).getEndOccurrence();
577 time = ((ITimeRange) list.get(i)).getEndTime();
578 f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
579 timeArray.add(f);
580 }
581 }
582 }
583 }
584 return timeArray;
585 }
586
587 /*
588 * (non-Javadoc)
589 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getArrayId()
590 */
591 @Override
592 public String getArrayId() {
593 return null;
594 }
595
596 /*
597 * (non-Javadoc)
598 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#contains(int, int)
599 */
600 @Override
601 public boolean contains(int x, int y) {
602 return false;
603 }
604}
This page took 0.054724 seconds and 5 git commands to generate.