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.views; | |
14 | ||
15 | import org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo; | |
16 | ||
17 | /** | |
18 | * An interface that adds the time-axis alignment feature to a view. This | |
19 | * interface provides information about the current state of alignment of the | |
20 | * view as well as performs alignment operations in case the views become | |
21 | * misaligned (resize, moved, etc). | |
22 | * | |
23 | * @since 1.0 | |
24 | */ | |
25 | public interface ITmfTimeAligned { | |
26 | ||
27 | /** | |
28 | * Get the time alignment information. The view provides information about | |
29 | * where the time-axis is in addition to information necessary to decide | |
30 | * whether or not views should be time-aligned with each other (Shell, | |
31 | * location). | |
32 | * | |
33 | * @return the time alignment information | |
34 | */ | |
35 | TmfTimeViewAlignmentInfo getTimeViewAlignmentInfo(); | |
36 | ||
37 | /** | |
38 | * Get the available width for the specified time-axis offset. The | |
39 | * implementation should return the width that would be available if the | |
40 | * time-axis was to be at that offset. When about to perform a re-alignment, | |
41 | * the alignment algorithm will choose the narrowest width to accommodate | |
42 | * all views. | |
43 | * | |
44 | * @param requestedOffset | |
45 | * the requested time-axis offset. Greater or equal to zero. | |
46 | * @return the available width. Should be greater or equal to zero. | |
47 | */ | |
48 | int getAvailableWidth(int requestedOffset); | |
49 | ||
50 | /** | |
51 | * Perform the alignment by moving the time-axis to the specified offset and | |
52 | * the resizing it to the specified width. Implementations should handle | |
53 | * cases were the requested width is greater than the width of the view. For | |
54 | * example, Integer.MAX_VALUE can be requested in order to obtain the | |
55 | * largest width possible. | |
56 | * | |
57 | * @param offset | |
58 | * the time-axis offset. Greater or equal to zero. | |
59 | * @param width | |
60 | * the time-axis width. Greater or equal to zero. Can be | |
61 | * Integer.MAX_VALUE. | |
62 | */ | |
63 | void performAlign(int offset, int width); | |
64 | } |