[ ] Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait
for the "CI / Unit Tests") to complete first. Failed Unit tests can be
debugged by adding the label "verbose logging" to the GitHub PR.
Description of the Change
Word Cloud threw an exception if the Generate button was clicked when there was no graph open. Rather than simply alerting the user that a graph needs to be open when the button is clicked, I've instead opted for something similar to Layers View in which with no graph open, the view instead simply displays a message saying that a graph needs to be open in order to use the view.
To do this, I've abstracted the NoGraphPane from the Layers View into the View Framework which enables us to add the same thing for the Word Cloud View. It also enables other views to take advantage, should we decide to include it for other views down the line.
Alternate Designs
I could've simply added a null check where the exception occurred (since it was the graph that was null), but given the view has no use without a graph, I felt it made more sense to prevent use of the view altogether in that case.
I could've added the check, even with the changes I've made, but in theory the trouble code shouldn't ever be able to be executed without a graph now and so adding that check feels redundant.
Why Should This Be In Core?
Fixes a bug in Core
Benefits
View can only be used properly when a graph is open, prevents use when no graph is open. Abstraction enables potential use of NoGraphPane for other views
Possible Drawbacks
Verification Process
Open Word Cloud View without a graph open
Open a graph and verify the word cloud view can now be used
Close the graph and verify it goes back to displaying the message.
Can also run checks with Word Cloud View in focus/not in focus, close and open view, multiple graphs, etc.
Do a similar thing with Layers View to verify it still runs as expected
Prerequisites
[ ] Reviewed the checklist
[ ] Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait for the "CI / Unit Tests") to complete first. Failed Unit tests can be debugged by adding the label "verbose logging" to the GitHub PR.
Description of the Change
Word Cloud threw an exception if the Generate button was clicked when there was no graph open. Rather than simply alerting the user that a graph needs to be open when the button is clicked, I've instead opted for something similar to Layers View in which with no graph open, the view instead simply displays a message saying that a graph needs to be open in order to use the view.
To do this, I've abstracted the
NoGraphPane
from the Layers View into the View Framework which enables us to add the same thing for the Word Cloud View. It also enables other views to take advantage, should we decide to include it for other views down the line.Alternate Designs
I could've simply added a null check where the exception occurred (since it was the graph that was null), but given the view has no use without a graph, I felt it made more sense to prevent use of the view altogether in that case.
I could've added the check, even with the changes I've made, but in theory the trouble code shouldn't ever be able to be executed without a graph now and so adding that check feels redundant.
Why Should This Be In Core?
Fixes a bug in Core
Benefits
View can only be used properly when a graph is open, prevents use when no graph is open. Abstraction enables potential use of NoGraphPane for other views
Possible Drawbacks
Verification Process
Applicable Issues
2130