From 939fbe02cf53a659f5f9fdd46394c4a79def73b1 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Tue, 28 May 2019 11:52:33 +0200 Subject: [PATCH] LogicUIPart: Removed old code now incompatible with LogicUI --- .../src/sampleercp/parts/LogicUIPart.java | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/SampleERCP/src/sampleercp/parts/LogicUIPart.java b/SampleERCP/src/sampleercp/parts/LogicUIPart.java index f725d5b6..fa18e2d3 100644 --- a/SampleERCP/src/sampleercp/parts/LogicUIPart.java +++ b/SampleERCP/src/sampleercp/parts/LogicUIPart.java @@ -8,8 +8,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import era.mi.gui.LogicUICanvas; -import era.mi.gui.examples.RSLatchGUIExample; -import era.mi.logic.timeline.Timeline; +import era.mi.gui.model.ViewModel; import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInput; public class LogicUIPart @@ -20,41 +19,41 @@ public class LogicUIPart @PostConstruct public void create(Composite parent) { - Timeline timeline = new Timeline(11); - LogicUICanvas ui = new LogicUICanvas(parent, SWT.NONE); - RSLatchGUIExample.addComponentsAndWires(ui, timeline); + ViewModel model = new ViewModel(); + LogicUICanvas ui = new LogicUICanvas(parent, SWT.NONE, model); +// RSLatchGUIExample.addComponentsAndWires(ui, timeline); ui.addTransformListener((x, y, z) -> part.setDirty(z < 1)); ZoomableCanvasUserInput userInput = new ZoomableCanvasUserInput(ui); userInput.buttonDrag = 3; userInput.buttonZoom = 2; userInput.enableUserInput(); - Thread simulationThread = new Thread(() -> - { - // TODO find a better condition - while (!ui.isDisposed()) - { - // always execute to keep timeline from "hanging behind" for too long - timeline.executeUpTo(System.currentTimeMillis(), System.currentTimeMillis() + 10); - long sleepTime; - if (timeline.hasNext()) - sleepTime = timeline.nextEventTime() - System.currentTimeMillis(); - else - sleepTime = 10; - try - { - if (sleepTime > 0) - Thread.sleep(sleepTime); - } - catch (InterruptedException e) - { - } // it is normal execution flow to be interrupted - } - }); - simulationThread.start(); - timeline.addEventAddedListener(event -> - { - if (event.getTiming() <= System.currentTimeMillis()) - simulationThread.interrupt(); - }); +// Thread simulationThread = new Thread(() -> +// { +// // TODO find a better condition +// while (!ui.isDisposed()) +// { +// // always execute to keep timeline from "hanging behind" for too long +// timeline.executeUpTo(System.currentTimeMillis(), System.currentTimeMillis() + 10); +// long sleepTime; +// if (timeline.hasNext()) +// sleepTime = timeline.nextEventTime() - System.currentTimeMillis(); +// else +// sleepTime = 10; +// try +// { +// if (sleepTime > 0) +// Thread.sleep(sleepTime); +// } +// catch (InterruptedException e) +// { +// } // it is normal execution flow to be interrupted +// } +// }); +// simulationThread.start(); +// timeline.addEventAddedListener(event -> +// { +// if (event.getTiming() <= System.currentTimeMillis()) +// simulationThread.interrupt(); +// }); } } \ No newline at end of file -- 2.17.1