X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fexamples%2FComponenetSerializer.java;h=397592e1e203e2eb9002f21c05f72bf19abeb7af;hb=9ca90120a47e07c9182162351dc47aa89ae703be;hp=4c7b5d9f864f41a3b034b3c9d5eb7cd4992e8697;hpb=0e490475fa05c2f05ec875165fc6e38e543d6d65;p=Mograsim.git diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java index 4c7b5d9f..397592e1 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java @@ -3,6 +3,8 @@ package net.mograsim.logic.ui.examples; import java.io.IOException; import java.util.function.Function; +import com.google.gson.JsonObject; + import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; import net.mograsim.logic.ui.model.components.mi.nandbased.GUI_rsLatch; @@ -57,6 +59,15 @@ public class ComponenetSerializer for (SubmodelComponent comp : components) { SubmodelComponentParams params = comp.calculateParams(getIdentifier); + JsonObject symbolRendererParams = new JsonObject(); + symbolRendererParams.addProperty("centerText", comp.getClass().getSimpleName().substring(3)); // cut away the "GUI" part + symbolRendererParams.addProperty("horizontalComponentCenter", comp.getWidth() / 2); + // use the defaults from SimpleRectangularSubmodelComponent + symbolRendererParams.addProperty("centerTextHeight", 5); + symbolRendererParams.addProperty("pinLabelHeight", 3.5); + symbolRendererParams.addProperty("pinLabelMargin", .5); + params.symbolRendererSnippetID = "SimpleRectangularLikeSymbolRenderer"; + params.symbolRendererParams = symbolRendererParams; JsonHandler.writeJson(params, "components/" + comp.getClass().getName().substring("net.mograsim.logic.ui.model.components.mi.nandbased.".length()).replace('.', '/') + ".json");