1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
10 package org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.render
.drawnevents
;
12 import java
.util
.Collections
;
14 import java
.util
.function
.Supplier
;
16 import org
.eclipse
.jdt
.annotation
.Nullable
;
17 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.render
.TimeGraphEvent
;
20 * Model representation of a drawn event.
22 * A drawn event is a UI representation of a single {@link TimeGraphEvent}, with
25 * Additional properties can also be part of the drawn event, for example to be
26 * shown on mouse-over.
28 * @author Alexandre Montplaisir
30 public class TimeGraphDrawnEvent
{
32 private final TimeGraphEvent fTimeGraphEvent
;
33 private final TimeGraphDrawnEventSeries fEventSeries
;
34 private final @Nullable Supplier
<Map
<String
, String
>> fPropertySupplier
;
40 * Time graph event (location)
42 * Series of this event, which contains all the styling
44 * @param propertySupplier
45 * Supplier of additional properties, which can be accessed only
46 * the first time {@link #getProperties()} is called.
48 public TimeGraphDrawnEvent(TimeGraphEvent event
,
49 TimeGraphDrawnEventSeries eventSeries
,
50 @Nullable Supplier
<Map
<String
, String
>> propertySupplier
) {
51 fTimeGraphEvent
= event
;
52 fEventSeries
= eventSeries
;
53 fPropertySupplier
= propertySupplier
;
57 * Get the timegraph event wrapped by this drawn event.
59 * @return The time graph event
61 public TimeGraphEvent
getEvent() {
62 return fTimeGraphEvent
;
66 * Get the event series of this drawn event.
68 * @return The event's series
70 public TimeGraphDrawnEventSeries
getEventSeries() {
75 * Get the additional properties of this drawn event.
77 * @return The event's properties
79 public Map
<String
, String
> getProperties() {
80 Supplier
<Map
<String
, String
>> supplier
= fPropertySupplier
;
81 if (supplier
== null) {
82 return Collections
.EMPTY_MAP
;
84 return supplier
.get();