Skip to content

Conversation

@InAnYan
Copy link
Member

@InAnYan InAnYan commented Nov 2, 2025

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.

image

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

@InAnYan
Copy link
Member Author

InAnYan commented Nov 2, 2025

IDK if a changelog entry is needed

@InAnYan
Copy link
Member Author

InAnYan commented Nov 2, 2025

Ah, sorry, I forgot about JabRef_en

@InAnYan InAnYan marked this pull request as draft November 2, 2025 18:19
}

private void initializeValidationBindings() {
titleValidationMessage.bind(Bindings.when(title.isEmpty())
Copy link
Member

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

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

Copy link
Member Author

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

Copy link
Member Author

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

@InAnYan InAnYan marked this pull request as ready for review November 7, 2025 15:09
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Although I agree that Validators are more consistent in the UI, I really like the summary at the end of the SLR to show the user the concrete things going wrong.

In some web framework, this would be easier to achieve.

I am voting for merging this and then do some refactoring later.

@koppor koppor enabled auto-merge November 20, 2025 10:58
@koppor koppor added this pull request to the merge queue Nov 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 20, 2025
@InAnYan
Copy link
Member Author

InAnYan commented Nov 20, 2025

Oops

@Siedlerchr Siedlerchr added this pull request to the merge queue Nov 20, 2025
@Siedlerchr
Copy link
Member

just jbang again

@Siedlerchr Siedlerchr removed this pull request from the merge queue due to a manual request Nov 20, 2025
@Siedlerchr Siedlerchr merged commit 2abe5aa into JabRef:main Nov 20, 2025
49 checks passed
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.

3 participants