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

Completed General Fields Customizer conversion to JavaFX #4346

Merged
merged 26 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6e5694a
temp commit 09 06 18
abepolk Sep 6, 2018
92cddb1
starting work on converting Customize General Fields dialog from Swin…
abepolk Sep 7, 2018
24eb0a6
More work on converting JavaFX dialog
abepolk Sep 7, 2018
770a771
Even more work on converting JavaFX dialog
abepolk Sep 7, 2018
6a0b878
more work JavaFX
abepolk Sep 9, 2018
4058a70
Further work, now cannot load
abepolk Sep 11, 2018
b3d5238
Cleaned up comments
abepolk Sep 15, 2018
51712e2
create newlines at ends of files
abepolk Sep 15, 2018
ee919a4
fix missing ids change bidirectional binding use string property
Siedlerchr Sep 16, 2018
6eabd86
Fix default and help
abepolk Sep 18, 2018
3435997
Got the dialog running, but it is not saving
abepolk Sep 18, 2018
5133d44
Removed _def
abepolk Sep 20, 2018
4c6e309
fix bug
abepolk Sep 20, 2018
b726a81
Reformat customize general fields dialog as JavaFX
abepolk Sep 21, 2018
0d9a2a8
Merge branch 'master' into gen_javafx_dialog
abepolk Sep 21, 2018
78c8748
Small code fixes
abepolk Sep 21, 2018
857b9ea
make fxml support multiple languages
abepolk Sep 22, 2018
c5ce5b1
minor code fixes
abepolk Sep 23, 2018
4e9d78a
added javadoc
abepolk Sep 23, 2018
bf1c5d3
change class name and code fix
abepolk Sep 24, 2018
5bb9195
Add English localization
abepolk Sep 24, 2018
a22fcf0
remove old Swing dialog
abepolk Sep 24, 2018
7ae7a0e
comment fix
abepolk Sep 24, 2018
fb22955
English localization change
abepolk Sep 24, 2018
ae9ff0d
fix indentation
abepolk Sep 25, 2018
6cd1acd
remove cancelButton from controller
abepolk Sep 25, 2018
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
## [Unreleased]

### Changed
- We updated the dialog for setting up general fields.
- URL field formatting is updated. All whitespace chars, located at the beginning/ending of the url, are trimmed automatically
- We changed the behavior of the field formatting dialog such that the `bibtexkey` is not changed when formatting all fields or all text fields.
- We added a "Move file to file directory and rename file" option for simultaneously moving and renaming of document file. [#4166](https://github.com/JabRef/jabref/issues/4166)
Expand Down
175 changes: 0 additions & 175 deletions src/main/java/org/jabref/gui/GenFieldsCustomizer.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_IMPORTS, new ManageCustomImportsAction(this)),
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_EXPORTS, new ManageCustomExportsAction(this)),
factory.createMenuItem(StandardActions.MANAGE_EXTERNAL_FILETYPES, new EditExternalFileTypesAction()),
Expand Down
12 changes: 2 additions & 10 deletions src/main/java/org/jabref/gui/actions/SetupGeneralFieldsAction.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
package org.jabref.gui.actions;

import org.jabref.gui.GenFieldsCustomizer;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.customizefields.CustomizeGeneralFieldsDialogView;

public class SetupGeneralFieldsAction extends SimpleCommand {

private final JabRefFrame jabRefFrame;

public SetupGeneralFieldsAction(JabRefFrame jabRefFrame) {
this.jabRefFrame = jabRefFrame;
}

@Override
public void execute() {
GenFieldsCustomizer gf = new GenFieldsCustomizer(jabRefFrame);
gf.setVisible(true);
new CustomizeGeneralFieldsDialogView().show();

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.ButtonType?>
<?import javafx.scene.control.DialogPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.VBox?>
<DialogPane xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.customizefields.CustomizeGeneralFieldsDialogView">
<content>
<VBox prefHeight="300.0" prefWidth="650.0">
<children>
<Label text="%General Fields" />
<Label text="%Create custom fields for each BibTeX entry" />
<TextArea fx:id="fieldsTextArea" minHeight="200.0" minWidth="628.0" />
<Label text="%Format: Tab:field;field;... (e.g. General:url;pdf;note...)" />
</children>
</VBox>
</content>
<ButtonType fx:id="okButton" fx:constant="OK" />
<ButtonType fx:id="resetButton" buttonData="LEFT" text="%Default" />
<ButtonType fx:id="helpButton" text="%Help" />
<ButtonType fx:constant="CANCEL" />
</DialogPane>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package org.jabref.gui.customizefields;

import javax.inject.Inject;

import javafx.fxml.FXML;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TextArea;

import org.jabref.gui.DialogService;
import org.jabref.gui.help.HelpAction;
import org.jabref.gui.util.BaseDialog;
import org.jabref.gui.util.ControlHelper;
import org.jabref.logic.help.HelpFile;
import org.jabref.logic.l10n.Localization;
import org.jabref.preferences.PreferencesService;

import com.airhacks.afterburner.views.ViewLoader;

public class CustomizeGeneralFieldsDialogView extends BaseDialog<Void> {

@FXML private ButtonType resetButton;
@FXML private ButtonType helpButton;
@FXML private ButtonType okButton;
@FXML private TextArea fieldsTextArea;

@Inject private DialogService dialogService;
@Inject private PreferencesService preferences;
private CustomizeGeneralFieldsDialogViewModel viewModel;

public CustomizeGeneralFieldsDialogView() {
this.setTitle(Localization.lang("Set General Fields"));
this.setResizable(true);
this.getDialogPane().setPrefSize(300, 650);

ViewLoader.view(this)
.load()
.setAsDialogPane(this);

HelpAction helpCommand = new HelpAction(HelpFile.GENERAL_FIELDS);
//HelpAction is written with Swing, not JavaFX, so runCommand() cannot be used normally. Here I am reaching into
//the command and running execute. When HelpAction is converted to JavaFX,
//the following will need to be changed.
ControlHelper.setAction(helpButton, getDialogPane(), event -> helpCommand.getCommand().execute());
ControlHelper.setAction(resetButton, getDialogPane(), event -> resetFields());
ControlHelper.setAction(okButton, getDialogPane(), event -> saveFieldsAndCloseDialog());

}

@FXML
private void initialize() {
viewModel = new CustomizeGeneralFieldsDialogViewModel(dialogService, preferences);
fieldsTextArea.textProperty().bindBidirectional(viewModel.fieldsTextProperty());

}

@FXML
private void closeDialog() {
close();
}

@FXML
private void saveFieldsAndCloseDialog() {
viewModel.saveFields();
closeDialog();
}

private void resetFields() {
viewModel.resetFields();
}

}
Loading