X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2FGUIComponent.java;h=89c532e407635b64f7dedb3460228b81ad4cc88f;hb=2322c2da8893d16273c16a9c3db3b4298ada4895;hp=5f74dadd9a411636a3f50039502b5de20379224f;hpb=b555e4c29e14f455d8ffbc810284c7bb44b459f9;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java index 5f74dadd..89c532e4 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java @@ -4,10 +4,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Consumer; +import java.util.function.Supplier; import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.logic.ui.model.components.params.SubmodelComponentParams; import net.mograsim.logic.ui.model.wires.Pin; public abstract class GUIComponent @@ -23,6 +25,8 @@ public abstract class GUIComponent private final List redrawListeners; private final Runnable redrawListenerForSubcomponents; + // Defines how the GUIComponent is referenced in SubmodelComponentParams + protected Supplier identifierDelegate = () -> "class:".concat(getClass().getCanonicalName()); public GUIComponent(ViewModelModifiable model) { @@ -130,8 +134,11 @@ public abstract class GUIComponent callRedrawListeners(); } + /** + * @return an identifier used to reference this GUIComponent inside of {@link SubmodelComponentParams} + */ public String getIdentifier() { - return "class:".concat(getClass().getCanonicalName()); + return identifierDelegate.get(); } } \ No newline at end of file