use of il.ac.technion.cs.smarthouse.applications.dashboard.model.widget.GraphWidget in project Smartcity-Smarthouse by TechnionYP5777.
the class ConfigurationController method addTimer.
private static void addTimer(String key, WidgetType type, final BasicWidget widget) {
List<AnimationTimer> where = timers.getOrDefault(key, new ArrayList<>());
where.add(new AnimationTimer() {
private long lastTimerCall;
final Random RND = new Random();
final Boolean isGraph = key.equals(new GraphWidget(WidgetType.AREA_GRAPH).getTitle());
@Override
public void handle(long now) {
if (now > lastTimerCall + 500_000_000) {
if (isGraph)
GraphWidget.getDefaultSerie().getData().stream().forEach(data -> widget.updateExisting(RND.nextInt(100), data.getXValue()));
else
widget.updateExisting(RND.nextDouble() * 100, null);
lastTimerCall = now;
}
}
});
timers.put(key, where);
}
Aggregations