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<GUIComponent> components;
private final List<GUIComponent> componentsUnmodifiable;
}
/**
- * 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)
{
}
/**
- * 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)
{
return wiresUnmodifiable;
}
+ @Override
+ public void accept(ModelVisitor mv)
+ {
+ mv.visit(this);
+ }
+
// @formatter:off
public void addComponentAddedListener (Consumer<? super GUIComponent> listener) {componentAddedListeners .add (listener);}
public void addComponentRemovedListener (Consumer<? super GUIComponent> listener) {componentRemovedListeners.add (listener);}