Verified Owner
Top Fields Constructors Methods
org.jabref.gui.fieldeditors

public Class LinkedFileViewModel

extends AbstractViewModel
Class Inheritance
Imports
java.io.IOException, java.nio.file.Files, .Path, java.util.ArrayList, .Arrays, .HashMap, .List, .Map, .Optional, java.util.function.BiPredicate, javafx.beans.Observable, javafx.beans.binding.Bindings, .ObjectBinding, javafx.beans.property.BooleanProperty, .DoubleProperty, .SimpleBooleanProperty, .SimpleDoubleProperty, .StringProperty, javafx.scene.Node, javafx.scene.control.Alert, .ButtonBar, .ButtonType, org.jabref.gui.AbstractViewModel, .DialogService, org.jabref.gui.desktop.os.NativeDesktop, org.jabref.gui.externalfiles.PdfMergeDialog, org.jabref.gui.externalfiletype.ExternalFileType, .ExternalFileTypes, org.jabref.gui.icon.IconTheme, .JabRefIcon, org.jabref.gui.linkedfile.DeleteFileAction, .DownloadLinkedFileAction, .LinkedFileEditDialog, org.jabref.gui.mergeentries.multiwaymerge.MultiMergeEntriesView, org.jabref.gui.preferences.GuiPreferences, org.jabref.gui.util.ControlHelper, org.jabref.logic.FilePreferences, org.jabref.logic.externalfiles.LinkedFileHandler, org.jabref.logic.l10n.Localization, org.jabref.logic.undo.UndoManager, org.jabref.logic.util.TaskExecutor, org.jabref.logic.util.io.FileNameUniqueness, .FileUtil, org.jabref.logic.util.strings.StringUtil, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, .LinkedFile, org.jabref.model.util.OptionalUtil, de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator, de.saxsys.mvvmfx.utils.validation.ValidationMessage, de.saxsys.mvvmfx.utils.validation.ValidationStatus, de.saxsys.mvvmfx.utils.validation.Validator, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private final BibDatabaseContext
private final DialogService
private final BooleanProperty
private final DoubleProperty
private final BibEntry
private final de.saxsys.mvvmfx.utils.validation.Validator
private final BooleanProperty
private final BooleanProperty
private final LinkedFile
private final LinkedFileHandler
private ObjectBinding<Node>
private static final Logger
private final GuiPreferences
private final TaskExecutor

Constructor Summary

AccessConstructor and Description
public
LinkedFileViewModel(LinkedFile linkedFile, BibEntry entry, BibDatabaseContext databaseContext, TaskExecutor taskExecutor, DialogService dialogService, GuiPreferences preferences)

Method Summary

Modifier and TypeMethod and Description
public void
public void
public boolean

Returns:

true if the linked file has been removed afterward from the entry (i.e., because it was deleted successfully, does not exist in the first place, or the user choose to remove it)
delete
()

Asks the user for confirmation that he really wants to the delete the file from disk (or just remove the link) and then proceeds accordingly.

public StringProperty
public void
download(boolean keepHtmlLink, UndoManager undoManager)

public void
download(boolean keepHtmlLink, Map<String, String> headers, UndoManager undoManager)

public BooleanProperty
public DoubleProperty
public void
edit()

public de.saxsys.mvvmfx.utils.validation.ValidationStatus
public Optional<Path>
findIn(List<Path> directories)

public static LinkedFileViewModel
fromLinkedFile(LinkedFile linkedFile, BibEntry entry, BibDatabaseContext databaseContext, TaskExecutor taskExecutor, DialogService dialogService, GuiPreferences preferences)

private Optional<Path>
public String
private DownloadLinkedFileAction
public LinkedFile
private Path
private Path
getFullDestinationDirectory(Path targetBaseDirectory)

Constructs the target directory by appending the directory pattern (if exists) to the given base directory.

public List<BibEntry>
public Observable[]
public JabRefIcon
public boolean
public BooleanProperty
public boolean

Returns:

true if the suggested filename is same as current filename.
isGeneratedNameSameAsOriginal
()

Gets the filename for the current linked file and compares it to the new suggested filename.

public boolean

Returns:

true if suggested filepath is same as existing filepath.
isGeneratedPathSameAsOriginal
()

Compares suggested directory of current linkedFile with existing filepath directory.

public boolean
isInCurrentDirectory(Path destinationDirectory)

Checks if the current linked file is already located in the target directory (considering also the directory pattern if exists).

public BooleanProperty
public StringProperty
public void
public void
moveToDirectory(Path destinationDirectory)

public void
moveToDirectoryAndRename(Path destinationDirectory)

public void
open()

public void
public void
private void
public void
redownload(UndoManager undoManager)

public void
renameFileToName(String targetFileName)

public void
public ObjectBinding<Node>

Field Detail

