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=7254d8bd12c7bf172fabcfbcd9f1ea068886150d;hb=20aa3391efe7ae7d99861741f8b5594f88eae1d9;hp=a4c1031f43959fd145c9ae8732be72efaa05838c;hpb=9c142c9ad59d2af070ebb6495b1ca48242da62d8;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 a4c1031f..7254d8bd 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,6 +4,7 @@ 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; @@ -23,6 +24,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) { @@ -129,4 +132,12 @@ public abstract class GUIComponent pin.removeRedrawListener(redrawListenerForSubcomponents); callRedrawListeners(); } + + /** + * @return an identifier used to reference this GUIComponent inside of {@link SubmodelComponentParams} + */ + public String getIdentifier() + { + return identifierDelegate.get(); + } } \ No newline at end of file