-
-
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 Part of the Issue#3861: Library-> New Entry Dialog to Javafx #4266
Conversation
Thanks for your work. It would be better if you move your changes to a branch to avoid conflicts with the master branch and then create a PR based on this. Here is an explanation how to do this best: |
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 overall, but I've a few suggestions for improvement.
@@ -798,10 +798,13 @@ public BibEntry newEntry(EntryType type) { | |||
EntryType actualType = type; | |||
if (actualType == null) { | |||
// Find out what type is wanted. | |||
final EntryTypeDialog etd = new EntryTypeDialog(frame); | |||
//final EntryTypeDialog etd = new EntryTypeDialog(frame); |
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 clean-up the code and remove all the uncommented old code.
|
||
<BorderPane> | ||
<bottom> | ||
<Button fx:id="cancelButton" text="Cancel" BorderPane.alignment="CENTER" /> |
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.
Buttons in JavaFX dialogs should be added as ButtonTypes and not as normal buttons (because otherwise you cannot close the dialog using the x button). Have a look at the other FXML-files on how to do this.
<center> | ||
<GridPane alignment="CENTER" BorderPane.alignment="CENTER"> | ||
<children> | ||
<Label text="ID type" /> |
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.
Every text that is localized needs to be prepanded by %
, e.g. here text="%ID type"
vBox.getChildren().remove(bibTexPane); | ||
vBox.getChildren().remove(ieeetranPane); | ||
List<EntryType> customTypes = EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBLATEX); | ||
if (EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBLATEX).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.
reuse declared variable: if(customTypes.isEmpty())
...
vBox.getChildren().remove(biblatexPane); | ||
|
||
List<EntryType> customTypes = EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBTEX); | ||
if (EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBTEX).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.
here too
} | ||
|
||
private GridPane createPane(Collection<? extends EntryType> entries) { | ||
GridPane gridpane = new GridPane(); |
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.
It is probably better to use a FlowPane which automatically takes care of organizing its children in columns and rows depending on the preferred width.
int col = 0; | ||
for (EntryType entryType : entries) { | ||
TypeButton entryButton = new TypeButton(entryType.getName(), entryType); | ||
entryButton.setOnAction(event -> cancelHandle(event)); |
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.
I think, the usage of a custom button class is a bit too complicated. An action like the following should work:
entryButton.setOnAction(event -> {
type.set(entryType);
close();
});
and change type
to ObjectProperty
.
It would be really nice if you could finish your PR and fix the remaining parts. If you need any help, just ask. |
Superseeded by #4312 |
Hello, we convert part of the Issue #3861 , Library-> New Entry Dialog, to Javafx. We add 2 files, fxml file for the layout of the dialog, and EntryTypeView.java for the controller of the dialog. We also delete the old file (EntryTypeDialog.java) and changed the related files to fit the new dialog. There is no big change in the logic parts.
Here is our screenshot of the dialog.