-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
factor out subcomponents of WaveInterferenceControlPanel #283
Comments
Signed-off-by: Chris Malley <[email protected]>
Signed-off-by: Chris Malley <[email protected]>
Signed-off-by: Chris Malley <[email protected]>
There's a similar (and related) chunk of code in (4) Factor out new class |
Signed-off-by: Chris Malley <[email protected]>
Note that decisions made in #262 may introduce the need for additional refactoring. But the goal is encapsulate subcomponents that have significant code in their own class files. |
Another thought... Responsibility for "nestling the title text into the slider" might be best to handle in |
Because FrequencySlider is used in lieu of WaveInterferenceSlider for the light scene, the title "nesting" should be implemented in a place it can be used by both the FrequencySlider and other WaveInterferenceSlider instances. In the preceding commits, I moved the titles to FrequencyControl and AmplitudeControl, and factored out the spacing logic in WaveInterferenceUtils.getSliderTitleSpacing. I also factored out FrequencyControl, AmplitudeControl, SoundViewTypeRadioButton and SeparationControl as prescribed. Ready for review. |
👍 Looks great, much easier to digest. Closing. |
Related to code review #259.
This was promoted to an issue after beginning its life as these REVIEW comments:
The main problem here is that there are big chunks of "responsibility" that could be encapsulated, but are instead sprinkled throughout the
WaveInterferenceControlPanel
constructor. A few suggestions to make this panel more readable/maintainable:(1) Factor out new class
FrequencyControl
with these responsibilities: creates the 3 frequency sliders (waterFrequencySlider, soundFrequencySlider, lightFrequencySlider) and their container; createsfrequencyInHzProperty
; creates and positions the "Frequency" title; toggles visibility of the sliders based onmodel.sceneProperty
.waterFrequencySlider
,soundFrequencySlider
,lightFrequencySlider
,frequencyInHzProperty
,frequencySliderContainer
andfrequencyTitle
can all be removed fromWaveInterferenceControlPanel
, and replaced with:(2) Factor out new class
AmplitudeControl
with these responsibilities: creates the amplitude slider and its container; creates and positions the 'Amplitude' title.amplitudeSliderContainer
andamplitudeTitle
can be removed fromWaveInterferenceControlPanel
, and replaced with:(3) Factor out new class
SoundViewTypeRadioButtonGroup
that creates theVerticalAquaRadioButtonGroup
for selecting theSoundViewType
.const sceneRadioButtonGroup = new RadioButtonGroup(...)
becomesconst sceneRadioButtonGroup = new SoundViewTypeRadioButtonGroup(...)
.The text was updated successfully, but these errors were encountered: