1 package net.mograsim.logic.model.examples;
3 import java.util.concurrent.atomic.AtomicReference;
5 import net.haspamelodica.swt.helper.gcs.GeneralGC;
6 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
7 import net.mograsim.logic.core.timeline.TimelineEventHandler;
8 import net.mograsim.logic.model.LogicUICanvas;
9 import net.mograsim.logic.model.SimpleLogicUIStandalone;
10 import net.mograsim.logic.model.SimpleLogicUIStandalone.VisualisationObjects;
11 import net.mograsim.logic.model.model.ViewModelModifiable;
12 import net.mograsim.logic.model.serializing.DeserializedSubmodelComponent;
13 import net.mograsim.logic.model.serializing.IdentifierGetter;
14 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
15 import net.mograsim.logic.model.snippets.Renderer;
17 public class FusionNotWorkingTest
19 public static void main(String[] args)
21 SimpleLogicUIStandalone.executeVisualisation(FusionNotWorkingTest::create, FusionNotWorkingTest::beforeRun);
24 public static void create(ViewModelModifiable model)
26 // TODO use _SE in GUIAm2904.json
27 // TODO replace with proper ViewModel deserialization
28 DeserializedSubmodelComponent testbench = (DeserializedSubmodelComponent) IndirectGUIComponentCreator.createComponent(model,
29 "file:FusionNotWorkingTest.json", "testbench");
30 testbench.setSize(1000, 1000);
31 testbench.setOutlineRenderer(new Renderer()
34 public Object getParamsForSerializing(IdentifierGetter idGetter)
40 public void render(GeneralGC gc, Rectangle visibleRegion)
47 public static void beforeRun(VisualisationObjects vis)
49 // TODO workaround for rendering bug
50 AtomicReference<TimelineEventHandler> functionRef = new AtomicReference<>();
51 LogicUICanvas logicUICanvas = vis.gui.getLogicUICanvas();
52 TimelineEventHandler function = e ->
54 logicUICanvas.redrawThreadsafe();
55 vis.timeline.addEvent(functionRef.get(), 50);
57 functionRef.set(function);
58 vis.timeline.addEvent(function, 0);