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 all 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
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