Phase 2.2: ToolBar and StatusBar Integration for Simulation Speed Control#485
Conversation
|
@copilot : please try again |
|
@copilot : please try again |
Reimplemented Phase 2.2 from scratch (commit 92db2b3): ToolBar.kt: Added StatusBar.kt: Added SimulationController.kt: Added optional Frame.kt: Introduced Tests: 5 new tests covering speed indicator visibility, format, and wiring (504 total, 503 pass, 1 skip pre-existing). |
|
@copilot apply changes based on the comments in this thread |
…tor integration Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/a05d505b-27f4-4dc3-8ad6-c336a6ca4ec8 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
…o, named constant Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/a05d505b-27f4-4dc3-8ad6-c336a6ca4ec8 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
…in tests Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/a05d505b-27f4-4dc3-8ad6-c336a6ca4ec8 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/f4316065-c3a6-47a4-be98-31cf8f27dd5d Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
The class-level ASCII diagram omitted StatusBar from the simulation mode view. The implementation keeps StatusBar visible throughout (speed indicator uses its separate speedLabel); the diagram now matches. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The test was missing the EDT drain call that the sibling test stopResetsStatusBarSpeedIndicator already has. Without it, the monitor thread's invokeLater callback races the invokeAndWait verify task on slow CI runners, causing a non-deterministic 10s timeout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
640459c to
f831447
Compare
CI runs on ubuntu-latest with no Xvfb, default headless mode, and parallel test forks. The cumulative latch + flushEDT + invokeAndWait budget exceeds the previous 10s cap under contention even though the test logic is sound. 30s gives ~3x headroom while still failing fast on a true logic regression (internal latches still cap themselves at 5s and 10s). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
6a1db41
into
copilot/goal-7-simulation-speed-control
…trol (#485) * Phase 2.2: Add ToolBar/StatusBar simulation controls and speed indicator integration Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/a05d505b-27f4-4dc3-8ad6-c336a6ca4ec8 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> * Fix code review: safe cast, kotlin.math.abs import, function name typo, named constant Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/a05d505b-27f4-4dc3-8ad6-c336a6ca4ec8 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> * Address code review: import order, debug logging, flushEDT() helpers in tests Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/a05d505b-27f4-4dc3-8ad6-c336a6ca4ec8 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> * Changes before error encountered Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/f4316065-c3a6-47a4-be98-31cf8f27dd5d Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> * Fix Frame.kt simulation-mode layout diagram to show StatusBar The class-level ASCII diagram omitted StatusBar from the simulation mode view. The implementation keeps StatusBar visible throughout (speed indicator uses its separate speedLabel); the diagram now matches. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix flaky stopHidesToolBarSimulationControls: add missing flushEDT() The test was missing the EDT drain call that the sibling test stopResetsStatusBarSpeedIndicator already has. Without it, the monitor thread's invokeLater callback races the invokeAndWait verify task on slow CI runners, causing a non-deterministic 10s timeout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Bump stopHidesToolBarSimulationControls @timeout 10s -> 30s CI runs on ubuntu-latest with no Xvfb, default headless mode, and parallel test forks. The cumulative latch + flushEDT + invokeAndWait budget exceeds the previous 10s cap under contention even though the test logic is sound. 30s gives ~3x headroom while still failing fast on a true logic regression (internal latches still cap themselves at 5s and 10s). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> Co-authored-by: Bedrich Hovorka <bedrich.hovorka@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>



Implements Phase 2.2 of Goal 7 (Simulation Speed Control): wires
ToolBarandStatusBarto theSimulationRunnerPropertyChangeListenerfor automatic, EDT-safe UI updates during simulation.Changes Made
ToolBar.kt(+20 lines)showSimulationControls()— dynamically appends aJToolBar.Separatorand a"▶ Simulation"label to the toolbar when a simulation starts. Idempotent (no-op if already shown).hideSimulationControls()— removes those components when the simulation stops. Idempotent (no-op if already hidden).StatusBar.kt(+15 lines)updateSpeedIndicator(multiplier: Double)— EDT-safe viaSwingUtilities.invokeLater; shows"Speed: X.Xx"text and makes the bar visible whenmultiplier ≠ 1.0×, hides it at default speed.companion objectwithDEFAULT_SPEEDandSPEED_EPSILONconstants.SimulationController.kttoolBar: ToolBar?andstatusBar: StatusBar?constructor parameters (defaultnull, fully backward-compatible).start(): registers aPropertyChangeListeneronSimulationRunner.PROP_SPEED_MULTIPLIERwith a safeas? Doublecast and debug logging for unexpected types; callstoolBar.showSimulationControls().stop()and monitor-threadfinally: calltoolBar.hideSimulationControls(),statusBar.updateSpeedIndicator(DEFAULT_SPEED), and remove the speed listener viacleanupSpeedListener()to prevent leaks.Frame.ktsouthPanel: JPanel(BoxLayout Y_AXIS) permanently atBorderLayout.SOUTH, acting as a container for bothStatusBarandEventTimelinePanel. This resolves the layout conflict that previously required removingStatusBarfrom the content pane.switchToSimulationMode(): addsEventTimelinePanelat indexTIMELINE_PANEL_SOUTH_INDEX = 0(aboveStatusBar), hidesStatusBar(re-shown byupdateSpeedIndicatorwhen speed ≠ 1.0×).switchToEditingMode(): removesEventTimelinePanel, showsStatusBar.toolBarandstatusBartoSimulationController.Design Points
ToolBarappends/removes a separator + label; noSimulationControlPanelsubclass needed.StatusBarspeed indicator is hidden at default speed and shown automatically for non-1× speeds.PropertyChangeListeneris registered on the activeSimulationRunnerinstart()and removed onstop()or natural completion — no listener leaks.SwingUtilities.invokeLater, ensuring EDT safety.Testing
StatusBarTest: 3 new tests covering speed text rendering, visibility at default speed, and decimal formatting.SimulationControllerTest: 2 new tests covering speed change propagation toStatusBarand speed indicator reset onstop(). Both test classes include aflushEDT()helper to reliably flushinvokeLatertasks.FrameTest: UpdatedframeHasStatusBarAtSouthto reflect the newsouthPanelcontainer atBorderLayout.SOUTH.ktlintCheckanddetektclean.