Skip to content

Fix Create & Update button#4

Open
moketa99 wants to merge 1 commit into
MillsMCS:completefrom
moketa99:fixbutton
Open

Fix Create & Update button#4
moketa99 wants to merge 1 commit into
MillsMCS:completefrom
moketa99:fixbutton

Conversation

@moketa99
Copy link
Copy Markdown

Configure a JavaFX button.

Copy link
Copy Markdown
Contributor

@ellenspertus ellenspertus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this comment.

Comment thread src/main/java/edu/mills/cs180a/wordui/FXMLController.java Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better name might be doesWordExist or wordExists.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your comment. I will fix it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain to me why both of these variables are needed?

Copy link
Copy Markdown
Author

@moketa99 moketa99 Dec 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a word is updated to a word that is already in the list, then the same word is in the list twice.
The program controls that the same word is not displayed in the list.

It also controls that the update button is disabled if a user tries to update a word and stop it in the middle, then come back to the original word.

For example,
If a user changes "buffalo" to "buffalo bills", the update button is enabled. But if the user changes "buffalo bills" to "buffalo", the program has to disable the update button. However, if the user changes the definition, the program has to enable the update button.

I use them to control like that.

"Complete the TODO in FXMLController.configureButtons(). "
Since I read the above instructions, I understood that all buttons on the display would be modified to control them correctly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did more work than requested. It read:

// TODO: Disable the Create button if an existing entry is selected or any
// field is empty or invalid.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reading of the code suggests that the two variables always have exactly the same value. Could you please show me any lines where one is set to a different value than the other?

Copy link
Copy Markdown
Author

@moketa99 moketa99 Dec 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they are not always the same and update and create buttons need different input checks for an existing entry.
The update does a unique check without itself.
The create always does a unique check.

I understand "if an existing entry is selected" means
When the user selects an existing entry, disable the Create button.
When the user updates a word, enable the Create button.
When the user updates a word to an existing entry (the same situation as an existing entry is selected), disable the Create button
Do I misunderstand instruction?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain to me why you need two different methods?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a word is updated to a word that is already in the list, then the same word is in the list twice.
So I created a new method.

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.

2 participants