1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.provider
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
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
;
22 import javafx
.beans
.property
.ObjectProperty
;
25 * Base interface for time graph model providers.
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.
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
35 * @author Alexandre Montplaisir
37 public interface ITimeGraphModelProvider
{
39 // ------------------------------------------------------------------------
40 // Configuration option classes
41 // ------------------------------------------------------------------------
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.
47 * The exact behavior of the sorting mode is defined by the model provider
52 private final String fName
;
54 public SortingMode(String name
) {
58 public String
getName() {
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.
67 * The exact behavior of the filter mode is defined by the model provider
72 private final String fName
;
74 public FilterMode(String name
) {
78 public String
getName() {
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
88 * Get the name of this model provider. This can be used for example to name
89 * a corresponding view in the UI.
91 * @return The model provider's name
96 * Set the trace for which this model provider fetches its information.
101 void setTrace(@Nullable ITmfTrace trace
);
105 * Get the trace for which this model provider fetches its information.
107 * @return The current trace
109 @Nullable ITmfTrace
getTrace();
112 * The property representing the target trace of this model provider.
114 * @return The trace property
116 ObjectProperty
<@Nullable ITmfTrace
> traceProperty();
118 // ------------------------------------------------------------------------
120 // ------------------------------------------------------------------------
123 * Get a tree render corresponding to the current configuration settings.
125 * @return A tree render
127 TimeGraphTreeRender
getTreeRender();
130 * Get the state provider supplied by this model provider.
132 * @return The state provider
134 ITimeGraphModelStateProvider
getStateProvider();
137 * Get the arrow providers supplied by this model provider.
139 * @return The arrow providers. May be empty but should not be null.
141 Collection
<ITimeGraphModelArrowProvider
> getArrowProviders();
143 // ------------------------------------------------------------------------
145 // ------------------------------------------------------------------------
148 * Get a list of all the available sorting modes for this provider.
150 * @return The sorting modes
152 List
<SortingMode
> getSortingModes();
155 * Get the current sorting mode. There should always be one and only one.
157 * @return The current sorting mode
159 SortingMode
getCurrentSortingMode();
162 * Change the configured sorting mode to another one.
165 * The index of the corresponding mode in the list returned by
166 * {@link #getSortingModes()}.
168 void setCurrentSortingMode(int index
);
170 // ------------------------------------------------------------------------
172 // ------------------------------------------------------------------------
175 * Get a list of all the available filter modes for this provider.
177 * @return The list of available filter modes. It may be empty but should
180 List
<FilterMode
> getFilterModes();
183 * Enable the specified filter mode.
186 * The index of the filter mode in the list returned by
187 * {@link #getFilterModes()}.
189 void enableFilterMode(int index
);
192 * Disable the specified filter mode.
195 * The index of the filter mode in the list returned by
196 * {@link #getFilterModes()}.
198 void disableFilterMode(int index
);
201 * Get the currently active filter modes.
203 * @return The active filter modes. There might be 0 or more.
205 Set
<FilterMode
> getActiveFilterModes();