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.swt.graphics.Point; | |
16 | import org.eclipse.swt.widgets.Shell; | |
17 | ||
18 | /** | |
19 | * The responsibility of this class is to provide information necessary to | |
20 | * decide whether or not views should be time-aligned with each other and at | |
21 | * what offset. | |
22 | * | |
23 | * @see TmfTimeViewAlignmentSignal | |
24 | * | |
25 | * @since 1.0 | |
26 | */ | |
27 | public class TmfTimeViewAlignmentInfo { | |
28 | private final Point fViewLocation; | |
29 | private final int fTimeAxisOffset; | |
30 | private final Shell fShell; | |
31 | ||
32 | /** | |
33 | * Constructs a new TmfTimeViewAlignmentInfo. | |
34 | * | |
35 | * @param shell | |
36 | * used to determine whether or not views should be aligned | |
37 | * together | |
38 | * @param viewLocation | |
39 | * location of the view, used to determine whether or not views | |
40 | * should be aligned together | |
41 | * @param timeAxisOffset | |
42 | * offset relative to the view. This offset will be communicated | |
43 | * to the other views | |
44 | */ | |
45 | public TmfTimeViewAlignmentInfo(Shell shell, Point viewLocation, int timeAxisOffset) { | |
46 | fShell = shell; | |
47 | fViewLocation = viewLocation; | |
48 | fTimeAxisOffset = timeAxisOffset; | |
49 | } | |
50 | ||
51 | /** | |
52 | * Get the shell containing this alignment. | |
53 | * | |
54 | * @return the shell | |
55 | */ | |
56 | public Shell getShell() { | |
57 | return fShell; | |
58 | } | |
59 | ||
60 | /** | |
61 | * Get the absolute view location. This value is only valid at the time of | |
62 | * the TmfTimeViewAlignmentInfo creation so extra care must be given in | |
63 | * cases where the particular view might have been resized, moved, etc. | |
64 | * | |
65 | * @return the absolute view location | |
66 | */ | |
67 | public Point getViewLocation() { | |
68 | return fViewLocation; | |
69 | } | |
70 | ||
71 | /** | |
72 | * Offset relative to the view corresponding to the start of the time axis. | |
73 | * | |
74 | * @return the offset in pixels | |
75 | */ | |
76 | public int getTimeAxisOffset() { | |
77 | return fTimeAxisOffset; | |
78 | } | |
79 | } |