Import views plugins
[deliverable/tracecompass.git] / tmf / org.lttng.scope.tmf2.views.core / src / org / lttng / scope / tmf2 / views / core / timegraph / model / provider / ITimeGraphModelProvider.java
1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
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
10 package org.lttng.scope.tmf2.views.core.timegraph.model.provider;
11
12 import java.util.Collection;
13 import java.util.List;
14 import java.util.Set;
15
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
18 import org.lttng.scope.tmf2.views.core.timegraph.model.provider.arrows.ITimeGraphModelArrowProvider;
19 import org.lttng.scope.tmf2.views.core.timegraph.model.provider.states.ITimeGraphModelStateProvider;
20 import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeRender;
21
22 import javafx.beans.property.ObjectProperty;
23
24 /**
25 * Base interface for time graph model providers.
26 *
27 * This object is responsible for the generation of the "tree" part of the
28 * timegraph, and other generic options like sorting and filtering modes.
29 *
30 * It also encapsulates one {@link ITimeGraphModelStateProvider} (which is
31 * responsible of providing state intervals), and zero or more
32 * {@link ITimeGraphModelArrowProvider} (which provide model-defined arrow
33 * series).
34 *
35 * @author Alexandre Montplaisir
36 */
37 public interface ITimeGraphModelProvider {
38
39 // ------------------------------------------------------------------------
40 // Configuration option classes
41 // ------------------------------------------------------------------------
42
43 /**
44 * Class representing one sorting mode. A sorting mode is like a comparator
45 * to sort tree elements. Only one can be active at any time.
46 *
47 * The exact behavior of the sorting mode is defined by the model provider
48 * itself.
49 */
50 class SortingMode {
51
52 private final String fName;
53
54 public SortingMode(String name) {
55 fName = name;
56 }
57
58 public String getName() {
59 return fName;
60 }
61 }
62
63 /**
64 * Class representing a filter mode. A filter mode is like a filter applied
65 * on the list tree elements. Zero or more can be active at the same time.
66 *
67 * The exact behavior of the filter mode is defined by the model provider
68 * itself.
69 */
70 class FilterMode {
71
72 private final String fName;
73
74 public FilterMode(String name) {
75 fName = name;
76 }
77
78 public String getName() {
79 return fName;
80 }
81 }
82
83 // ------------------------------------------------------------------------
84 // General methods
85 // ------------------------------------------------------------------------
86
87 /**
88 * Get the name of this model provider. This can be used for example to name
89 * a corresponding view in the UI.
90 *
91 * @return The model provider's name
92 */
93 String getName();
94
95 /**
96 * Set the trace for which this model provider fetches its information.
97 *
98 * @param trace
99 * The source trace
100 */
101 void setTrace(@Nullable ITmfTrace trace);
102
103
104 /**
105 * Get the trace for which this model provider fetches its information.
106 *
107 * @return The current trace
108 */
109 @Nullable ITmfTrace getTrace();
110
111 /**
112 * The property representing the target trace of this model provider.
113 *
114 * @return The trace property
115 */
116 ObjectProperty<@Nullable ITmfTrace> traceProperty();
117
118 // ------------------------------------------------------------------------
119 // Render providers
120 // ------------------------------------------------------------------------
121
122 /**
123 * Get a tree render corresponding to the current configuration settings.
124 *
125 * @return A tree render
126 */
127 TimeGraphTreeRender getTreeRender();
128
129 /**
130 * Get the state provider supplied by this model provider.
131 *
132 * @return The state provider
133 */
134 ITimeGraphModelStateProvider getStateProvider();
135
136 /**
137 * Get the arrow providers supplied by this model provider.
138 *
139 * @return The arrow providers. May be empty but should not be null.
140 */
141 Collection<ITimeGraphModelArrowProvider> getArrowProviders();
142
143 // ------------------------------------------------------------------------
144 // Sorting modes
145 // ------------------------------------------------------------------------
146
147 /**
148 * Get a list of all the available sorting modes for this provider.
149 *
150 * @return The sorting modes
151 */
152 List<SortingMode> getSortingModes();
153
154 /**
155 * Get the current sorting mode. There should always be one and only one.
156 *
157 * @return The current sorting mode
158 */
159 SortingMode getCurrentSortingMode();
160
161 /**
162 * Change the configured sorting mode to another one.
163 *
164 * @param index
165 * The index of the corresponding mode in the list returned by
166 * {@link #getSortingModes()}.
167 */
168 void setCurrentSortingMode(int index);
169
170 // ------------------------------------------------------------------------
171 // Filter modes
172 // ------------------------------------------------------------------------
173
174 /**
175 * Get a list of all the available filter modes for this provider.
176 *
177 * @return The list of available filter modes. It may be empty but should
178 * not be null.
179 */
180 List<FilterMode> getFilterModes();
181
182 /**
183 * Enable the specified filter mode.
184 *
185 * @param index
186 * The index of the filter mode in the list returned by
187 * {@link #getFilterModes()}.
188 */
189 void enableFilterMode(int index);
190
191 /**
192 * Disable the specified filter mode.
193 *
194 * @param index
195 * The index of the filter mode in the list returned by
196 * {@link #getFilterModes()}.
197 */
198 void disableFilterMode(int index);
199
200 /**
201 * Get the currently active filter modes.
202 *
203 * @return The active filter modes. There might be 0 or more.
204 */
205 Set<FilterMode> getActiveFilterModes();
206
207 }
This page took 0.035637 seconds and 5 git commands to generate.