import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
+import java.util.function.Supplier;
-import net.mograsim.logic.ui.model.ViewModel;
-import net.mograsim.logic.ui.model.wires.Pin;
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.wires.Pin;
public abstract class GUIComponent
{
- protected final ViewModel model;
+ protected final ViewModelModifiable model;
private final Rectangle bounds;
private final List<Pin> pins;
protected final List<Pin> pinsUnmodifiable;
private final List<Runnable> redrawListeners;
private final Runnable redrawListenerForSubcomponents;
+ // Defines how the GUIComponent is referenced in SubmodelComponentParams
+ protected Supplier<String> identifierDelegate = () -> "class:".concat(getClass().getCanonicalName());
- public GUIComponent(ViewModel model)
+ public GUIComponent(ViewModelModifiable model)
{
this.model = model;
this.bounds = new Rectangle(0, 0, 0, 0);
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