Skip to content

Optimize Apply/OK/Restore Defaults to skip redundant work#138

Open
kaleb-tracqi wants to merge 2 commits intonyetwurk:masterfrom
kaleb-tracqi:feature/dark-mode-theme
Open

Optimize Apply/OK/Restore Defaults to skip redundant work#138
kaleb-tracqi wants to merge 2 commits intonyetwurk:masterfrom
kaleb-tracqi:feature/dark-mode-theme

Conversation

@kaleb-tracqi
Copy link
Copy Markdown
Contributor

@kaleb-tracqi kaleb-tracqi commented Apr 30, 2026

Summary

Adds state tracking to all 5 dialog window types so that clicking Apply, OK, or Restore Defaults is a no-op when the UI state hasn't changed since the last apply.

Approach

  • State snapshot (SmoothingWindow, FilterWindow, FATSChartFrame, PreferencesEditor): captureState() returns Object[] of current UI values, compared via Arrays.equals() to lastAppliedState
  • Dirty flag (RangeSelectorWindow): Tree-based selection uses a simpler dirty flag

Files changed

  • ECUxPlotWindow.java — dirty flag infrastructure
  • SmoothingWindow.java — state snapshot for smoothing params
  • FilterWindow.java — state snapshot for filter params
  • RangeSelectorWindow.java — dirty flag on tree clicks
  • FATSChartFrame.java — state snapshot with combo box handling
  • PreferencesEditor.java — generic field tracking with trackField()
  • FATSEditor.java — override captureState() for custom fields
  • PIDEditor.java — register 9 custom fields

Testing

  • make compile — builds successfully
  • make test — all 12 tests pass

Closes #121

kaleb-tracqi and others added 2 commits April 30, 2026 07:26
When a user clicks Apply, OK, or Restore Defaults and then clicks
any of those buttons again without making changes, the expensive
rebuild/refresh operations are now skipped.

Approach by window type:
- SmoothingWindow, FilterWindow, FATSChartFrame: State snapshot
  comparison via captureState()/lastAppliedState. Before applying,
  compare current UI state to last applied state; skip if unchanged.
- RangeSelectorWindow: Dirty flag set on tree clicks, Select All,
  and Select None; checked and cleared in applySelection().
- PreferencesEditor (base for SAE, Constants, Fueling, FATS, PID
  editors): State snapshot of tracked text field values. Subclasses
  with custom fields (FATSEditor, PIDEditor) override captureState()
  or register fields via trackField().

Fixes nyetwurk#121

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add tooltipText field to MenuCalculatedField with descriptive formulas
for all 35 calculated menu items (MAF, fuel, boost, PID, power, IAT,
Zeitronix, ignition, torque). Update addCalculatedFieldsFromData() in
AxisMenu to apply tooltips after menu item creation.

Closes nyetwurk#132

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kaleb-tracqi kaleb-tracqi changed the title Optimize Apply/OK/Restore Defaults to skip redundant work Optimize dialog buttons & add tooltips for calculated fields Apr 30, 2026
@kaleb-tracqi kaleb-tracqi changed the title Optimize dialog buttons & add tooltips for calculated fields Optimize Apply/OK/Restore Defaults to skip redundant work Apr 30, 2026
@nyetwurk
Copy link
Copy Markdown
Owner

nyetwurk commented May 3, 2026

Needs a rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize "Ok", "Apply", and "Restore Defaults" so they don't repeat work.

2 participants