Skip to content

Commit

Permalink
Conversion of Preferences / XMP and NameFormatters to mvvm (#5265)
Browse files Browse the repository at this point in the history
* Initial

* l10n

* Added validator and cleanups

* Solved review issues

* l10n

* Removed PropertyValueFactory
  • Loading branch information
calixtus authored and tobiasdiez committed Sep 4, 2019
1 parent 9aa68a5 commit cce5008
Show file tree
Hide file tree
Showing 12 changed files with 622 additions and 420 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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 = new SimpleStringProperty("");
private final StringProperty format = new SimpleStringProperty("");

NameFormatterItemModel() { this(""); }

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

NameFormatterItemModel(String name, String format) {
this.name.setValue(name);
this.format.setValue(format);
}

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

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

public StringProperty nameProperty() { return name; }

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

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

public StringProperty formatProperty() { return format; }

@Override
public String toString() { return "[" + name.getValue() + "," + format.getValue() + "]"; }
}
51 changes: 51 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,51 @@
<?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.control.Tooltip?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<?import org.jabref.gui.icon.JabRefIconView?>

<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 styleClass="icon-button,narrow" onAction="#addFormatter"
prefHeight="25.0" prefWidth="25.0">
<graphic>
<JabRefIconView glyph="ADD_NOBOX"/>
</graphic>
<tooltip>
<Tooltip text="%Add formatter to list"/>
</tooltip>
</Button>
</VBox>
</HBox>
</fx:root>
233 changes: 0 additions & 233 deletions src/main/java/org/jabref/gui/preferences/NameFormatterTab.java

This file was deleted.

Loading

0 comments on commit cce5008

Please sign in to comment.