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 LibraryProperties to JavaFX #4617

Merged
merged 28 commits into from
Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e18d236
[WIP] Convert LibraryProperties to JavaFX
Siedlerchr Jan 26, 2019
7f1c32b
Merge remote-tracking branch 'upstream/master' into libraryproperties…
Siedlerchr Jan 27, 2019
c540ff4
fix l10n and error in fxml
Siedlerchr Jan 27, 2019
e82abdd
Convert db properties to javafx
Siedlerchr Jan 28, 2019
d246d37
fix checkstyle and l10n
Siedlerchr Jan 28, 2019
b54535f
Merge remote-tracking branch 'upstream/master' into libraryproperties…
Siedlerchr Feb 16, 2019
e9db4bf
Merge remote-tracking branch 'upstream/master' into libraryproperties…
Siedlerchr Feb 18, 2019
06ed9ec
fix package error
Siedlerchr Feb 18, 2019
49e3600
add new fxml
Siedlerchr Feb 19, 2019
872d436
Merge remote-tracking branch 'upstream/master' into libraryproperties…
Siedlerchr Feb 19, 2019
5657fed
Create properties in view Model for SaveOrderConfig
Siedlerchr Feb 21, 2019
466f40f
Merge remote-tracking branch 'upstream/master' into libraryproperties…
Siedlerchr Feb 24, 2019
159c48a
create empty dialog pane for preferences dialog to make root componen…
Siedlerchr Feb 24, 2019
20d6c05
fix checkstyle
Siedlerchr Feb 25, 2019
8db78c2
add missing controller and fix disable property
Siedlerchr Feb 27, 2019
f6564f1
Merge remote-tracking branch 'upstream/master' into libraryproperties…
Siedlerchr Mar 1, 2019
760a6c2
remove old save order config display
Siedlerchr Mar 1, 2019
28d3f56
some layout stuff
Siedlerchr Mar 1, 2019
1a05b8f
reduce sizes
Siedlerchr Mar 1, 2019
0cf3c87
add method for changing the radio button texts to save
Siedlerchr Mar 1, 2019
9e9450f
move radio button toggle group back as property
Siedlerchr Mar 2, 2019
028cbc1
store values for sort order radio box
Siedlerchr Mar 3, 2019
ad5291f
Merge remote-tracking branch 'upstream/master' into libraryproperties…
Siedlerchr Mar 8, 2019
5ce22f2
move css rule to base.css
Siedlerchr Mar 8, 2019
e214240
fix css
Siedlerchr Mar 9, 2019
c1707d9
Merge remote-tracking branch 'upstream/master' into libraryproperties…
Siedlerchr Mar 9, 2019
28d46fd
introduce second boolean for export in specified order to reflect tab…
Siedlerchr Mar 9, 2019
ab9de54
remove empty line
Siedlerchr Mar 9, 2019
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
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1027,3 +1027,8 @@ We want to have a look that matches our icons in the tool-bar */
.tooltip-error {
-fx-background-color: -jr-error;
}

.sectionHeader {
-fx-font-size: 1.5em;
-fx-padding: 1em 0em 1em 0em;
}
7 changes: 3 additions & 4 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
import org.jabref.gui.actions.ConnectToSharedDatabaseCommand;
import org.jabref.gui.actions.CopyFilesAction;
import org.jabref.gui.actions.CustomizeKeyBindingAction;
import org.jabref.gui.actions.DatabasePropertiesAction;
import org.jabref.gui.actions.EditExternalFileTypesAction;
import org.jabref.gui.actions.ErrorConsoleAction;
import org.jabref.gui.actions.LibraryPropertiesAction;
import org.jabref.gui.actions.LookupIdentifierAction;
import org.jabref.gui.actions.ManageContentSelectorAction;
import org.jabref.gui.actions.ManageCustomExportsAction;
Expand Down Expand Up @@ -818,15 +818,15 @@ private MenuBar createMenu() {
edit.getItems().add(new SeparatorMenuItem());
}
}

//@formatter:off
library.getItems().addAll(
factory.createMenuItem(StandardActions.NEW_ENTRY, new NewEntryAction(this, dialogService, Globals.prefs)),
factory.createMenuItem(StandardActions.NEW_ENTRY_FROM_PLAINTEX, new NewEntryFromPlainTextAction(this, Globals.prefs.getUpdateFieldPreferences(), dialogService, Globals.prefs)),
factory.createMenuItem(StandardActions.DELETE_ENTRY, new OldDatabaseCommandWrapper(Actions.DELETE, this, Globals.stateManager)),

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new DatabasePropertiesAction(this)),
factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(this, dialogService)),
factory.createMenuItem(StandardActions.EDIT_PREAMBLE, new PreambleEditor(this)),
factory.createMenuItem(StandardActions.EDIT_STRINGS, new BibtexStringEditorAction(this)),
factory.createMenuItem(StandardActions.MASS_SET_FIELDS, new MassSetFieldsAction(this))
Expand All @@ -838,7 +838,6 @@ private MenuBar createMenu() {
lookupIdentifiers.getItems().add(factory.createMenuItem(identifierAction.getAction(), identifierAction));
}

