Skip to content

Conversation

@K1-mbf
Copy link
Contributor

@K1-mbf K1-mbf commented Nov 30, 2025

Closes #14087

This issue consisted of adding a drop-down menu to the custom fields of the main table for changing the attributes. Something similar already existed for the view field.

Steps to test

I followed the same steps as described in the issue:

  1. Create a new library demo.bib
  2. Add a new entry
  3. In BibTeX source, add icore = {abc}
@Article{demo,
icore = {abc}
}
  1. Open Library properties
  2. Add Content selectors for ICORE
Screenshot 2025-11-30 160559
  1. Go to File > Preferences > Entry table
  2. Add the custom column ICORE
Screenshot 2025-11-30 160633
  1. Save and restart JabRef

  2. Now, when you click on the field, you can change its value

Screenshot 2025-11-30 160654
  1. You can click on any keyword you want, and it will update the value
Screenshot 2025-11-30 160706

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if the change is visible to the user)
  • I described the change in CHANGELOG.md in a way that is understandable for the average user (if the change is visible to the user)
  • I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or submitted a pull request updating the relevant files in https://github.com/JabRef/user-documentation/tree/main/en.

@github-actions
Copy link
Contributor

Hey @K1-mbf!

Thank you for contributing to JabRef! Your help is truly appreciated ❤️

We have automated checks in place, based on which you will soon get feedback if any of them are failing. In a while, maintainers will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs.

Please re-check our contribution guide in case of any other doubts related to our contribution workflow.

@github-actions github-actions bot added first contrib status: changes-required Pull requests that are not yet complete labels Nov 30, 2025
@koppor koppor mentioned this pull request Nov 30, 2025
1 task
@calixtus calixtus changed the title Fix for issue 14087 DropDown menu in MainTable rows Nov 30, 2025
@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Nov 30, 2025
Comment on lines +127 to +130
List<String> values = database.getMetaData().getContentSelectorValuesForField(field);

if (values != null && !values.isEmpty()) {
returnColumn = createContentSelectorColumn(column, values);
Copy link
Member

Choose a reason for hiding this comment

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

could maybe a helper method for clean code: isContentSelectorField or sthg.

Copy link
Contributor Author

@K1-mbf K1-mbf Dec 2, 2025

Choose a reason for hiding this comment

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

Hello @calixtus,
the only way I can figure out a solution is by doing:

private List<String> getValueFromField(Field field){
        return database.getMetaData().getContentSelectorValuesForField(field);
    }
if (!column.getQualifier().isBlank()) {
                    Field field = FieldFactory.parseField(column.getQualifier());
                    List<String> values = getValueFromField(field);

                    if (values != null && !values.isEmpty()) {

but this solution is not the same helper method.

or :

private boolean isContentSelectorField(List<String> values){
        return values != null && !values.isEmpty();
    }
if (!column.getQualifier().isBlank()) {
    Field field = FieldFactory.parseField(column.getQualifier());
    List<String> values = database.getMetaData().getContentSelectorValuesForField(field);

    if (isContentSelectorField(values)) {

or :

private boolean isContentSelectorField(Field field){
        List<String> values = database.getMetaData().getContentSelectorValuesForField(field);
        return values != null && !values.isEmpty();
    }
if (!column.getQualifier().isBlank()) {
                    Field field = FieldFactory.parseField(column.getQualifier());
                    
                    if (isContentSelectorField(field)) {
                        List<String> values = database.getMetaData().getContentSelectorValuesForField(field);
                        returnColumn = createContentSelectorColumn(column, values);

but this solution means that we calculate the values twice.

Can you tell me what you meant by your request, because I can't figure out anything without drawbacks

Copy link
Member

@calixtus calixtus Dec 2, 2025

Choose a reason for hiding this comment

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

oh no, this was a bit misunderstandable. I just meant to extract the predicate in the if clause (values != null && !values.isEmpty()) to a method called isContentSelectorField.

Copy link
Member

Choose a reason for hiding this comment

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

but maybe we just let it go to avoid recalculation.

Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

small nitpicks

@github-actions github-actions bot added the status: changes-required Pull requests that are not yet complete label Nov 30, 2025
@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Nov 30, 2025
@koppor koppor added the status: changes-required Pull requests that are not yet complete label Dec 1, 2025
@koppor
Copy link
Member

koppor commented Dec 1, 2025

@K1-mbf Please address the review comments.

Minor changes  on the issue JabRef#14087

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Dec 2, 2025
@calixtus calixtus added this pull request to the merge queue Dec 2, 2025
@calixtus
Copy link
Member

calixtus commented Dec 2, 2025

I put it into the merge queue. Thanks for your contribution. We would love to see more 😍

Merged via the queue into JabRef:main with commit f1cf3fa Dec 2, 2025
51 checks passed
@koppor koppor mentioned this pull request Dec 2, 2025
1 task
shubhamk0205 pushed a commit to shubhamk0205/jabref that referenced this pull request Dec 3, 2025
* Added combo box in main table for content selectors

* Update CHANGELOG with new features

Added a drop-down menu for custom fields in the main table.

* Update CHANGELOG with issue reference for drop-down menu

Added a reference to issue JabRef#14087 for the drop-down menu feature.

* Update CHANGELOG for style

* Update CHANGELOG.md

Minor changes  on the issue JabRef#14087

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>

* add new line for arguments

---------

Co-authored-by: Mélina Wang <dgtrhb@gmail.com>
Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support combo box in main table (for content selectors)

4 participants