X-Git-Url: https://mograsim.net/gitweb/?p=Mograsim.git;a=blobdiff_plain;f=plugins%2Fnet.mograsim.logic.model.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fexamples%2FOpenPreviewOfEveryComponent.java;h=5a9690a205f985d5c56a519ffe949dace4679b6c;hp=7c47a3ee587143c973c20510dc07d1fb95565f42;hb=09b979ab0fe60f58406996240efc17415dea4e3d;hpb=5995c2c9f891ae852a40b4c4736b090d514e7c0a 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(); } }