-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(slr): improve validation messages for starting SLR #14225
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
base: main
Are you sure you want to change the base?
Conversation
|
IDK if a changelog entry is needed |
|
Ah, sorry, I forgot about JabRef_en |
| } | ||
|
|
||
| private void initializeValidationBindings() { | ||
| titleValidationMessage.bind(Bindings.when(title.isEmpty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use our ValidationSatus approach with the controlsfx visualizer
jabref/jabgui/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java
Lines 138 to 174 in 3b62795
| private void setupValidation() { | |
| validator = new CompositeValidator(); | |
| nameValidator = new FunctionBasedValidator<>( | |
| nameProperty, | |
| StringUtil::isNotBlank, | |
| ValidationMessage.error(Localization.lang("Please enter a name for the group."))); | |
| nameContainsDelimiterValidator = new FunctionBasedValidator<>( | |
| nameProperty, | |
| name -> !name.contains(Character.toString(preferences.getBibEntryPreferences().getKeywordSeparator())), | |
| ValidationMessage.warning( | |
| Localization.lang( | |
| "The group name contains the keyword separator \"%0\" and thus probably does not work as expected.", | |
| Character.toString(preferences.getBibEntryPreferences().getKeywordSeparator()) | |
| ))); | |
| sameNameValidator = new FunctionBasedValidator<>( | |
| nameProperty, | |
| name -> { | |
| Optional<GroupTreeNode> rootGroup = currentDatabase.getMetaData().getGroups(); | |
| if (rootGroup.isPresent()) { | |
| boolean groupsExistWithSameName = !rootGroup.get().findChildrenSatisfying(group -> group.getName().equals(name)).isEmpty(); | |
| if ((editedGroup == null) && groupsExistWithSameName) { | |
| // New group but there is already one group with the same name | |
| return false; | |
| } | |
| // Edit group, changed name to something that is already present | |
| return (editedGroup == null) || editedGroup.getName().equals(name) || !groupsExistWithSameName; | |
| } | |
| return true; | |
| }, | |
| ValidationMessage.warning( | |
| Localization.lang("There already exists a group with the same name.\nIf you use it, it will inherit all entries from this other group.") | |
| ) | |
| ); |
PS: Next time tell your AI tool to follow existing patterns in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, you got me
But I thought those things only work for fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I don't really understand. It's a bit messy. I can't get a single validation message from ValidationStatus, it can return getHighestMessage, which returns an optional ValidationMessage, but then I have to make a map(m -> m.getMessage()), but to remove option, before that I have to orElse(new ValidationMessage("")).
While I would like to use Validators, I think this is easier.
Hmm, maybe it's possible to add validation messages to a button? And then if it's disabled, some validation didn't pass, it would have red border and a warning triangle...
But labels seem to be more compact
Closes https://github.com/JabRef/jabref-issue-melting-pot/issues/1091
Just a UI enhancement. Adds various labels that tell user what needs to be done to start SLR.
Steps to test
Go to the menu, start SLR, go to the tab finalize. Try to fulfill some of the requirements - some messages will be cleared.
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)