-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
DropDown menu in MainTable rows #14475
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
Conversation
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. |
Added a drop-down menu for custom fields in the main table.
Added a reference to issue JabRef#14087 for the drop-down menu feature.
| List<String> values = database.getMetaData().getContentSelectorValuesForField(field); | ||
|
|
||
| if (values != null && !values.isEmpty()) { | ||
| returnColumn = createContentSelectorColumn(column, values); |
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.
could maybe a helper method for clean code: isContentSelectorField or sthg.
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.
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
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.
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.
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.
but maybe we just let it go to avoid recalculation.
jabgui/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java
Show resolved
Hide resolved
calixtus
left a comment
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.
small nitpicks
|
@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>
|
I put it into the merge queue. Thanks for your contribution. We would love to see more 😍 |
* 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>
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:
demo.bibicore = {abc}ICOREICORESave and restart JabRef
Now, when you click on the field, you can change its value
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if the change is visible to the user)