-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conversion of Preferences / XMP and NameFormatters to mvvm (#5265)
* Initial * l10n * Added validator and cleanups * Solved review issues * l10n * Removed PropertyValueFactory
- Loading branch information
1 parent
9aa68a5
commit cce5008
Showing
12 changed files
with
622 additions
and
420 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/main/java/org/jabref/gui/preferences/NameFormatterItemModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
51
src/main/java/org/jabref/gui/preferences/NameFormatterTab.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
233
src/main/java/org/jabref/gui/preferences/NameFormatterTab.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.