//@formatter:off
quality.getItems().addAll(
factory.createMenuItem(StandardActions.FIND_DUPLICATES, new DuplicateSearch(this, dialogService)),
factory.createMenuItem(StandardActions.MERGE_ENTRIES, new MergeEntriesAction(this)),
Expand Down
43 changes: 43 additions & 0 deletions src/main/java/org/jabref/gui/SaveOrderConfigDisplay.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>

<fx:root prefHeight="200.0" prefWidth="600.0" type="javafx.scene.layout.GridPane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.SaveOrderConfigDisplayView">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints prefHeight="30.0" />
<RowConstraints prefHeight="30.0" />
<RowConstraints prefHeight="30.0" />
<RowConstraints prefHeight="30.0" />
<RowConstraints prefHeight="30.0" />
<RowConstraints prefHeight="30.0" />
</rowConstraints>
<fx:define>
<ToggleGroup fx:id="saveOrderToggleGroup" />
</fx:define>
<children>
<ComboBox fx:id="savePriSort" editable="true" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<ComboBox fx:id="saveSecSort" editable="true" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<ComboBox fx:id="saveTerSort" editable="true" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<RadioButton fx:id="exportInSpecifiedOrder" mnemonicParsing="false" prefHeight="5.0" prefWidth="206.0" text="%Export entries ordered as specified" toggleGroup="$saveOrderToggleGroup" GridPane.columnSpan="3" GridPane.rowIndex="2" />
<RadioButton fx:id="exportInTableOrder" mnemonicParsing="false" text="%Export in current table sort order" toggleGroup="$saveOrderToggleGroup" GridPane.columnSpan="3" GridPane.rowIndex="1" />
<RadioButton fx:id="exportInOriginalOrder" mnemonicParsing="false" text="%Export entries in their original order" toggleGroup="$saveOrderToggleGroup" GridPane.columnSpan="3" />
<CheckBox fx:id="savePriDesc" disable="${!exportInSpecifiedOrder.selected}" mnemonicParsing="false" text="%Descending" GridPane.columnIndex="2" GridPane.rowIndex="3" />
<CheckBox fx:id="saveSecDesc" disable="${!exportInSpecifiedOrder.selected}" mnemonicParsing="false" text="%Descending" GridPane.columnIndex="2" GridPane.rowIndex="4" />
<CheckBox fx:id="saveTerDesc" disable="${!exportInSpecifiedOrder.selected}" mnemonicParsing="false" text="%Descending" GridPane.columnIndex="2" GridPane.rowIndex="5" />
<Label disabled="${!exportInSpecifiedOrder.selected}" text="%Primary sort criterion" GridPane.rowIndex="3" />
<Label disabled="${!exportInSpecifiedOrder.selected}" text="%Secondary sort criterion" GridPane.rowIndex="4" />
<Label disabled="${!exportInSpecifiedOrder.selected}" text="%Tertiary sort criterion" GridPane.rowIndex="5" />
</children>
</fx:root>
113 changes: 0 additions & 113 deletions src/main/java/org/jabref/gui/SaveOrderConfigDisplay.java

This file was deleted.

81 changes: 81 additions & 0 deletions src/main/java/org/jabref/gui/SaveOrderConfigDisplayView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package org.jabref.gui;

import javax.inject.Inject;

import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;

import org.jabref.logic.l10n.Localization;
import org.jabref.model.metadata.SaveOrderConfig;
import org.jabref.preferences.PreferencesService;

import com.airhacks.afterburner.views.ViewLoader;

public class SaveOrderConfigDisplayView extends GridPane {

private final SaveOrderConfig config;

@FXML private ToggleGroup saveOrderToggleGroup;
@FXML private ComboBox<String> savePriSort;
@FXML private ComboBox<String> saveSecSort;
@FXML private ComboBox<String> saveTerSort;
@FXML private RadioButton exportInSpecifiedOrder;
@FXML private RadioButton exportInTableOrder;
@FXML private RadioButton exportInOriginalOrder;
@FXML private CheckBox savePriDesc;
@FXML private CheckBox saveSecDesc;
@FXML private CheckBox saveTerDesc;
@Inject private PreferencesService preferencesService;

private SaveOrderConfigDisplayViewModel viewModel;

public SaveOrderConfigDisplayView(SaveOrderConfig config) {
this.config = config;

ViewLoader.view(this)
.root(this)
.load();
}

@FXML
private void initialize() {

viewModel = new SaveOrderConfigDisplayViewModel(config, preferencesService);

exportInSpecifiedOrder.selectedProperty().bindBidirectional(viewModel.saveInSpecifiedOrderProperty());
exportInTableOrder.selectedProperty().bindBidirectional(viewModel.saveInTableOrderProperty());
exportInOriginalOrder.selectedProperty().bindBidirectional(viewModel.saveInOriginalProperty());

savePriSort.itemsProperty().bindBidirectional(viewModel.priSortFieldsProperty());
saveSecSort.itemsProperty().bindBidirectional(viewModel.secSortFieldsProperty());
saveTerSort.itemsProperty().bindBidirectional(viewModel.terSortFieldsProperty());

savePriSort.valueProperty().bindBidirectional(viewModel.savePriSortSelectedValueProperty());
saveSecSort.valueProperty().bindBidirectional(viewModel.saveSecSortSelectedValueProperty());
saveTerSort.valueProperty().bindBidirectional(viewModel.saveTerSortSelectedValueProperty());

savePriDesc.selectedProperty().bindBidirectional(viewModel.savePriDescPropertySelected());
saveSecDesc.selectedProperty().bindBidirectional(viewModel.saveSecDescPropertySelected());
saveTerDesc.selectedProperty().bindBidirectional(viewModel.saveTerDescPropertySelected());

}

public void changeExportDescriptionToSave() {
exportInOriginalOrder.setText(Localization.lang("Save entries in their original order"));
exportInSpecifiedOrder.setText(Localization.lang("Save entries ordered as specified"));
exportInTableOrder.setText(Localization.lang("Save in current table sort order"));
}

public void storeConfig() {
viewModel.storeConfigInPrefs();
}

public SaveOrderConfig getSaveOrderConfig() {
return viewModel.getSaveOrderConfig();
}

}
Loading