Skip to content
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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
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.

final EntryTypeView etv = new EntryTypeView(frame.getCurrentBasePanel());
// We want to center the dialog, to make it look nicer.
etd.setVisible(true);
actualType = etd.getChoice();
//etd.setVisible(true);
//actualType = etd.getChoice();
etv.showAndWait();
actualType = etv.getChoice();
}
if (actualType != null) { // Only if the dialog was not canceled.
final BibEntry be = new BibEntry(actualType.getName());
Expand Down
70 changes: 70 additions & 0 deletions src/main/java/org/jabref/gui/EntryType.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<DialogPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.EntryTypeView">
<content>

<BorderPane>
<bottom>
<Button fx:id="cancelButton" text="Cancel" BorderPane.alignment="CENTER" />
Copy link
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.

</bottom>
<center>
<GridPane alignment="CENTER" BorderPane.alignment="CENTER">
<children>
<Label text="ID type" />
Copy link
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"

<ComboBox fx:id="comboBox" prefHeight="30.0" prefWidth="300.0" GridPane.columnIndex="1" />
<Label text="ID" GridPane.rowIndex="1" />
<TextField fx:id="idTextField" prefHeight="30.0" prefWidth="300.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Button fx:id="generateButton" alignment="CENTER" mnemonicParsing="false" prefHeight="30.0" prefWidth="110.0" text="Generate" textAlignment="CENTER" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.rowIndex="2">
<GridPane.margin>
<Insets />
</GridPane.margin>
</Button>
</children>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="122.0" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="146.0" minWidth="10.0" prefWidth="300.0" />
</columnConstraints>
<opaqueInsets>
<Insets bottom="4.0" left="4.0" right="4.0" top="4.0" />
</opaqueInsets>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets bottom="4.0" left="4.0" right="4.0" top="4.0" />
</padding>
</GridPane>
</center>
<top>
<VBox fx:id="vBox" prefHeight="200.0" prefWidth="400.0" BorderPane.alignment="CENTER">
<children>
<TitledPane fx:id="biblatexPane" animated="false" collapsible="false" text="biblatex">
<content>
</content>
</TitledPane>
<TitledPane fx:id="bibTexPane" animated="false" collapsible="false" text="BibTex">
<content>
</content>
</TitledPane>
<TitledPane fx:id="ieeetranPane" animated="false" collapsible="false" text="IEEETran">
<content>
</content>
</TitledPane>
<TitledPane fx:id="customPane" animated="false" collapsible="false" text="Custom">
<content>
</content>
</TitledPane>
</children>
</VBox>
</top>
</BorderPane>
</content>

</DialogPane>
Loading