Skip to content

Commit b094bc6

Browse files
authored
Merge pull request #5062 from calixtus/preferences_preview_mvvm
[WIP] Conversion of Preferences/preview to mvvm
2 parents e89d603 + 5b3f983 commit b094bc6

12 files changed

+908
-243
lines changed

src/main/java/org/jabref/gui/DragAndDropDataFormats.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import javafx.scene.input.DataFormat;
66

7+
import org.jabref.logic.citationstyle.PreviewLayout;
78
import org.jabref.model.entry.BibEntry;
89

910
/**
@@ -15,5 +16,6 @@ public class DragAndDropDataFormats {
1516
public static final DataFormat LINKED_FILE = new DataFormat("dnd/org.jabref.model.entry.LinkedFile");
1617
public static final DataFormat ENTRIES = new DataFormat("dnd/org.jabref.model.entry.BibEntries");
1718
@SuppressWarnings("unchecked") public static final Class<List<BibEntry>> BIBENTRY_LIST_CLASS = (Class<List<BibEntry>>) (Class<?>) List.class;
18-
19+
public static final DataFormat PREVIEWLAYOUTS = new DataFormat("dnd/org.jabref.logic.citationstyle.PreviewLayouts");
20+
@SuppressWarnings("unchecked") public static final Class<List<PreviewLayout>> PREVIEWLAYOUT_LIST_CLASS = (Class<List<PreviewLayout>>) (Class<?>) List.class;
1921
}

src/main/java/org/jabref/gui/preferences/PreferencesDialog.css

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
-fx-background: -fx-control-inner-background;
1515
}
1616

17-
.split-pane-divider {
17+
.split-pane > .split-pane-divider {
1818
-fx-padding: 0 4 0 4;
1919
-fx-background-color: transparent;
2020
}
@@ -26,3 +26,47 @@
2626
*:search-highlight {
2727
-fx-background-color: -jr-light-red;
2828
}
29+
30+
.code-area {
31+
-fx-padding: 0;
32+
-fx-border-width: 1;
33+
-fx-background-color: transparent;
34+
-fx-border-color: -fx-outer-border;
35+
}
36+
37+
.code-area .tagmark {
38+
-fx-fill: gray;
39+
}
40+
41+
.code-area .anytag {
42+
-fx-fill: crimson;
43+
}
44+
45+
.code-area .paren {
46+
-fx-fill: firebrick;
47+
-fx-font-weight: bold;
48+
}
49+
50+
.code-area .attribute {
51+
-fx-fill: darkviolet;
52+
}
53+
54+
.code-area .avalue {
55+
-fx-fill: black;
56+
}
57+
58+
.code-area .comment {
59+
-fx-fill: teal;
60+
}
61+
62+
.code-area .highlight-keyword {
63+
-fx-text-fill: -jr-purple;
64+
}
65+
66+
.code-area .context-menu {
67+
-fx-font-family: sans-serif;
68+
}
69+
70+
.code-area .context-menu .menu-item .label {
71+
-fx-padding: 2;
72+
}

src/main/java/org/jabref/gui/preferences/PreferencesDialogViewModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public PreferencesDialogViewModel(DialogService dialogService, TaskExecutor task
4949
preferenceTabs.add(new FileTabView(prefs));
5050
preferenceTabs.add(new TablePrefsTab(prefs));
5151
preferenceTabs.add(new TableColumnsTab(prefs, frame));
52-
preferenceTabs.add(new PreviewPreferencesTab(dialogService, this.taskExecutor));
52+
preferenceTabs.add(new PreviewTabView(prefs));
5353
preferenceTabs.add(new ExternalTabView(prefs, frame));
5454
preferenceTabs.add(new GroupsPrefsTab(prefs));
5555
preferenceTabs.add(new EntryEditorPrefsTab(prefs));

src/main/java/org/jabref/gui/preferences/PreviewPreferencesTab.java

Lines changed: 0 additions & 231 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.control.Button?>
4+
<?import javafx.scene.control.Label?>
5+
<?import javafx.scene.control.ListView?>
6+
<?import javafx.scene.layout.HBox?>
7+
<?import javafx.scene.layout.VBox?>
8+
9+
<?import org.fxmisc.richtext.CodeArea?>
10+
11+
<?import org.fxmisc.flowless.VirtualizedScrollPane?>
12+
<?import javafx.scene.control.TabPane?>
13+
<?import javafx.scene.control.Tab?>
14+
<?import javafx.scene.layout.AnchorPane?>
15+
16+
<fx:root prefWidth="650.0" spacing="4.0" type="VBox" xmlns="http://javafx.com/javafx/8.0.212"
17+
xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.preferences.PreviewTabView">
18+
<children>
19+
<Label text="%Current Preview" styleClass="titleHeader"/>
20+
<HBox prefHeight="100.0" prefWidth="200.0" spacing="4.0">
21+
<children>
22+
<VBox spacing="4.0" HBox.hgrow="ALWAYS">
23+
<children>
24+
<Label text="%Available" styleClass="sectionHeader"/>
25+
<ListView fx:id="availableListView" maxHeight="250.0" minHeight="250.0"/>
26+
</children>
27+
</VBox>
28+
<VBox alignment="CENTER" spacing="4.0">
29+
<children>
30+
<Label styleClass="sectionHeader"/>
31+
<Button fx:id="toRightButton" prefWidth="60.0" text="&gt;&gt;" onAction="#toRightButtonAction"/>
32+
<Button fx:id="toLeftButton" prefWidth="60.0" text="&lt;&lt;" onAction="#toLeftButtonAction"/>
33+
<VBox prefHeight="40.0"/>
34+
<Button fx:id="sortUpButton" prefWidth="60.0" text="%Up" onAction="#sortUpButtonAction"/>
35+
<Button fx:id="sortDownButton" prefWidth="60.0" text="%Down" onAction="#sortDownButtonAction"/>
36+
</children>
37+
</VBox>
38+
<VBox spacing="4.0" HBox.hgrow="ALWAYS">
39+
<children>
40+
<Label text="%Selected" styleClass="sectionHeader"/>
41+
<ListView fx:id="chosenListView" maxHeight="250.0" minHeight="250.0"/>
42+
</children>
43+
</VBox>
44+
</children>
45+
</HBox>
46+
<AnchorPane>
47+
<children>
48+
<TabPane prefHeight="250.0" prefWidth="650.0" tabClosingPolicy="UNAVAILABLE">
49+
<tabs>
50+
<Tab text="%Preview" fx:id="previewTab" />
51+
<Tab text="%Edit">
52+
<content>
53+
<VirtualizedScrollPane>
54+
<content>
55+
<CodeArea fx:id="editArea"/>
56+
</content>
57+
</VirtualizedScrollPane>
58+
</content>
59+
</Tab>
60+
</tabs>
61+
</TabPane>
62+
<HBox alignment="CENTER_RIGHT" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="2.0" spacing="5.0">
63+
<children>
64+
<Label fx:id="readOnlyLabel" text="%Read only"/>
65+
<Button
66+
fx:id="resetDefaultButton" text="%Reset default preview style"
67+
onAction="#resetDefaultButtonAction"/>
68+
</children>
69+
</HBox>
70+
</children>
71+
</AnchorPane>
72+
</children>
73+
</fx:root>

0 commit comments

Comments
 (0)