Optimize Apply/OK/Restore Defaults to skip redundant work#138
Open
kaleb-tracqi wants to merge 2 commits into
Open
Optimize Apply/OK/Restore Defaults to skip redundant work#138kaleb-tracqi wants to merge 2 commits into
kaleb-tracqi wants to merge 2 commits into
Conversation
Owner
|
Needs a rebase |
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>
fdb646f to
2d53b84
Compare
Owner
|
I'm not sure i like how |
Replace fragile manual Object[] captureState() methods with a reusable UIStateTracker class. Components register via track() at creation time, and the tracker handles state capture/comparison automatically. - Add UIStateTracker with track(), snapshot(), hasChanged(), clear() - ECUxPlotWindow: embed stateTracker for SmoothingWindow/FilterWindow - PreferencesEditor: replace trackedFields/captureState/trackField - FATSChartFrame: own stateTracker instance (extends ChartFrame) - FATSEditor: stateTracker.clear() + re-track custom fields - PIDEditor: stateTracker.track() replaces trackField() - Remove all manual Object[] captureState() methods Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
captureState()returnsObject[]of current UI values, compared viaArrays.equals()tolastAppliedStateFiles changed
ECUxPlotWindow.java— dirty flag infrastructureSmoothingWindow.java— state snapshot for smoothing paramsFilterWindow.java— state snapshot for filter paramsRangeSelectorWindow.java— dirty flag on tree clicksFATSChartFrame.java— state snapshot with combo box handlingPreferencesEditor.java— generic field tracking withtrackField()FATSEditor.java— overridecaptureState()for custom fieldsPIDEditor.java— register 9 custom fieldsTesting
make compile— builds successfullymake test— all 12 tests passCloses #121