From 213446f32132c309c396d0d8c66b6977efb81df1 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Mon, 3 Jun 2019 22:10:37 +0200 Subject: [PATCH] Splitted ViewModel and ViewModelModifiable --- .../logic/ui/SimpleLogicUIStandalone.java | 8 +- .../logic/ui/examples/Am2901Example.java | 4 +- .../logic/ui/examples/RSLatchExample.java | 6 +- .../mograsim/logic/ui/model/ViewModel.java | 15 +- .../logic/ui/model/ViewModelModifiable.java | 31 ++++ .../ui/model/components/Am2901NANDBased.java | 4 +- .../logic/ui/model/components/GUIAndGate.java | 4 +- .../ui/model/components/GUIBitDisplay.java | 4 +- .../ui/model/components/GUIComponent.java | 8 +- .../ui/model/components/GUIManualSwitch.java | 172 +++++++++--------- .../logic/ui/model/components/GUINotGate.java | 4 +- .../logic/ui/model/components/GUIOrGate.java | 4 +- .../components/SimpleRectangularGUIGate.java | 8 +- .../logic/ui/model/wires/GUIWire.java | 6 +- .../logic/ui/model/wires/WireCrossPoint.java | 4 +- 15 files changed, 154 insertions(+), 128 deletions(-) create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/ViewModelModifiable.java diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/SimpleLogicUIStandalone.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/SimpleLogicUIStandalone.java index 962427ff..6c856c47 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/SimpleLogicUIStandalone.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/SimpleLogicUIStandalone.java @@ -3,13 +3,13 @@ package net.mograsim.logic.ui; import java.util.function.Consumer; import net.mograsim.logic.core.timeline.Timeline; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.modeladapter.LogicModelParameters; import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter; public class SimpleLogicUIStandalone { - public static void executeVisualisation(Consumer setupViewModel) + public static void executeVisualisation(Consumer setupViewModel) { LogicModelParameters params = new LogicModelParameters(); params.gateProcessTime = 50; @@ -17,10 +17,10 @@ public class SimpleLogicUIStandalone executeVisualisation(setupViewModel, params); } - public static void executeVisualisation(Consumer setupViewModel, LogicModelParameters params) + public static void executeVisualisation(Consumer setupViewModel, LogicModelParameters params) { // setup view model - ViewModel viewModel = new ViewModel(); + ViewModelModifiable viewModel = new ViewModelModifiable(); setupViewModel.accept(viewModel); // convert to logic model diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/Am2901Example.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/Am2901Example.java index 0cafa7e6..3ead2c7d 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/Am2901Example.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/Am2901Example.java @@ -1,7 +1,7 @@ package net.mograsim.logic.ui.examples; import net.mograsim.logic.ui.SimpleLogicUIStandalone; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.Am2901NANDBased; import net.mograsim.logic.ui.model.components.GUIBitDisplay; import net.mograsim.logic.ui.model.components.GUIManualSwitch; @@ -19,7 +19,7 @@ public class Am2901Example } @SuppressWarnings("unused") // for GUIWires being created - public static void createAm2901Example(ViewModel model) + public static void createAm2901Example(ViewModelModifiable model) { Am2901NANDBased am2901 = new Am2901NANDBased(model); am2901.moveTo(100, 0); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/RSLatchExample.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/RSLatchExample.java index af91d1f1..835d7948 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/RSLatchExample.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/RSLatchExample.java @@ -1,13 +1,13 @@ package net.mograsim.logic.ui.examples; +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.mograsim.logic.ui.SimpleLogicUIStandalone; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIManualSwitch; import net.mograsim.logic.ui.model.components.GUINotGate; import net.mograsim.logic.ui.model.components.GUIOrGate; import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.WireCrossPoint; -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; public class RSLatchExample { @@ -17,7 +17,7 @@ public class RSLatchExample } @SuppressWarnings("unused") // for GUIWires being created - public static void createRSLatchExample(ViewModel model) + public static void createRSLatchExample(ViewModelModifiable model) { GUIManualSwitch rIn = new GUIManualSwitch(model); rIn.moveTo(100, 100); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/ViewModel.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/ViewModel.java index 7f9b113f..869f1a11 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/ViewModel.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/ViewModel.java @@ -23,7 +23,7 @@ public class ViewModel private final Runnable redrawListenerForSubcomponents; - public ViewModel() + protected ViewModel() { components = new ArrayList<>(); componentsUnmodifiable = Collections.unmodifiableList(components); @@ -43,7 +43,7 @@ public class ViewModel * Adds the given component to the list of components and calls all componentAddedListeners. Don't call this method from application * code as it is automatically called in GUIComponent::new. */ - public void componentCreated(GUIComponent component) + protected void componentCreated(GUIComponent component) { if (components.contains(component)) throw new IllegalStateException("Don't add the same component twice!"); @@ -57,7 +57,7 @@ public class ViewModel * Removes the given component from the list of components and calls all componentRemovedListeners. Don't call this method from * application code as it is automatically called in GUIComponent::destroy. */ - public void componentDestroyed(GUIComponent component) + protected void componentDestroyed(GUIComponent component) { if (!components.contains(component)) throw new IllegalStateException("Don't remove the same component twice!"); @@ -71,7 +71,7 @@ public class ViewModel * Adds the given component to the list of components and calls all componentAddedListeners. Don't call this method from application * code as it is automatically called in GUIComponent::new. */ - public void wireCreated(GUIWire wire) + protected void wireCreated(GUIWire wire) { if (wires.contains(wire)) throw new IllegalStateException("Don't add the same wire twice!"); @@ -85,7 +85,7 @@ public class ViewModel * Removes the given component from the list of components and calls all componentRemovedListeners. Don't call this method from * application code as it is automatically called in GUIComponent::destroy. */ - public void wireDestroyed(GUIWire wire) + protected void wireDestroyed(GUIWire wire) { if (!wires.contains(wire)) throw new IllegalStateException("Don't remove the same wire twice!"); @@ -105,11 +105,6 @@ public class ViewModel return wiresUnmodifiable; } -// public void requestRedraw() -// { -// callRedrawListeners(); -// } - // @formatter:off public void addComponentAddedListener (Consumer listener) {componentAddedListeners .add (listener);} public void addComponentRemovedListener (Consumer listener) {componentRemovedListeners.add (listener);} diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/ViewModelModifiable.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/ViewModelModifiable.java new file mode 100644 index 00000000..21863db7 --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/ViewModelModifiable.java @@ -0,0 +1,31 @@ +package net.mograsim.logic.ui.model; + +import net.mograsim.logic.ui.model.components.GUIComponent; +import net.mograsim.logic.ui.model.wires.GUIWire; + +public class ViewModelModifiable extends ViewModel +{ + @Override + public void componentCreated(GUIComponent component) + { + super.componentCreated(component); + } + + @Override + public void componentDestroyed(GUIComponent component) + { + super.componentDestroyed(component); + } + + @Override + public void wireCreated(GUIWire wire) + { + super.wireCreated(wire); + } + + @Override + public void wireDestroyed(GUIWire wire) + { + super.wireDestroyed(wire); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/Am2901NANDBased.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/Am2901NANDBased.java index 7aace4d6..d63b41da 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/Am2901NANDBased.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/Am2901NANDBased.java @@ -6,7 +6,7 @@ import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Font; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.wires.Pin; // TODO make a superclass @@ -15,7 +15,7 @@ public class Am2901NANDBased extends GUIComponent public final List inputNames; public final List outputNames; - public Am2901NANDBased(ViewModel model) + public Am2901NANDBased(ViewModelModifiable model) { super(model); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIAndGate.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIAndGate.java index 440881df..716d210c 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIAndGate.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIAndGate.java @@ -1,10 +1,10 @@ package net.mograsim.logic.ui.model.components; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; public class GUIAndGate extends SimpleRectangularGUIGate { - public GUIAndGate(ViewModel model, int logicWidth) + public GUIAndGate(ViewModelModifiable model, int logicWidth) { super(model, logicWidth, "&", false); setInputCount(2);// TODO make variable diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIBitDisplay.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIBitDisplay.java index abaec56b..fd2f736c 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIBitDisplay.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIBitDisplay.java @@ -8,7 +8,7 @@ import net.mograsim.logic.core.LogicObservable; import net.mograsim.logic.core.LogicObserver; import net.mograsim.logic.core.components.BitDisplay; import net.mograsim.logic.core.types.BitVectorFormatter; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.wires.Pin; public class GUIBitDisplay extends GUIComponent @@ -22,7 +22,7 @@ public class GUIBitDisplay extends GUIComponent private final LogicObserver logicObs; private BitDisplay bitDisplay; - public GUIBitDisplay(ViewModel model) + public GUIBitDisplay(ViewModelModifiable model) { super(model); logicObs = (i) -> requestRedraw(); 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 ca21622a..a4c1031f 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 @@ -5,14 +5,14 @@ import java.util.Collections; import java.util.List; import java.util.function.Consumer; -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 pins; protected final List pinsUnmodifiable; @@ -24,7 +24,7 @@ public abstract class GUIComponent private final Runnable redrawListenerForSubcomponents; - public GUIComponent(ViewModel model) + public GUIComponent(ViewModelModifiable model) { this.model = model; this.bounds = new Rectangle(0, 0, 0, 0); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIManualSwitch.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIManualSwitch.java index 8d635961..0993024d 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIManualSwitch.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIManualSwitch.java @@ -1,87 +1,87 @@ -package net.mograsim.logic.ui.model.components; - -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.Font; -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; -import net.mograsim.logic.core.LogicObservable; -import net.mograsim.logic.core.LogicObserver; -import net.mograsim.logic.core.components.ManualSwitch; -import net.mograsim.logic.core.types.BitVectorFormatter; -import net.mograsim.logic.core.wires.Wire.ReadEnd; - -public class GUIManualSwitch extends GUIComponent -{ - private static final double width = 20; - private static final double height = 15; - private static final double fontHeight = 5; - - private final Pin outputPin; - - private final LogicObserver logicObs; - private ManualSwitch logicSwitch; - private ReadEnd end; - - public GUIManualSwitch(ViewModel model) - { - super(model); - logicObs = (i) -> requestRedraw(); - - setSize(width, height); - addPin(this.outputPin = new Pin(this, 1, width, height / 2)); - } - - @Override - public void render(GeneralGC gc, Rectangle visibleRegion) - { - double posX = getBounds().x; - double posY = getBounds().y; - - // TODO maybe draw switch state too? - gc.drawRectangle(posX, posY, width, height); - String label = BitVectorFormatter.formatValueAsString(end); - Font oldFont = gc.getFont(); - Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle()); - gc.setFont(labelFont); - Point textExtent = gc.textExtent(label); - gc.drawText(label, posX + (width - textExtent.x) / 2, posY + (height - textExtent.y) / 2, true); - gc.setFont(oldFont); - } - - public void setLogicModelBinding(ManualSwitch logicSwitch, ReadEnd end) - { - deregisterLogicObs(this.end); - deregisterLogicObs(this.logicSwitch); - this.logicSwitch = logicSwitch; - this.end = end; - registerLogicObs(end); - registerLogicObs(logicSwitch); - } - - private void registerLogicObs(LogicObservable observable) - { - if (observable != null) - observable.registerObserver(logicObs); - } - - private void deregisterLogicObs(LogicObservable observable) - { - if (observable != null) - observable.deregisterObserver(logicObs); - } - - @Override - public boolean clicked(double x, double y) - { - if (logicSwitch != null) - logicSwitch.toggle(); - return true; - } - - public Pin getOutputPin() - { - return outputPin; - } +package net.mograsim.logic.ui.model.components; + +import net.haspamelodica.swt.helper.gcs.GeneralGC; +import net.haspamelodica.swt.helper.swtobjectwrappers.Font; +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.core.LogicObservable; +import net.mograsim.logic.core.LogicObserver; +import net.mograsim.logic.core.components.ManualSwitch; +import net.mograsim.logic.core.types.BitVectorFormatter; +import net.mograsim.logic.core.wires.Wire.ReadEnd; +import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.logic.ui.model.wires.Pin; + +public class GUIManualSwitch extends GUIComponent +{ + private static final double width = 20; + private static final double height = 15; + private static final double fontHeight = 5; + + private final Pin outputPin; + + private final LogicObserver logicObs; + private ManualSwitch logicSwitch; + private ReadEnd end; + + public GUIManualSwitch(ViewModelModifiable model) + { + super(model); + logicObs = (i) -> requestRedraw(); + + setSize(width, height); + addPin(this.outputPin = new Pin(this, 1, width, height / 2)); + } + + @Override + public void render(GeneralGC gc, Rectangle visibleRegion) + { + double posX = getBounds().x; + double posY = getBounds().y; + + // TODO maybe draw switch state too? + gc.drawRectangle(posX, posY, width, height); + String label = BitVectorFormatter.formatValueAsString(end); + Font oldFont = gc.getFont(); + Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle()); + gc.setFont(labelFont); + Point textExtent = gc.textExtent(label); + gc.drawText(label, posX + (width - textExtent.x) / 2, posY + (height - textExtent.y) / 2, true); + gc.setFont(oldFont); + } + + public void setLogicModelBinding(ManualSwitch logicSwitch, ReadEnd end) + { + deregisterLogicObs(this.end); + deregisterLogicObs(this.logicSwitch); + this.logicSwitch = logicSwitch; + this.end = end; + registerLogicObs(end); + registerLogicObs(logicSwitch); + } + + private void registerLogicObs(LogicObservable observable) + { + if (observable != null) + observable.registerObserver(logicObs); + } + + private void deregisterLogicObs(LogicObservable observable) + { + if (observable != null) + observable.deregisterObserver(logicObs); + } + + @Override + public boolean clicked(double x, double y) + { + if (logicSwitch != null) + logicSwitch.toggle(); + return true; + } + + public Pin getOutputPin() + { + return outputPin; + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUINotGate.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUINotGate.java index 01df349b..76d24508 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUINotGate.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUINotGate.java @@ -1,10 +1,10 @@ package net.mograsim.logic.ui.model.components; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; public class GUINotGate extends SimpleRectangularGUIGate { - public GUINotGate(ViewModel model, int logicWidth) + public GUINotGate(ViewModelModifiable model, int logicWidth) { super(model, logicWidth, "1", true); setInputCount(1); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIOrGate.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIOrGate.java index bbc436d7..d4fdb7fe 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIOrGate.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIOrGate.java @@ -1,10 +1,10 @@ package net.mograsim.logic.ui.model.components; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; public class GUIOrGate extends SimpleRectangularGUIGate { - public GUIOrGate(ViewModel model, int logicWidth) + public GUIOrGate(ViewModelModifiable model, int logicWidth) { super(model, logicWidth, "\u22651", false);// ">=1" setInputCount(2); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularGUIGate.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularGUIGate.java index a2875c6a..a1b0c8ad 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularGUIGate.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularGUIGate.java @@ -4,13 +4,13 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import net.mograsim.logic.ui.model.ViewModel; -import net.mograsim.logic.ui.model.wires.MovablePin; -import net.mograsim.logic.ui.model.wires.Pin; import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Font; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.logic.ui.model.wires.MovablePin; +import net.mograsim.logic.ui.model.wires.Pin; public class SimpleRectangularGUIGate extends GUIComponent { @@ -28,7 +28,7 @@ public class SimpleRectangularGUIGate extends GUIComponent private final List inputPins; private final List inputPinsUnmodifiable; - protected SimpleRectangularGUIGate(ViewModel model, int logicWidth, String label, boolean isInverted) + protected SimpleRectangularGUIGate(ViewModelModifiable model, int logicWidth, String label, boolean isInverted) { super(model); this.label = label; diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java index 82fdf4b0..2ee21d7d 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java @@ -10,11 +10,11 @@ import net.mograsim.logic.core.LogicObserver; import net.mograsim.logic.core.types.BitVectorFormatter; import net.mograsim.logic.core.wires.Wire.ReadEnd; import net.mograsim.logic.ui.ColorHelper; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; public class GUIWire { - private final ViewModel model; + private final ViewModelModifiable model; public final int logicWidth; private Pin pin1; private Pin pin2; @@ -25,7 +25,7 @@ public class GUIWire private final LogicObserver logicObs; private ReadEnd end; - public GUIWire(ViewModel model, Pin pin1, Pin pin2, Point... path) + public GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2, Point... path) { logicObs = (i) -> callRedrawListeners(); this.model = model; diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java index fb161ac3..ecd63afa 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java @@ -7,7 +7,7 @@ import net.mograsim.logic.core.LogicObserver; import net.mograsim.logic.core.types.BitVectorFormatter; import net.mograsim.logic.core.wires.Wire.ReadEnd; import net.mograsim.logic.ui.ColorHelper; -import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; public class WireCrossPoint extends GUIComponent @@ -18,7 +18,7 @@ public class WireCrossPoint extends GUIComponent private final LogicObserver logicObs; private ReadEnd end; - public WireCrossPoint(ViewModel model, int logicWidth) + public WireCrossPoint(ViewModelModifiable model, int logicWidth) { super(model); logicObs = (i) -> requestRedraw(); -- 2.17.1