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

Conversion of preferencesDialog/advancedTab, networkTab and groupsTab to mvvm #5141

Merged
merged 12 commits into from
Aug 18, 2019
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 @@ -1015,6 +1015,11 @@ We want to have a look that matches our icons in the tool-bar */
-fx-fill: -jr-warn;
}

.warning-message {
-fx-fill: -jr-error;
-fx-text-fill: -jr-error;
}

.error-icon {
-fx-text-fill: -jr-error;
-fx-fill: -jr-error;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ public enum JabRefIcons implements JabRefIcon {
LATEX_FILE_DIRECTORY(MaterialDesignIcon.FOLDER_OUTLINE),
LATEX_FILE(MaterialDesignIcon.FILE_OUTLINE),
LATEX_COMMENT(MaterialDesignIcon.COMMENT_TEXT_OUTLINE),
LATEX_LINE(MaterialDesignIcon.FORMAT_LINE_SPACING);
LATEX_LINE(MaterialDesignIcon.FORMAT_LINE_SPACING),
PASSWORD_REVEALED(MaterialDesignIcon.EYE);

private final JabRefIcon icon;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.jabref.gui.preferences;

import java.util.List;

import javax.inject.Inject;

import javafx.scene.Node;
import javafx.scene.layout.VBox;

import org.jabref.gui.DialogService;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.preferences.JabRefPreferences;

public abstract class AbstractPreferenceTabView extends VBox implements PreferencesTab {

@Inject protected TaskExecutor taskExecutor;
@Inject protected DialogService dialogService;

protected PreferenceTabViewModel viewModel;

protected JabRefPreferences preferences;

@Override
public Node getBuilder() { return this; }

@Override
public void setValues() { viewModel.setValues(); }

@Override
public void storeSettings() { viewModel.storeSettings(); }

@Override
public boolean validateSettings() { return viewModel.validateSettings(); }

@Override
public List<String> getRestartWarnings() { return viewModel.getRestartWarnings(); }
}
67 changes: 67 additions & 0 deletions src/main/java/org/jabref/gui/preferences/AdvancedTab.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>

<?import org.controlsfx.control.textfield.CustomPasswordField?>

<fx:root prefWidth="650.0" spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx/8.0.212" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.preferences.AdvancedTabView">
<children>
<Label styleClass="titleHeader" text="%Advanced" />
<Label styleClass="sectionHeader" text="%Remote operation" />
<Label fx:id="remoteLabel" text="%This feature lets new files be opened or imported into an already running instance of JabRef instead of opening a new instance. For instance, this is useful when you open a file in JabRef from your web browser. Note that this will prevent you from running more than one instance of JabRef at a time." textOverrun="CLIP" wrapText="true" />
<HBox alignment="CENTER_LEFT" spacing="10.0">
<children>
<CheckBox fx:id="remoteServer" text="%Listen for remote operation on port" />
<TextField fx:id="remotePort" maxWidth="100.0" HBox.hgrow="ALWAYS" />
<Button fx:id="remoteHelp" prefWidth="20.0" />
</children>
</HBox>

<Label styleClass="sectionHeader" text="%Search IEEEXplore" />
<CheckBox fx:id="useIEEELatexAbbreviations" text="%Use IEEE LaTeX abbreviations" />

<Label styleClass="sectionHeader" text="%Import conversions" />
<CheckBox fx:id="useCaseKeeper" text="%Add {} to specified title words on search to keep the correct case" />
<CheckBox fx:id="useUnitFormatter" text="%Format units by adding non-breaking separators and keeping the correct case on search" />

<Label styleClass="sectionHeader" text="%Network" />
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" hgap="10.0" vgap="10.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<CheckBox fx:id="proxyUse" text="%Use custom proxy configuration" GridPane.columnSpan="3" GridPane.rowIndex="0" />
<Label fx:id="proxyHostnameLabel" text="%Hostname" GridPane.rowIndex="1" />
<TextField fx:id="proxyHostname" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label fx:id="proxyPortLabel" text="%Port" GridPane.rowIndex="2" />
<TextField fx:id="proxyPort" maxWidth="100.0" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<CheckBox fx:id="proxyUseAuthentication" text="%Proxy requires authentication" GridPane.columnSpan="3" GridPane.rowIndex="3" />
<Label fx:id="proxyUsernameLabel" text="%Username" GridPane.rowIndex="4" />
<TextField fx:id="proxyUsername" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label fx:id="proxyPasswordLabel" text="%Password" GridPane.rowIndex="5" />
<CustomPasswordField fx:id="proxyPassword" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<Label fx:id="proxyAttentionLabel" styleClass="warning-message"
text="%Attention: Password is stored in plain text!" GridPane.columnIndex="2" GridPane.rowIndex="5" />
</children>
</GridPane>
</children>
</fx:root>
176 changes: 0 additions & 176 deletions src/main/java/org/jabref/gui/preferences/AdvancedTab.java

This file was deleted.