use of com.efficios.jabberwocky.common.TimeRange in project lttng-scope by lttng.
the class TimeGraphDrawnEventLayer method trackEventProvider.
private void trackEventProvider(TimeGraphDrawnEventProvider provider) {
Group newGroup = new Group();
Group oldGroup = fEventProviders.put(provider, newGroup);
if (oldGroup == null) {
Platform.runLater(() -> {
getParentGroup().getChildren().add(newGroup);
});
} else {
/* Remove the old group in case there was already one. */
Platform.runLater(() -> {
getParentGroup().getChildren().remove(oldGroup);
getParentGroup().getChildren().add(newGroup);
});
}
/*
* Add a listener to this provider's "enabled" property, so that when it
* changes from enabled to disabled and vice versa, we update the view
* accordingly.
*/
provider.enabledProperty().addListener((obs, oldValue, newValue) -> {
if (newValue) {
/* The provider was just enabled */
TimeRange timeRange = getWidget().getViewContext().getVisibleTimeRange();
TimeGraphTreeRender treeRender = getWidget().getLatestTreeRender();
// FIXME Use a Task?
paintEventsOfProvider(treeRender, timeRange, provider, null);
} else {
/* Provider was disabled. Clear the children of its group. */
Group group = fEventProviders.get(provider);
if (group == null) {
return;
}
Platform.runLater(() -> group.getChildren().clear());
}
});
getWidget().getTimelineWidgetUpdateTask().forceRedraw();
}
Aggregations