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

Fix entry editor #2875

Merged
merged 4 commits into from
May 31, 2017
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
14 changes: 0 additions & 14 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
import org.jabref.gui.undo.UndoableFieldChange;
import org.jabref.gui.undo.UndoableKeyChange;
import org.jabref.gui.undo.UndoableRemoveEntry;
import org.jabref.gui.util.DefaultTaskExecutor;
import org.jabref.gui.util.component.CheckBoxMessage;
import org.jabref.gui.util.component.VerticalLabelUI;
import org.jabref.logic.TypedBibEntry;
Expand Down Expand Up @@ -239,8 +238,6 @@ public EntryEditor(JabRefFrame frame, BasePanel panel, BibEntry entry) {
if (Globals.prefs.getBoolean(JabRefPreferences.DEFAULT_SHOW_SOURCE)) {
tabbed.setSelectedIndex(sourceIndex);
}

DefaultTaskExecutor.runInJavaFXThread(() -> setEntry(entry));
}

private static String getSourceString(BibEntry entry, BibDatabaseMode type) throws IOException {
Expand Down Expand Up @@ -457,17 +454,6 @@ public BibEntry getEntry() {
return entry;
}

/**
* Sets all the text areas according to the shown entry.
*/
private void setEntry(BibEntry entry) {
for (Object tab : tabs) {
if (tab instanceof EntryEditorTab) {
((EntryEditorTab) tab).setEntry(entry);
}
}
}

public BibDatabase getDatabase() {
return panel.getDatabase();
}
Expand Down
19 changes: 3 additions & 16 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class EntryEditorTab {
private final BasePanel basePanel;
private FieldEditorFX activeField;
private BibEntry entry;
private boolean updating;

public EntryEditorTab(JabRefFrame frame, BasePanel basePanel, List<String> fields, EntryEditor parent,
boolean addKeyField, boolean compressed, String tabTitle, BibEntry entry) {
Expand Down Expand Up @@ -152,9 +151,9 @@ private Region setupPanel(JabRefFrame frame, BasePanel bPanel, boolean addKeyFie
fieldEditor.setAutoCompleteListener(autoCompleteListener);
*/

FieldEditorFX fieldEditor = FieldEditors.getForField(fieldName, Globals.taskExecutor, new FXDialogService(),
Globals.journalAbbreviationLoader, Globals.prefs.getJournalAbbreviationPreferences(), Globals.prefs,
bPanel.getBibDatabaseContext(), entry.getType());
FieldEditorFX fieldEditor = FieldEditors.getForField(fieldName, Globals.taskExecutor, new FXDialogService(), Globals.journalAbbreviationLoader, Globals.prefs.getJournalAbbreviationPreferences(), Globals.prefs, bPanel.getBibDatabaseContext(), entry.getType());
fieldEditor.bindToEntry(entry);

editors.put(fieldName, fieldEditor);
/*
// TODO: Reenable this
Expand Down Expand Up @@ -252,18 +251,6 @@ private String getPrompt(String field) {
return "";
}

public void setEntry(BibEntry entry) {
try {
updating = true;
for (FieldEditorFX editor : editors.values()) {
editor.bindToEntry(entry);
}
this.entry = entry;
} finally {
updating = false;
}
}

/**
* Only sets the activeField variable but does not focus it.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<?import javafx.scene.layout.StackPane?>
<?import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView?>
<fx:root xmlns:fx="http://javafx.com/fxml/1" type="HBox" xmlns="http://javafx.com/javafx/8.0.112">
<ListView fx:id="listView" prefHeight="0" HBox.hgrow="ALWAYS"/>
<ListView fx:id="listView" prefHeight="0" HBox.hgrow="ALWAYS" maxHeight="100"/>
<Button onAction="#addNewFile"
styleClass="flatButton">
<graphic>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jabref.gui.fieldeditors;

import javafx.beans.binding.Bindings;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
Expand Down Expand Up @@ -38,7 +39,7 @@ public LinkedFilesEditor(String fieldName, DialogService dialogService, BibDatab
.withTooltip(LinkedFileViewModel::getDescription)
.withGraphic(LinkedFilesEditor::createFileDisplay);
listView.setCellFactory(cellFactory);
listView.itemsProperty().bind(viewModel.filesProperty());
Bindings.bindContent(listView.itemsProperty().get(), viewModel.filesProperty());
}

private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
Expand Down