From 09b979ab0fe60f58406996240efc17415dea4e3d Mon Sep 17 00:00:00 2001
From: Daniel Kirschten <daniel.kirschten@gmx.de>
Date: Thu, 15 Oct 2020 16:44:20 +0200
Subject: [PATCH] OpenPreviewOfEveryComponent now no longer simulates
 components

---
 .../examples/OpenPreviewOfEveryComponent.java | 43 +++++++++++--------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/OpenPreviewOfEveryComponent.java b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/OpenPreviewOfEveryComponent.java
index 7c47a3ee..5a9690a2 100644
--- a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/OpenPreviewOfEveryComponent.java
+++ b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/OpenPreviewOfEveryComponent.java
@@ -8,10 +8,14 @@ import java.util.List;
 
 import com.google.gson.JsonObject;
 
-import net.mograsim.logic.model.SimpleLogicUIStandalone;
+import net.mograsim.logic.model.LogicUIStandaloneGUI;
 import net.mograsim.logic.model.am2900.Am2900Loader;
+import net.mograsim.logic.model.model.LogicModelModifiable;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.components.atomic.ModelTextComponent;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
+import net.mograsim.logic.model.preferences.DefaultRenderPreferences;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
 import net.mograsim.logic.model.util.JsonHandler;
 
@@ -35,22 +39,25 @@ public class OpenPreviewOfEveryComponent
 
 		Collections.sort(allComponents, String::compareToIgnoreCase);
 
-		SimpleLogicUIStandalone.executeVisualisation(model ->
-		{
-			int y = 0;
-			for (String componentID : allComponents)
-				try
-				{
-					ModelComponent createComponent = IndirectModelComponentCreator.createComponent(model, componentID);
-					createComponent.moveTo(0, y);
-					new ModelTextComponent(model, componentID).moveTo(createComponent.getWidth() + 10, y);
-					y += createComponent.getHeight() + 10;
-				}
-				catch (RuntimeException e)
-				{
-					new ModelTextComponent(model, "Error creating " + componentID + ": " + e).moveTo(0, y);
-					y += 20;
-				}
-		});
+		LogicModelModifiable model = new LogicModelModifiable();
+		int y = 0;
+		for (String componentID : allComponents)
+			try
+			{
+				ModelComponent createComponent = IndirectModelComponentCreator.createComponent(model, componentID);
+				createComponent.moveTo(0, y);
+				new ModelTextComponent(model, componentID).moveTo(createComponent.getWidth() + 10, y);
+				y += createComponent.getHeight() + 10;
+			}
+			catch (RuntimeException e)
+			{
+				new ModelTextComponent(model, "Error creating " + componentID + ": " + e).moveTo(0, y);
+				y += 20;
+			}
+
+		// give the wires color
+		LogicCoreAdapter.convert(model, CoreModelParameters.builder().build());
+
+		new LogicUIStandaloneGUI(model, new DefaultRenderPreferences()).run();
 	}
 }
-- 
2.17.1