Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 659c7eeb2637398a924d6a9139a4906c1d6ebfce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*******************************************************************************
 * Copyright (c) 2015 Ericsson
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Marc-Andre Laperle - Initial API and implementation
 *******************************************************************************/

package org.eclipse.tracecompass.tmf.ui.signal;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;

/**
 * The responsibility of this class is to provide information necessary to
 * decide whether or not views should be time-aligned with each other and at
 * what offset.
 *
 * @see TmfTimeViewAlignmentSignal
 *
 * @since 1.0
 */
public class TmfTimeViewAlignmentInfo {
    private final Point fViewLocation;
    private final int fTimeAxisOffset;
    private final Shell fShell;

    /**
     * Constructs a new TmfTimeViewAlignmentInfo.
     *
     * @param shell
     *            used to determine whether or not views should be aligned
     *            together
     * @param viewLocation
     *            location of the view, used to determine whether or not views
     *            should be aligned together
     * @param timeAxisOffset
     *            offset relative to the view. This offset will be communicated
     *            to the other views
     */
    public TmfTimeViewAlignmentInfo(Shell shell, Point viewLocation, int timeAxisOffset) {
        fShell = shell;
        fViewLocation = viewLocation;
        fTimeAxisOffset = timeAxisOffset;
    }

    /**
     * Get the shell containing this alignment.
     *
     * @return the shell
     */
    public Shell getShell() {
        return fShell;
    }

    /**
     * Get the absolute view location. This value is only valid at the time of
     * the TmfTimeViewAlignmentInfo creation so extra care must be given in
     * cases where the particular view might have been resized, moved, etc.
     *
     * @return the absolute view location
     */
    public Point getViewLocation() {
        return fViewLocation;
    }

    /**
     * Offset relative to the view corresponding to the start of the time axis.
     *
     * @return the offset in pixels
     */
    public int getTimeAxisOffset() {
        return fTimeAxisOffset;
    }
}

Back to the top