X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fmodel%2FViewModel.java;h=5a41d0ea35e43bb9f12de9741ec46154fe580c0d;hb=4a6a0a2c85c1a16112efaf7ca6d2b5fba3c9b466;hp=de22f4477c233db09f916fa044b1b9437c9e046d;hpb=4d29cabdc45d68b5e5f210266dc4fbc5560dbcdd;p=Mograsim.git diff --git a/LogicUI/src/era/mi/gui/model/ViewModel.java b/LogicUI/src/era/mi/gui/model/ViewModel.java index de22f447..5a41d0ea 100644 --- a/LogicUI/src/era/mi/gui/model/ViewModel.java +++ b/LogicUI/src/era/mi/gui/model/ViewModel.java @@ -37,7 +37,7 @@ public class ViewModel if (components.contains(component)) throw new IllegalStateException("Don't add the same component twice!"); components.add(component); - componentAddedListeners.forEach(l -> l.accept(component)); + callComponentAddedListeners(component); } /** @@ -49,7 +49,7 @@ public class ViewModel if (!components.contains(component)) throw new IllegalStateException("Don't remove the same component twice!"); components.remove(component); - componentRemovedListeners.forEach(l -> l.accept(component)); + callComponentRemovedListeners(component); } // @formatter:off @@ -62,5 +62,10 @@ public class ViewModel public void removeComponentRemovedListener(Consumer listener){componentRemovedListeners.remove(listener);} public void removeWireAddedListener (Consumer listener){wireAddedListeners .remove(listener);} public void removeWireRemovedListener (Consumer listener){wireRemovedListeners .remove(listener);} + + private void callComponentAddedListeners (GUIComponent c) {componentAddedListeners .forEach(l -> l.accept(c));} + private void callComponentRemovedListeners(GUIComponent c) {componentRemovedListeners.forEach(l -> l.accept(c));} + private void callWireAddedListeners (GUIWire w ) {wireAddedListeners .forEach(l -> l.accept(w));} + private void callWireRemovedListeners (GUIWire w ) {wireRemovedListeners .forEach(l -> l.accept(w));} // @formatter:on } \ No newline at end of file