Skip to content

Commit

Permalink
Merge pull request #5062 from calixtus/preferences_preview_mvvm
Browse files Browse the repository at this point in the history
[WIP] Conversion of Preferences/preview to mvvm
  • Loading branch information
Siedlerchr authored Jul 17, 2019
2 parents e89d603 + 5b3f983 commit b094bc6
Show file tree
Hide file tree
Showing 12 changed files with 908 additions and 243 deletions.
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/DragAndDropDataFormats.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import javafx.scene.input.DataFormat;

import org.jabref.logic.citationstyle.PreviewLayout;
import org.jabref.model.entry.BibEntry;

/**
Expand All @@ -15,5 +16,6 @@ public class DragAndDropDataFormats {
public static final DataFormat LINKED_FILE = new DataFormat("dnd/org.jabref.model.entry.LinkedFile");
public static final DataFormat ENTRIES = new DataFormat("dnd/org.jabref.model.entry.BibEntries");
@SuppressWarnings("unchecked") public static final Class<List<BibEntry>> BIBENTRY_LIST_CLASS = (Class<List<BibEntry>>) (Class<?>) List.class;

public static final DataFormat PREVIEWLAYOUTS = new DataFormat("dnd/org.jabref.logic.citationstyle.PreviewLayouts");
@SuppressWarnings("unchecked") public static final Class<List<PreviewLayout>> PREVIEWLAYOUT_LIST_CLASS = (Class<List<PreviewLayout>>) (Class<?>) List.class;
}
46 changes: 45 additions & 1 deletion src/main/java/org/jabref/gui/preferences/PreferencesDialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-fx-background: -fx-control-inner-background;
}

.split-pane-divider {
.split-pane > .split-pane-divider {
-fx-padding: 0 4 0 4;
-fx-background-color: transparent;
}
Expand All @@ -26,3 +26,47 @@
*:search-highlight {
-fx-background-color: -jr-light-red;
}

.code-area {
-fx-padding: 0;
-fx-border-width: 1;
-fx-background-color: transparent;
-fx-border-color: -fx-outer-border;
}

.code-area .tagmark {
-fx-fill: gray;
}

.code-area .anytag {
-fx-fill: crimson;
}

.code-area .paren {
-fx-fill: firebrick;
-fx-font-weight: bold;
}

.code-area .attribute {
-fx-fill: darkviolet;
}

.code-area .avalue {
-fx-fill: black;
}

.code-area .comment {
-fx-fill: teal;
}

.code-area .highlight-keyword {
-fx-text-fill: -jr-purple;
}

.code-area .context-menu {
-fx-font-family: sans-serif;
}

.code-area .context-menu .menu-item .label {
-fx-padding: 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public PreferencesDialogViewModel(DialogService dialogService, TaskExecutor task
preferenceTabs.add(new FileTabView(prefs));
preferenceTabs.add(new TablePrefsTab(prefs));
preferenceTabs.add(new TableColumnsTab(prefs, frame));
preferenceTabs.add(new PreviewPreferencesTab(dialogService, this.taskExecutor));
preferenceTabs.add(new PreviewTabView(prefs));
preferenceTabs.add(new ExternalTabView(prefs, frame));
preferenceTabs.add(new GroupsPrefsTab(prefs));
preferenceTabs.add(new EntryEditorPrefsTab(prefs));
Expand Down
231 changes: 0 additions & 231 deletions src/main/java/org/jabref/gui/preferences/PreviewPreferencesTab.java

This file was deleted.

73 changes: 73 additions & 0 deletions src/main/java/org/jabref/gui/preferences/PreviewTab.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<?import org.fxmisc.richtext.CodeArea?>

<?import org.fxmisc.flowless.VirtualizedScrollPane?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.layout.AnchorPane?>

<fx:root prefWidth="650.0" spacing="4.0" type="VBox" xmlns="http://javafx.com/javafx/8.0.212"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.preferences.PreviewTabView">
<children>
<Label text="%Current Preview" styleClass="titleHeader"/>
<HBox prefHeight="100.0" prefWidth="200.0" spacing="4.0">
<children>
<VBox spacing="4.0" HBox.hgrow="ALWAYS">
<children>
<Label text="%Available" styleClass="sectionHeader"/>
<ListView fx:id="availableListView" maxHeight="250.0" minHeight="250.0"/>
</children>
</VBox>
<VBox alignment="CENTER" spacing="4.0">
<children>
<Label styleClass="sectionHeader"/>
<Button fx:id="toRightButton" prefWidth="60.0" text="&gt;&gt;" onAction="#toRightButtonAction"/>
<Button fx:id="toLeftButton" prefWidth="60.0" text="&lt;&lt;" onAction="#toLeftButtonAction"/>
<VBox prefHeight="40.0"/>
<Button fx:id="sortUpButton" prefWidth="60.0" text="%Up" onAction="#sortUpButtonAction"/>
<Button fx:id="sortDownButton" prefWidth="60.0" text="%Down" onAction="#sortDownButtonAction"/>
</children>
</VBox>
<VBox spacing="4.0" HBox.hgrow="ALWAYS">
<children>
<Label text="%Selected" styleClass="sectionHeader"/>
<ListView fx:id="chosenListView" maxHeight="250.0" minHeight="250.0"/>
</children>
</VBox>
</children>
</HBox>
<AnchorPane>
<children>
<TabPane prefHeight="250.0" prefWidth="650.0" tabClosingPolicy="UNAVAILABLE">
<tabs>
<Tab text="%Preview" fx:id="previewTab" />
<Tab text="%Edit">
<content>
<VirtualizedScrollPane>
<content>
<CodeArea fx:id="editArea"/>
</content>
</VirtualizedScrollPane>
</content>
</Tab>
</tabs>
</TabPane>
<HBox alignment="CENTER_RIGHT" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="2.0" spacing="5.0">
<children>
<Label fx:id="readOnlyLabel" text="%Read only"/>
<Button
fx:id="resetDefaultButton" text="%Reset default preview style"
onAction="#resetDefaultButtonAction"/>
</children>
</HBox>
</children>
</AnchorPane>
</children>
</fx:root>
Loading

0 comments on commit b094bc6

Please sign in to comment.