2 * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
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
10 package org
.lttng
.scope
.tmf2
.views
.ui
.timeline
;
12 import static java
.util
.Objects
.requireNonNull
;
14 import org
.lttng
.scope
.tmf2
.views
.core
.config
.ConfigOption
;
15 import org
.lttng
.scope
.tmf2
.views
.ui
.timeline
.widgets
.timegraph
.TimeGraphWidget
;
17 import javafx
.scene
.paint
.Color
;
18 import javafx
.scene
.paint
.CycleMethod
;
19 import javafx
.scene
.paint
.LinearGradient
;
20 import javafx
.scene
.paint
.Paint
;
21 import javafx
.scene
.paint
.Stop
;
22 import javafx
.scene
.text
.Font
;
23 import javafx
.scene
.text
.Text
;
26 * Debug options for the {@link TimeGraphWidget}. Advanced users or unit
27 * tests might want to modify these.
29 * @author Alexandre Montplaisir
31 public class DebugOptions
{
34 * Constructor using the default options
36 public DebugOptions() {
37 recomputeEllipsisWidth();
40 // ------------------------------------------------------------------------
42 // ------------------------------------------------------------------------
45 * Painting flag. Indicates if automatic redrawing of the view is enabled
47 public final ConfigOption
<Boolean
> isPaintingEnabled
= new ConfigOption
<>(true);
50 * Entry padding. Number of tree elements to print above *and* below the
53 public final ConfigOption
<Integer
> entryPadding
= new ConfigOption
<>(5);
56 * How much "padding" around the current visible window, on the left and
57 * right, should be pre-rendered. Expressed as a fraction of the current
58 * window (for example, 1.0 would render one "page" on each side).
60 public final ConfigOption
<Double
> renderRangePadding
= new ConfigOption
<>(0.1);
63 * Time between UI updates, in milliseconds
65 public final ConfigOption
<Integer
> uiUpdateDelay
= new ConfigOption
<>(250);
68 * Whether the view should respond to vertical or horizontal scrolling
71 public final ConfigOption
<Boolean
> isScrollingListenersEnabled
= new ConfigOption
<>(true);
73 // ------------------------------------------------------------------------
75 // ------------------------------------------------------------------------
77 public final ConfigOption
<Boolean
> isLoadingOverlayEnabled
= new ConfigOption
<>(true);
79 public final ConfigOption
<Color
> loadingOverlayColor
= new ConfigOption
<>(requireNonNull(Color
.GRAY
));
81 public final ConfigOption
<Double
> loadingOverlayFullOpacity
= new ConfigOption
<>(0.3);
82 public final ConfigOption
<Double
> loadingOverlayTransparentOpacity
= new ConfigOption
<>(0.0);
84 public final ConfigOption
<Double
> loadingOverlayFadeInDuration
= new ConfigOption
<>(1000.0);
85 public final ConfigOption
<Double
> loadingOverlayFadeOutDuration
= new ConfigOption
<>(100.0);
87 // ------------------------------------------------------------------------
89 // ------------------------------------------------------------------------
92 * The zoom animation duration, which is the amount of milliseconds it takes
93 * to complete the zoom animation (smaller number means a faster animation).
95 public final ConfigOption
<Integer
> zoomAnimationDuration
= new ConfigOption
<>(50);
98 * Each zoom action (typically, one mouse-scroll == one zoom action) will
99 * increase or decrease the current visible time range by this factor.
101 public final ConfigOption
<Double
> zoomStep
= new ConfigOption
<>(0.08);
104 * Each zoom action will be centered on the center of the selection if it's
107 public final ConfigOption
<Boolean
> zoomPivotOnSelection
= new ConfigOption
<>(true);
110 * Each zoom action will be centered on the current mouse position if the
111 * zoom action originates from a mouse event. If zoomPivotOnSelection is
112 * enabled, it has priority.
114 public final ConfigOption
<Boolean
> zoomPivotOnMousePosition
= new ConfigOption
<>(true);
116 // ------------------------------------------------------------------------
118 // ------------------------------------------------------------------------
120 public final ConfigOption
<Double
> stateIntervalOpacity
= new ConfigOption
<>(1.0);
122 public final ConfigOption
<Paint
> multiStatePaint
;
124 Stop
[] stops
= new Stop
[] { new Stop(0, Color
.BLACK
), new Stop(1, Color
.WHITE
) };
125 LinearGradient lg
= new LinearGradient(0, 0, 0, 1, true, CycleMethod
.NO_CYCLE
, stops
);
126 multiStatePaint
= new ConfigOption
<>(lg
);
129 // ------------------------------------------------------------------------
131 // ------------------------------------------------------------------------
133 public final ConfigOption
<Font
> stateLabelFont
= new ConfigOption
<Font
>(requireNonNull(new Text().getFont())) {
135 public void set(Font value
) {
137 recomputeEllipsisWidth();
141 public static final String ELLIPSIS_STRING
= "..."; //$NON-NLS-1$
143 private transient double fEllipsisWidth
;
145 public double getEllipsisWidth() {
146 return fEllipsisWidth
;
149 private synchronized void recomputeEllipsisWidth() {
150 Text text
= new Text(ELLIPSIS_STRING
);
151 text
.setFont(stateLabelFont
.get());
153 fEllipsisWidth
= text
.getLayoutBounds().getWidth();
156 // ------------------------------------------------------------------------
158 // ------------------------------------------------------------------------
160 public final ConfigOption
<Font
> toolTipFont
= new ConfigOption
<>(Font
.font(14));
162 public final ConfigOption
<Color
> toolTipFontFill
= new ConfigOption
<>(requireNonNull(Color
.WHITE
));