databaseContextback to summary
private final BibDatabaseContext databaseContext
dialogServiceback to summary
private final DialogService dialogService
downloadOngoingback to summary
private final BooleanProperty downloadOngoing
downloadProgressback to summary
private final DoubleProperty downloadProgress
entryback to summary
private final BibEntry entry
fileExistsValidatorback to summary
private final de.saxsys.mvvmfx.utils.validation.Validator fileExistsValidator
isAutomaticallyFoundback to summary
private final BooleanProperty isAutomaticallyFound
isOfflinePdfback to summary
private final BooleanProperty isOfflinePdf
linkedFileback to summary
private final LinkedFile linkedFile
linkedFileHandlerback to summary
private final LinkedFileHandler linkedFileHandler
linkedFileIconBindingback to summary
private ObjectBinding<Node> linkedFileIconBinding
LOGGERback to summary
private static final Logger LOGGER
preferencesback to summary
private final GuiPreferences preferences
taskExecutorback to summary
private final TaskExecutor taskExecutor

Constructor Detail

LinkedFileViewModelback to summary
public LinkedFileViewModel(LinkedFile linkedFile, BibEntry entry, BibDatabaseContext databaseContext, TaskExecutor taskExecutor, DialogService dialogService, GuiPreferences preferences)

Method Detail

acceptAsLinkedback to summary
public void acceptAsLinked()
askForNameAndRenameback to summary
public void askForNameAndRename()
deleteback to summary
public boolean delete()

Asks the user for confirmation that he really wants to the delete the file from disk (or just remove the link) and then proceeds accordingly.

Returns:boolean

true if the linked file has been removed afterward from the entry (i.e., because it was deleted successfully, does not exist in the first place, or the user choose to remove it)

descriptionPropertyback to summary
public StringProperty descriptionProperty()
downloadback to summary
public void download(boolean keepHtmlLink, UndoManager undoManager)
downloadback to summary
public void download(boolean keepHtmlLink, Map<String, String> headers, UndoManager undoManager)
downloadOngoingPropertyback to summary
public BooleanProperty downloadOngoingProperty()
downloadProgressPropertyback to summary
public DoubleProperty downloadProgressProperty()
editback to summary
public void edit()
fileExistsValidationStatusback to summary
public de.saxsys.mvvmfx.utils.validation.ValidationStatus fileExistsValidationStatus()
findInback to summary
public Optional<Path> findIn(List<Path> directories)
fromLinkedFileback to summary
public static LinkedFileViewModel fromLinkedFile(LinkedFile linkedFile, BibEntry entry, BibDatabaseContext databaseContext, TaskExecutor taskExecutor, DialogService dialogService, GuiPreferences preferences)
getCurrentFileDirectoryback to summary
private Optional<Path> getCurrentFileDirectory()
getDescriptionback to summary
public String getDescription()
getDownloadLinkedFileActionback to summary
private DownloadLinkedFileAction getDownloadLinkedFileAction(UndoManager undoManager)
getFileback to summary
public LinkedFile getFile()
getFileDirectoryPatternback to summary
private Path getFileDirectoryPattern()
getFullDestinationDirectoryback to summary
private Path getFullDestinationDirectory(Path targetBaseDirectory)

Constructs the target directory by appending the directory pattern (if exists) to the given base directory.

getLinkedEntriesback to summary
public List<BibEntry> getLinkedEntries()
getObservablesback to summary
public Observable[] getObservables()
getTypeIconback to summary
public JabRefIcon getTypeIcon()
isAutomaticallyFoundback to summary
public boolean isAutomaticallyFound()
isAutomaticallyFoundPropertyback to summary
public BooleanProperty isAutomaticallyFoundProperty()
isGeneratedNameSameAsOriginalback to summary
public boolean isGeneratedNameSameAsOriginal()

Gets the filename for the current linked file and compares it to the new suggested filename.

Returns:boolean

true if the suggested filename is same as current filename.

isGeneratedPathSameAsOriginalback to summary
public boolean isGeneratedPathSameAsOriginal()

Compares suggested directory of current linkedFile with existing filepath directory.

Returns:boolean

true if suggested filepath is same as existing filepath.

isInCurrentDirectoryback to summary
public boolean isInCurrentDirectory(Path destinationDirectory)

Checks if the current linked file is already located in the target directory (considering also the directory pattern if exists).

isOfflinePdfPropertyback to summary
public BooleanProperty isOfflinePdfProperty()
linkPropertyback to summary
public StringProperty linkProperty()
markAsAutomaticallyFoundback to summary
public void markAsAutomaticallyFound()
moveToDirectoryback to summary
public void moveToDirectory(Path destinationDirectory)
moveToDirectoryAndRenameback to summary
public void moveToDirectoryAndRename(Path destinationDirectory)
openback to summary
public void open()
openFolderback to summary
public void openFolder()
parsePdfMetadataAndShowMergeDialogback to summary
public void parsePdfMetadataAndShowMergeDialog()
performRenameWithConflictCheckback to summary
private void performRenameWithConflictCheck(String targetFileName)
redownloadback to summary
public void redownload(UndoManager undoManager)
renameFileToNameback to summary
public void renameFileToName(String targetFileName)
renameToSuggestionback to summary
public void renameToSuggestion()
typeIconPropertyback to summary
public ObjectBinding<Node> typeIconProperty()