Commit | Line | Data |
---|---|---|
d2e4afa7 MAL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015 Ericsson | |
3 | * | |
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 | * | |
9 | * Contributors: | |
10 | * Marc-Andre Laperle - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.tracecompass.tmf.ui.signal; | |
14 | ||
15 | import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; | |
16 | ||
17 | /** | |
18 | * A signal to inform about the state of time alignment. Typically, the emitter | |
19 | * will inform the receivers about the position of a sash that separates the | |
20 | * time axis on right side and extra information on the left side. | |
21 | * | |
22 | * @see TmfTimeViewAlignmentInfo | |
23 | * | |
24 | * @since 1.0 | |
25 | */ | |
26 | public class TmfTimeViewAlignmentSignal extends TmfSignal { | |
27 | ||
28 | private final TmfTimeViewAlignmentInfo fTimeViewAlignmentInfo; | |
29 | private final boolean fIsSynchronous; | |
30 | ||
31 | /** | |
32 | * Creates a new TmfTimeViewAlignmentSignal | |
33 | * | |
34 | * @param source | |
35 | * the source of the signal | |
36 | * @param alignmentInfo | |
37 | * information about the time alignment | |
38 | */ | |
39 | public TmfTimeViewAlignmentSignal(Object source, TmfTimeViewAlignmentInfo alignmentInfo) { | |
40 | this(source, alignmentInfo, false); | |
41 | } | |
42 | ||
43 | /** | |
44 | * Creates a new TmfTimeViewAlignmentSignal | |
45 | * | |
46 | * @param source | |
47 | * the source of the signal | |
48 | * @param alignmentInfo | |
49 | * information about the time alignment | |
50 | * @param synchronous | |
51 | * whether or not the signal should be processed right away. This | |
52 | * is useful for signals that are sent not repetitively. | |
53 | * For example, a sash being dragged would not be synchronous | |
54 | * because the signal gets fired repeatedly. A view that has | |
55 | * completed computing it's data could send a synchronous signal. | |
56 | */ | |
57 | public TmfTimeViewAlignmentSignal(Object source, TmfTimeViewAlignmentInfo alignmentInfo, boolean synchronous) { | |
58 | super(source); | |
59 | fTimeViewAlignmentInfo = alignmentInfo; | |
60 | fIsSynchronous = synchronous; | |
61 | } | |
62 | ||
63 | /** | |
64 | * Get the time alignment information. | |
65 | * | |
66 | * @return the time alignment information | |
67 | */ | |
68 | public TmfTimeViewAlignmentInfo getTimeViewAlignmentInfo() { | |
69 | return fTimeViewAlignmentInfo; | |
70 | } | |
71 | ||
72 | @Override | |
73 | public String toString() { | |
74 | return "[TmfTimeViewAlignmentSignal (" + fTimeViewAlignmentInfo.toString() + ")]"; //$NON-NLS-1$ //$NON-NLS-2$ | |
75 | } | |
76 | ||
77 | /** | |
78 | * Get whether or not the signal should be processed right away, without | |
79 | * being throttled. | |
80 | * | |
81 | * @return whether or not the signal should be processed right away | |
82 | */ | |
83 | public boolean IsSynchronous() { | |
84 | return fIsSynchronous; | |
85 | } | |
86 | } |