Skip to content
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

Linked files pattern logic and UI #1 #2 #4

Merged
merged 9 commits into from
Oct 26, 2024

Conversation

Naaeeen
Copy link
Owner

@Naaeeen Naaeeen commented Oct 26, 2024

This pull request addresses two related issues:

  1. Improve UI for Linked Files Pattern Configuration (Improve UI for Linked Files Pattern Configuration #1)
  2. Develop Logic to Generate Filenames Based on Patterns for Linked Files (Develop Logic to Generate Filenames Based on Patterns for Linked Files #2)

image

Major Changes Made:

  • UI Enhancements:

    • Created FilenamePatternPanel to manage patterns in a tabular format.
    • Added pattern configuration to the "Linked Files" preferences with intuitive table columns.
    • Users can now quickly switch between filename patterns for specific file types (e.g., {year}_{title}_{author}).
  • Backend Logic:

    • Change methods in FileUtil to generate filenames dynamically based on the patterns defined in the UI.
    • Created GlobalFilenamePattern and AbstractFilenameFormatPatterns , etc. classes to support flexible pattern definitions and retrieval.
    • Updated FilePreferences to store and manage filename patterns persistently.
  • Some change in test:

    • changed Fileutil unit tests.

Issue Links:

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

This commit lays the groundwork for a tabular UI to configure filename
patterns for linked files. The core logic is implemented, mirroring the
structure used for Citation Key Patterns. UI implementation and integration
with LinkedFilesTab will be addressed in later commits.
…on UI

This commit replace the old ui with tabular UI to configure filename
patterns for linked files. The core logic is implemented, mirroring the
structure used for Citation Key Patterns. UI implementation and integration
with LinkedFilesTab will be addressed in later commits.
This commit improves the UI and makes it functional. However, core logic still needs to be implemented.

IMPORTANT TODO:
1. Update CleanupPresetPanel.java in gui/cleanup:
   - Temporarily added .toString() to filePreferences.getFileNamePattern()
   - Need to modify this as the new GlobalFilenamePattern object stores patterns
     for different file types, not just a single pattern

2. Refactor getSuggestedFileName in logic/externalfiles/LinkedFileHandler.java:
   - Current implementation expects a single file name pattern
   - Need to update to work with the new GlobalFilenamePattern object

Note: These changes may affect other parts of the application that rely on
the previous file name pattern implementation. Further testing and updates
may be required.
This commit improves the UI and makes it functional. However, core logic still needs to be implemented.

IMPORTANT TODO:
1. Update CleanupPresetPanel.java in gui/cleanup:
   - Temporarily added .toString() to filePreferences.getFileNamePattern()
   - Need to modify this as the new GlobalFilenamePattern object stores patterns
     for different file types, not just a single pattern

2. Refactor getSuggestedFileName in logic/externalfiles/LinkedFileHandler.java:
   - Current implementation expects a single file name pattern
   - Need to update to work with the new GlobalFilenamePattern object

Note: These changes may affect other parts of the application that rely on
the previous file name pattern implementation. Further testing and updates
may be required.
Major change:
- Refactored `createFileNameFromPattern` in `FileUtil` to generate filenames dynamically based on the `EntryType`.
- Add store and load for FilePreferences
**Note:** Related test cases currently encounter compile errors and require fixes.
@Naaeeen Naaeeen added the enhancement New feature or request label Oct 26, 2024
Copy link
Collaborator

@BruceLiang1234 BruceLiang1234 left a comment

Choose a reason for hiding this comment

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

Do you want to delete the DatabaseFilenamePattern since it is not used and the FilenameGenerator since it is empty? Also one little things like pass the checkstyle test.
Otherwise, it looks good to me. Let me know if you want to change it, or I'm happy to approve and merge.

@Naaeeen
Copy link
Owner Author

Naaeeen commented Oct 26, 2024

Do you want to delete the DatabaseFilenamePattern since it is not used and the FilenameGenerator since it is empty? Also one little things like pass the checkstyle test. Otherwise, it looks good to me. Let me know if you want to change it, or I'm happy to approve and merge.

Thanks, I've made the changes. I initially planned to submit a draft PR to confirm if we're heading in the right direction, so the checkstyle issue isn't a big concern for now anyway.

Copy link
Collaborator

@BruceLiang1234 BruceLiang1234 left a comment

Choose a reason for hiding this comment

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

Thank you. Happy to approve

@Naaeeen Naaeeen merged commit 8e0b7d8 into main Oct 26, 2024
15 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants