-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Convert Strings Dialog to javafx #3735
Conversation
TODO: store strings back to db
Nice that you want the dialog to JavaFX. However, I don't understand what questions you now have. |
@tobiasdiez I was wondering why the BibtexString is stored in a Map<String, BibTexString in the databse. jabref/src/main/java/org/jabref/model/database/BibDatabase.java Lines 278 to 288 in cf8e6aa
|
This is probably for performance reasons (hashmap provides a quicker lookup than to transverse the list). |
TODO: validation
I now tried around and got the Validation running somehow, but it doesn't really work |
t.getTableView() | ||
.getItems() | ||
.get( | ||
t.getTablePosition().getRow()) |
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.
t.getRowValue
is easier (and please rename t
to something more descriptive.
I strongly recommend to use the |
Okay, yes, that seems pretty streightfoward, except that I have now the problem: |
Two view models are what you need here. One for the whole dialog (contains a list of all strings, the composite validation status, methods for load/save) and one for each string (determines how the string should be displayed and its validation status). The validation of the per-string view model should be bound to the text field similar to how you did it before. |
Okay, I managed to get it work and the validation is triggered correctly, but I have no idea why no icon is shown. I used JabRef's own IconDecorator class. Any idea why it's not showing? You have to click new -> Its triggered for the first ime |
@tobiasdiez Do you have an idea why the Validation error/warning icon is not showing? the validation is triggered, but it doesn't display anything |
src/main/java/org/jabref/gui/strings/StringDialogController.java
Outdated
Show resolved
Hide resolved
…gsjavafx * upstream/maintable-beta: (188 commits) Fix checkstyle Exchange Ignore by Disabled (#3912) Remove all @author comments and empty method/class comments Clean unused imports Fix missing icons and wrong package for custom icons Consistent FX color scheme for JabRef (#3839) javafx replacement for file dialog (#3005) Reenable closing of entry preview by pressing Esc (#3883) Load all field editors using ViewLoader Use JabRef icons in FXML Move icon stuff to new package gui.icon Load EntryEditor using new ViewLoader Improve tooltip tests Fix import thread problem Don't use null as parameter in DialogService Make it easier to create FXML dialogs (#3880) update slf4j from 1.8.0-beta1 -> 1.8.0-beta2 New translations JabRef_en.properties (Tagalog) New translations JabRef_en.properties (Italian) New translations Menu_en.properties (Italian) ... # Conflicts: # src/main/java/org/jabref/gui/JabRefFrame.java
As the validation still does not show up I created an issue: |
…gsjavafx * upstream/maintable-beta: fix checkstyle fix closing preferences on save Remove unused code in cleanup No need to set swing content on swing thread
validation icon is now correctly shown, although it needs some css mods fix toolbar max width
* upstream/master: Fix NPE and not on FX Thread in PreviewPrefs Tabs (#4624) Fix preview style configuration (#4613) Bump wiremock from 2.20.0 to 2.21.0 (#4623) snap: disable tests build, add removable media and specify architectures (#4619) Bump checkstyle from 8.16 to 8.17 (#4620) Fix preferences path: use _JAVA_OPTIONS Try to fix not on FX thread for search and autocomplete (#4618) Update snapcraft.yaml Move to snap folder Convert DuplicateResolverDialog to javafx (#4601) Fix for BibTex source tab parsing issue if field contains {} (#4581) Convert OO/LO SidePanel to javafx (#4341) Convert "Customize importer" dialog to JavaFX (#4608) Convert "From Aux file" dialog to JavaFX (#4607) Convert "Show preferences" dialog to JavaFX (#4605) Fix not on FX thread exception Force javafx to run thread (#4604) Convert new version dialog to JavaFX (#4602) Add a variable to track the change in preview style (#4587) Solution for submitting dialog with Ctrl + Enter (#4496) (#4592) Bump mysql-connector-java from 8.0.13 to 8.0.14 (#4599) # Conflicts: # src/main/resources/l10n/JabRef_en.properties
TODO: fix validation
optimize layout a bit fix l10n
I finally solved the validation @tobiasdiez , so this dialog is now ready for review |
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.
Thanks for your work on this dialog. Sadly, the quality of this PR is not as high as I'm used from you. Probably because it lied dead for so long and you grew as a programmer in the meantime and I'm now used to your better PRs ;-). Anyway, I've quite a few remarks and suggestions for improvement.
* upstream/master: (21 commits) Bump applicationinsights-core from 2.3.0 to 2.3.1 (#4656) Bump applicationinsights-logging-log4j2 from 2.3.0 to 2.3.1 (#4657) Bump bcprov-jdk15on from 1.60 to 1.61 (#4653) Bump log4j-jcl from 2.11.1 to 2.11.2 (#4646) Bump log4j-api from 2.11.1 to 2.11.2 (#4650) Bump assertj-swing-junit from 3.8.0 to 3.9.2 (#4647) Bump log4j-jul from 2.11.1 to 2.11.2 (#4648) Bump log4j-slf4j18-impl from 2.11.1 to 2.11.2 (#4649) Bump log4j-core from 2.11.1 to 2.11.2 (#4651) Remove old code for PDF import (#4634) Reorder conditional checks Automatically created groups with Field to group by as entrytype (#4539) (#4555) Fix for issue 4641: Remove usage of TempDirectory extension from junit-pioneer (#4644) Edit localization file Add Integrity check for books with edition reported as 1 Use 'junit-jupiter' aggregator module (#4640) Bump junit-jupiter-params from 5.3.2 to 5.4.0 (#4638) Bump junit-vintage-engine from 5.3.2 to 5.4.0 (#4637) Bump junit-platform-launcher from 1.3.2 to 1.4.0 (#4636) Bump junit-jupiter-api from 5.3.2 to 5.4.0 (#4639) ... # Conflicts: # src/main/resources/l10n/JabRef_en.properties
fix l10n
Addressed all remaininig issues so far. Also extracted the column setup with validation to an extra Factory. |
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.
There are still some unresolved comments.
Can you please also explain why it is not possible to refactor the save
method to do something like:
- Convert list of String-ViewModel to list of BibtexStrings.
- Update all strings in the database with this new list.
Would make this method easier to understand and extract code that can be used somewhere else.
@tobiasdiez Moved the code to the bibdatabase for adding new strings from a collection |
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.
Thanks! Looks very good to me now.
…tofx * upstream/master: Convert Strings Dialog to javafx (#3735)
Convert Strings Dialog to javafx
I decided to take a shot at the String dialog. But I have some questions about the String handling in the Database class. I know that I can define some user defined strings as kind of template and then reuse them in my bib entries.
The only thing which does not look that good is the position of the Validation error icon.
Needs perhaps some CSS tweaking, but for the moment not important.