-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Automatic field editor: Add Clear content tab + viewmodel #13824
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
Automatic field editor: Add Clear content tab + viewmodel #13824
Conversation
Field chosen = fieldCombo.getValue(); // keep ComboBox<Field> | ||
if (chosen != null) { | ||
viewModel.clearField(chosen); // VM builds/publishes the undo compound | ||
System.out.println("Cleared field: " + chosen.getName()); |
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.
No System.out and remove the comments
|
||
List<BibEntry> selected = stateManager.getSelectedEntries(); | ||
for (BibEntry entry : selected) { | ||
// clearField returns Optional<FieldChange> |
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.
remove comments
List<BibEntry> selected = stateManager.getSelectedEntries(); | ||
Set<Field> setFields = new LinkedHashSet<>(); | ||
|
||
for (BibEntry entry : selected) { |
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.
can be refactored into a stream
private final ClearContentViewModel viewModel; | ||
|
||
public ClearContentTabView(StateManager stateManager) { | ||
super(); |
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.
Is there a reasony why you did not creae an fxml? I guess you used AI..
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.
Yes, I initially used AI to generate the layout in Java so I could focus on getting the logic working first but forgot to move it into a proper FXML file. I've made the changes now.
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, misunderstood PR. Nevermind. |
...rc/main/java/org/jabref/gui/edit/automaticfiededitor/clearcontent/ClearContentViewModel.java
Show resolved
Hide resolved
import org.jabref.model.entry.field.FieldFactory; | ||
|
||
public class ClearContentViewModel { | ||
public static final int TAB_INDEX = 2; |
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.
TAB_INDEX constant is horrible, but is actually consistent with the current design of the dialog. Neccessary for the fancy infotext about affected files after applying the change. Should be refactored in the future, but for now, it can just stay.
You did not assign yourself to the issue. Thus, it looks like you skipped reading our CONTRIBUTING.md, which explains exactly how to participate. No worries, it happens to the best of us. Give it a read, and you’ll discover the ancient wisdom of assigning issues to yourself. Trust me, it’s worth it. 🚀 |
Closes #13780
This PR introduces a dedicated "Clear content" tab in the Automatic Field Editor:
Steps to test
author
,journal
).author
) and click Clear field content: the field value should be removed from all selected entries.Mandatory checks
CHANGELOG.md
in a way that is understandable for the average user (if change is visible to the user)