Convert Part of the Issue#3861: Library-> New Entry Dialog to Javafx#4266
Convert Part of the Issue#3861: Library-> New Entry Dialog to Javafx#4266dongyc98 wants to merge 4 commits into
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: |
tobiasdiez
left a comment
There was a problem hiding this comment.
Thanks for your contribution. The code looks good overall, but I've a few suggestions for improvement.
| 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.
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.
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.
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.
reuse declared variable: if(customTypes.isEmpty())...
| vBox.getChildren().remove(biblatexPane); | ||
|
|
||
| List<EntryType> customTypes = EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBTEX); | ||
| if (EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBTEX).isEmpty()) { |
| } | ||
|
|
||
| private GridPane createPane(Collection<? extends EntryType> entries) { | ||
| GridPane gridpane = new GridPane(); |
There was a problem hiding this comment.
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.
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.