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=bf9ea85bebfa82e37756cf3b38890dd0a661d0ee;hb=5ece0acf049bf9af2933f513fe0206565681f622;hp=952d753be744ce201de76401b438217c0e9f11f9;hpb=05f3deb7ee3a0b7162c75e1963be9a739618e3df;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 952d753b..bf9ea85b 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 @@ -28,6 +28,10 @@ public abstract class GUIComponent * The model this component is a part of. */ protected final ViewModelModifiable model; + /** + * The name of this component. Is unique in its model. + */ + public final String name; private final Rectangle bounds; /** * The list of all pins of this component by name. @@ -47,9 +51,10 @@ public abstract class GUIComponent private final Runnable redrawListenerForSubcomponents; // creation and destruction - public GUIComponent(ViewModelModifiable model) + public GUIComponent(ViewModelModifiable model, String name) { this.model = model; + this.name = name == null ? model.getDefaultComponentName(this) : name; this.bounds = new Rectangle(0, 0, 0, 0); this.pinsByName = new HashMap<>(); this.pinsUnmodifiable = Collections.unmodifiableMap(pinsByName);