X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2Fatomic%2FTextComponent.java;h=d7255d3548e6368a067dfaad33cf4f576b39c41c;hb=c2f35f6e49b452e6b686bd78a1c08055abafabf5;hp=e1fdc6c53633af0e5de3a65cb054a9659e378ffc;hpb=01c5d7035474a5eb58f216b6831b2c0d8c174efa;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/atomic/TextComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/atomic/TextComponent.java index e1fdc6c5..d7255d35 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/atomic/TextComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/atomic/TextComponent.java @@ -2,6 +2,9 @@ package net.mograsim.logic.ui.model.components.atomic; import org.eclipse.swt.graphics.Color; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; + import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; @@ -9,6 +12,7 @@ import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter; import net.mograsim.logic.ui.modeladapter.componentadapters.NoLogicAdapter; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; import net.mograsim.preferences.Preferences; //TODO clean size calculation mess @@ -37,8 +41,17 @@ public class TextComponent extends GUIComponent gc.drawText(text, getPosX(), getPosY(), true); } + // serializing + + @Override + public JsonElement getParams() + { + return new JsonPrimitive(text); + } + static { ViewLogicModelAdapter.addComponentAdapter(new NoLogicAdapter<>(TextComponent.class)); + IndirectGUIComponentCreator.setComponentProvider(TextComponent.class.getName(), (m, p) -> new TextComponent(m, p.getAsString())); } }