Skip to content

Commit

Permalink
Merge pull request #3082 from JabRef/javafx-fileannotationtab
Browse files Browse the repository at this point in the history
JavaFX FileAnnotationTab
  • Loading branch information
LinusDietz authored Aug 16, 2017
2 parents b468d83 + 79ef2f9 commit 455965e
Show file tree
Hide file tree
Showing 13 changed files with 483 additions and 434 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We made the font size in the entry editor and group panel customizable by "Menu and label font size". [#3034](https://github.com/JabRef/jabref/issues/3034)
- If fetched article is already in database, then the entry merge dialog is shown.
- An error message is now displayed if you try to create a group containing the keyword separator or if there is already a group with the same name. [#3075](https://github.com/JabRef/jabref/issues/3075) and [#1495](https://github.com/JabRef/jabref/issues/1495)
- The FileAnnotationsTab was re-implemented in JavaFx. [#3082](https://github.com/JabRef/jabref/pull/3082)
- Integrity warnings are now directly displayed in the entry editor.

### Fixed
Expand All @@ -31,6 +32,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where changes in the source tab were not stored when selecting a new entry. [#3086](https://github.com/JabRef/jabref/issues/3086)
- We fixed an issue where the other tab was not updated when fields where changed in the source tab. [#3063](https://github.com/JabRef/jabref/issues/3063)
- We fixed an issue where the source tab was not updated after fetching data by DOI. [#3103](https://github.com/JabRef/jabref/issues/3103)

### Removed


Expand Down
19 changes: 14 additions & 5 deletions src/main/java/org/jabref/gui/AbstractView.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jabref.gui;

import java.util.Optional;
import java.util.function.Function;

import javafx.scene.Parent;
import javafx.stage.Stage;
Expand All @@ -10,8 +11,13 @@
import com.airhacks.afterburner.views.FXMLView;

public class AbstractView extends FXMLView {

public AbstractView() {
super();
this(f -> null);
}

public AbstractView(Function<String, Object> injectionContext) {
super(injectionContext);

// Set resource bundle to internal localizations
bundle = Localization.getMessages();
Expand All @@ -26,16 +32,19 @@ public Parent getView() {

// Notify controller about the stage, where it is displayed
view.sceneProperty().addListener((observable, oldValue, newValue) -> {
Stage stage = (Stage) newValue.getWindow();
if (stage != null) {
getController().ifPresent(controller -> controller.setStage(stage));

if (newValue.getWindow() instanceof Stage) {
Stage stage = (Stage) newValue.getWindow();
if (stage != null) {
getController().ifPresent(controller -> controller.setStage(stage));
}
}
});
return view;
}

private Optional<AbstractController> getController() {
return Optional.ofNullable(presenterProperty.get()).map(
presenter -> (AbstractController)presenter);
presenter -> (AbstractController) presenter);
}
}
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.OSXCompatibleToolbar;
import org.jabref.gui.actions.Actions;
import org.jabref.gui.entryeditor.fileannotationtab.FileAnnotationTab;
import org.jabref.gui.externalfiles.WriteXMPEntryEditorAction;
import org.jabref.gui.fieldeditors.FieldEditor;
import org.jabref.gui.fieldeditors.TextField;
Expand Down Expand Up @@ -329,7 +330,7 @@ private void addTabs(String lastTabName) {

// Special tabs
tabs.add(new MathSciNetTab(entry));
tabs.add(new FileAnnotationTab(entry, this, panel.getAnnotationCache()));
tabs.add(new FileAnnotationTab(panel.getAnnotationCache(), entry));
tabs.add(new RelatedArticlesTab(entry));

// Source tab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public abstract class EntryEditorTab extends Tab {
/**
* Used for lazy-loading of the tab content.
*/
private boolean isInitialized = false;
protected boolean isInitialized = false;

public abstract boolean shouldShow();

Expand Down
Loading

0 comments on commit 455965e

Please sign in to comment.