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 Preferences / XMP and NameFormatters to mvvm #5265

Merged
merged 8 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public enum StandardActions implements Action {
PARSE_TEX(Localization.lang("Search for Citations in LaTeX Files"), IconTheme.JabRefIcons.LATEX_CITATIONS),
NEW_SUB_LIBRARY_FROM_AUX(Localization.lang("New sublibrary based on AUX file") + "...", Localization.lang("New BibTeX sublibrary") + Localization.lang("This feature generates a new library based on which entries are needed in an existing LaTeX document."), IconTheme.JabRefIcons.NEW),
WRITE_XMP(Localization.lang("Write XMP-metadata to PDFs"), Localization.lang("Will write XMP-metadata to the PDFs linked from selected entries."), KeyBinding.WRITE_XMP),
XMP_FILTER_ADD(Localization.lang("Add"), Localization.lang("Add field to filter list"), IconTheme.JabRefIcons.ADD_NOBOX),
calixtus marked this conversation as resolved.
Show resolved Hide resolved
NAME_FORMATTER_ADD(Localization.lang("Add"), Localization.lang("Add formatter to list"), IconTheme.JabRefIcons.ADD_NOBOX),
OPEN_FOLDER(Localization.lang("Open folder"), Localization.lang("Open folder"), KeyBinding.OPEN_FOLDER),
OPEN_FILE(Localization.lang("Open file"), Localization.lang("Open file"), IconTheme.JabRefIcons.FILE, KeyBinding.OPEN_FILE),
OPEN_CONSOLE(Localization.lang("Open terminal here"), Localization.lang("Open terminal here"), IconTheme.JabRefIcons.CONSOLE, KeyBinding.OPEN_CONSOLE),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.jabref.gui.preferences;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import org.jabref.logic.layout.format.NameFormatter;

public class NameFormatterItemModel {
private final StringProperty name;
private final StringProperty format;

NameFormatterItemModel() { this(""); }

NameFormatterItemModel(String name) {
this(name, NameFormatter.DEFAULT_FORMAT);
}

NameFormatterItemModel(String name, String format) {
this.name = new SimpleStringProperty(name);
this.format = new SimpleStringProperty(format);
}

public void setName(String name) {
this.name.setValue(name);
}

public String getName() {
return name.getValue();
}

public void setFormat(String format) {
this.format.setValue(format);
}

public String getFormat() {
return format.getValue();
}

@Override
public String toString() { return "[" + name.getValue() + "," + format.getValue() + "]"; }
}
40 changes: 40 additions & 0 deletions src/main/java/org/jabref/gui/preferences/NameFormatterTab.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<fx:root prefWidth="650.0" spacing="10.0" type="VBox" xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.preferences.NameFormatterTabView">
<Label styleClass="titleHeader" text="%Special name formatters"/>
<HBox spacing="4.0">
<VBox prefHeight="300.0" prefWidth="600.0" spacing="4.0">
<TableView fx:id="formatterList" prefHeight="300.0" prefWidth="600.0">
<columns>
<TableColumn fx:id="formatterNameColumn" minWidth="50.0"
prefWidth="200.0" text="%Formatter name"/>
<TableColumn fx:id="formatterStringColumn"
minWidth="50.0" prefWidth="368" sortable="false" text="%Format string"/>
<TableColumn fx:id="actionsColumn" maxWidth="30.0" minWidth="30.0" prefWidth="30.0"
editable="false" resizable="false"/>
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
<HBox spacing="4.0">
<TextField fx:id="addFormatterName" promptText="%Formatter name" HBox.hgrow="ALWAYS"/>
<TextField fx:id="addFormatterString" promptText="%Format string" HBox.hgrow="ALWAYS"/>
</HBox>
</VBox>
<VBox>
<Button fx:id="formatterHelp" prefHeight="25.0" prefWidth="25.0"/>
<VBox VBox.vgrow="ALWAYS"/>
<Button fx:id="addFormatter" prefHeight="25.0" prefWidth="25.0"/>
</VBox>
</HBox>
</fx:root>
233 changes: 0 additions & 233 deletions src/main/java/org/jabref/gui/preferences/NameFormatterTab.java

This file was deleted.

Loading