Closed mrdandelion6 closed 9 months ago
Solved the Issue!
propertyChange(evt)
is fired in EditNoteView
, we reset the button text to the new noteTitle
stored in EditNoteState
:public void propertyChange(PropertyChangeEvent evt) {
// Handle property changes if needed
System.out.println("*pChange EditView"); // for debugging, delete later
noteTitleButton.setText(editViewModel.getState().getNoteTitle());
}
This fix ensures that the button text reflects the most recent note title changes. We no longer recreate the whole button in propertyChange(PropertyChangeEvent evt)
, but rather just call setText
on the button and set the current chosen title.
Reopened issue to show as an issue temporarily (it is already resolved).
Problem:
I have created a use case for naming/renaming notes while on the EditNoteView screen. You can find my attempt at implementing this feature in pull request #5. Everything is being called all the way up to
propertyChange(evt)
inEditNoteView
, you can test this withSystem.out.println()
. However, whenpropertyChange(evt)
is called, nothing happens. The button does not get recreated as expected. In fact it becomes unclickable.Suggestion:
I believe the issue is because propertyChange(evt) currently creates a new JButton each time it is called, so perhaps the buttons are overlapping. We must figure out a way for it to reset the text of the current button, or delete the current button and create a new one with the updated text. The text is already there for us to use in the propertyChange(evt) method, given to us by the following code:
EditNoteState editState = this.editViewModel.getState();
String noteTitle = editState.getNoteTitle();
All that is left to do is update the button properly.