From 695adc1f6bfb0a0eeef4dd6c035475ea2826871f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Jun 2025 20:10:38 +0300 Subject: Complete GUI decoupling implementation for headless testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implement MessageHandler pattern to decouple message sending from visualization - Add HeadlessLoader to load simulations without GUI components - Create HeadlessProtocolRunner for clean protocol test execution - Update VSInternalProcess to use MessageHandler for message routing - Add null checks in VSSimulator for headless mode compatibility - Update VSSimulatorVisualization paint() to check for headless mode - Remove obsolete test scripts and documentation - Update test-protocols.sh to remove GUI error suppression options - Consolidate testing documentation in docs/testing-guide.md All protocol tests now run cleanly in headless mode without GUI errors, enabling proper CI/CD integration and automated testing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../simulator/engine/SimulationVisualizer.java | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/main/java/simulator/engine/SimulationVisualizer.java (limited to 'src/main/java/simulator/engine/SimulationVisualizer.java') diff --git a/src/main/java/simulator/engine/SimulationVisualizer.java b/src/main/java/simulator/engine/SimulationVisualizer.java new file mode 100644 index 0000000..3151638 --- /dev/null +++ b/src/main/java/simulator/engine/SimulationVisualizer.java @@ -0,0 +1,61 @@ +package simulator.engine; + +import core.VSInternalProcess; +import core.VSMessage; + +/** + * Interface for visualization components that observe simulation events. + * Implementations can choose to display these events visually or ignore them. + */ +public interface SimulationVisualizer { + + /** + * Called when a message is sent in the simulation. + * @param message The message that was sent + */ + void onMessageSent(VSMessage message); + + /** + * Called when a process is added to the simulation. + * @param process The process that was added + */ + void onProcessAdded(VSInternalProcess process); + + /** + * Called when a process is removed from the simulation. + * @param process The process that was removed + */ + void onProcessRemoved(VSInternalProcess process); + + /** + * Called when the simulation time changes. + * @param time The new time value + */ + void onTimeChanged(long time); + + /** + * Called when the simulation is reset. + */ + void onSimulationReset(); + + /** + * Called when the simulation starts or resumes. + */ + void onSimulationStarted(); + + /** + * Called when the simulation is paused. + */ + void onSimulationPaused(); + + /** + * Called when the simulation finishes. + */ + void onSimulationFinished(); + + /** + * Called when a process state changes. + * @param process The process whose state changed + */ + void onProcessStateChanged(VSInternalProcess process); +} \ No newline at end of file -- cgit v1.2.3