X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2FViewModel.java;h=445810a0670fe8398bfb4201a7e91104bf3b202c;hb=f14ea37d69488dd51518a36413af7176916b8bd7;hp=869f1a113c0edf410dd76e1f49e690b11f3d920c;hpb=9c142c9ad59d2af070ebb6495b1ca48242da62d8;p=Mograsim.git 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 869f1a11..445810a0 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 @@ -8,7 +8,7 @@ import java.util.function.Consumer; import net.mograsim.logic.ui.model.components.GUIComponent; import net.mograsim.logic.ui.model.wires.GUIWire; -public class ViewModel +public class ViewModel implements Visitable { private final List components; private final List componentsUnmodifiable; @@ -68,8 +68,8 @@ 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. + * Adds the given wire to the list of wires and calls all wireAddedListeners. Don't call this method from application code as it is + * automatically called in GUIWire::new. */ protected void wireCreated(GUIWire wire) { @@ -82,8 +82,8 @@ 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. + * Removes the given wire from the list of wires and calls all wireRemovedListeners. Don't call this method from application code as it + * is automatically called in GUIWire::destroy. */ protected void wireDestroyed(GUIWire wire) { @@ -105,6 +105,12 @@ public class ViewModel return wiresUnmodifiable; } + @Override + public void accept(ModelVisitor mv) + { + mv.visit(this); + } + // @formatter:off public void addComponentAddedListener (Consumer listener) {componentAddedListeners .add (listener);} public void addComponentRemovedListener (Consumer listener) {componentRemovedListeners.add (listener);}