Skip to content

Convert Part of the Issue#3861: Library-> New Entry Dialog to Javafx#4266

Closed
dongyc98 wants to merge 4 commits into
JabRef:masterfrom
dongyc98:master
Closed

Convert Part of the Issue#3861: Library-> New Entry Dialog to Javafx#4266
dongyc98 wants to merge 4 commits into
JabRef:masterfrom
dongyc98:master

Conversation

@dongyc98

@dongyc98 dongyc98 commented Aug 15, 2018

Copy link
Copy Markdown

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.

image


  • Change in CHANGELOG.md described
  • Tests created for changes
  • Manually tested changed features in running JabRef
  • Screenshots added in PR description (for bigger UI changes)
  • Ensured that the git commit message is a good one
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)

@Siedlerchr

Siedlerchr commented Aug 15, 2018

Copy link
Copy Markdown
Member

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:
https://stackoverflow.com/a/1628584

@tobiasdiez tobiasdiez left a comment

Copy link
Copy Markdown
Member

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.

if (actualType == null) {
// Find out what type is wanted.
final EntryTypeDialog etd = new EntryTypeDialog(frame);
//final EntryTypeDialog etd = new EntryTypeDialog(frame);

Copy link
Copy Markdown
Member

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" />

Copy link
Copy Markdown
Member

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" />

Copy link
Copy Markdown
Member

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()) {

Copy link
Copy Markdown
Member

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()) {

Copy link
Copy Markdown
Member

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();

Copy link
Copy Markdown
Member

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));

Copy link
Copy Markdown
Member

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.

@Siedlerchr

Copy link
Copy Markdown
Member

It would be really nice if you could finish your PR and fix the remaining parts. If you need any help, just ask.

@Siedlerchr

Copy link
Copy Markdown
Member

Superseeded by #4312

@Siedlerchr Siedlerchr closed this Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants