-
-
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
Completed General Fields Customizer conversion to JavaFX #4346
Conversation
I looked into this and I think the main problem was that you missed the fx:ids for the button and the textarea. The fx:id must correspond to the variable in the View. To spot such errors, it helps if you set a breakpoint in the initialize method of the View and then debug through it step by step. Then I discovered that the textarea variable was null -> so conclusion was missing id in the fxml I fixed this and exported it as git patch. Remove the .txt extension and you can import it with |
I finished changing the Set Up General Fields Dialogs to JavaFX. The automatic build failures were unrelated to the changed code, and think I fixed all the true problems that Codacy mentioned. The functions getCustomTabsNamesAndFields() and getCustomTabFieldNames() in the class JabRefPreferences, are very similar and it might be worth writing one as a function of the other to reduce boilerplate. I thought they were different enough (especially with respect to the return types) to keep them separate. |
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.
Thank you very much for your contribution! 👍
Overall looks good, just some minor improvements to fix and it's good!
<VBox prefHeight="300.0" prefWidth="650.0"> | ||
<children> | ||
<Label text="General Fields" /> | ||
<Label text="Create custom fields for each BibTeX entry" /> |
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.
To ensure that the labels are correctly translated in other languages it is necessary to add the percent sign in front of the text., e. G. %create custom...
This will probably also resolve the Travis failure due to localisation
src/main/java/org/jabref/gui/genfields/GenFieldsCustomizerDialogView.java
Outdated
Show resolved
Hide resolved
String name = (String) defaults.get(CUSTOM_TAB_NAME + "_def" + defNumber); | ||
String fields = (String) defaults.get(CUSTOM_TAB_FIELDS + "_def" + defNumber); | ||
|
||
if ((name == null) || (fields == null) || name.isEmpty() || fields.isEmpty()) { |
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.
You can use StringUtil.IsNullOrEmpty
(from org.jabref.model.strings.StringUtil)
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 contribution. The code looks good to me, except one or two very minor things. Please also have a look at the travis build, which currently fails.
src/main/java/org/jabref/gui/genfields/GenFieldsCustomizerDialogView.java
Outdated
Show resolved
Hide resolved
@Inject private PreferencesService preferences; | ||
private GenFieldsCustomizerDialogViewModel viewModel; | ||
|
||
public GenFieldsCustomizerDialogView() { |
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 you please rename all classes related to the dialog to something like CustomizeGeneralFieldsDialog
sb.append(':'); | ||
sb.append(entry.getValue()); | ||
sb.append('\n'); | ||
fieldsText.set(sb.toString()); |
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.
The fieldsText.set
should probably come after the for loop.
Thanks for the feedback! I've made the changes. I believe Codacy fails because it does not recognize that ViewLoader takes care of the FXML in the controller, so I don't need to explicitly use all the variables that I create in the controller. The build now passes, but it does say some dependency updates are needed. |
@FXML private ButtonType resetButton; | ||
@FXML private ButtonType helpButton; | ||
@FXML private ButtonType okButton; | ||
@FXML private ButtonType cancelButton; |
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.
If you don't use the cancel button further in your code, you can remove it here and in the fxml remove the fx:id
from it.
@@ -927,7 +927,7 @@ private MenuBar createMenu() { | |||
|
|||
new SeparatorMenuItem(), | |||
|
|||
factory.createMenuItem(StandardActions.SETUP_GENERAL_FIELDS, new SetupGeneralFieldsAction(this)), | |||
factory.createMenuItem(StandardActions.SETUP_GENERAL_FIELDS, new SetupGeneralFieldsAction()), |
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.
Please align/indent it with the other ones below
Thank you very much! It looks good to me now. Just one formatting issue and that you don't need the variable in the controller for cancelButton. Ignore the dependency updates, the dependency check is run with every build and is just a hint that there might be some dependencies which could be updated. It fails if newer versions are found. But some of them are incompatible so ignore them |
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 again!
My pleasure. |
Hi, I have another question. In terms of broad categories of fixes, what are the highest priorities right now for working on JabRef, apart from the conversion to JavaFX? I'm glad to convert more dialogs, but I also want to be involved with the logic and model. Let me know. Thanks! |
You can have a look at https://github.com/JabRef/jabref/projects/5 for high-priority bugs that need to be fixed. But I fear that most of them are purely UI-related. |
Good to know. I'll keep you posted when I take up another dialog or issue from the issue page. Thanks for being so friendly! |
We have to thank you for your interest in making JabRef great again 😏 |
* upstream/master: Update Libraries (#4366) ArXiv fetcher support http url (#4367) Fix issue 3861 : XMP Dialog, Add new Groups dialog, Append Library dialog to javafx (#4264) fix IndexOutOfBoundsException when saving preferences group RadioButtons in ExportSortingPrefsTab to prevent the selection of multiple or no order types Convert Part of the Issue#3861 Quality->Cleanup entries (#4268) UPDATE gradle to 4.10.2 (#4358) Completed General Fields Customizer conversion to JavaFX (#4346) Fix JavaFX thread exception when fetching new infos (#4354) Auto trim url field (#4355) Fix freezes in entry editor (#4351) # Conflicts: # src/main/java/org/jabref/preferences/PreferencesService.java
This is what I have so far. The problem is that most, but not all of the time, when I run the "Set up general fields" dialog, there is a problem with ViewLoader and the program throws an error. Perhaps it is because I left the view model unfinished?