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

public final Record ClipboardContentGenerator

extends Record
Class Inheritance
Record Components
previewPreferences:PreviewPreferences 
layoutFormatterPreferences:LayoutFormatterPreferences 
abbreviationRepository:JournalAbbreviationRepository 
Imports
java.io.IOException, .Reader, java.util.ArrayList, .List, .Optional, javafx.scene.input.ClipboardContent, org.jabref.logic.citationstyle.CitationStyleGenerator, .CitationStyleOutputFormat, org.jabref.logic.journals.JournalAbbreviationRepository, org.jabref.logic.layout.Layout, .LayoutFormatterPreferences, .LayoutHelper, org.jabref.logic.os.OS, org.jabref.logic.preview.CitationStylePreviewLayout, .PreviewLayout, .TextBasedPreviewLayout, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, .BibEntryTypesManager, com.airhacks.afterburner.injection.Injector, com.google.common.annotations.VisibleForTesting

Field Summary

Modifier and TypeField and Description
private final JournalAbbreviationRepository
abbreviationRepository

Record Component accessed by abbreviationRepository().

private final LayoutFormatterPreferences
private final PreviewPreferences
previewPreferences

Record Component accessed by previewPreferences().

Constructor Summary

AccessConstructor and Description
public
ClipboardContentGenerator(PreviewPreferences previewPreferences, LayoutFormatterPreferences layoutFormatterPreferences, JournalAbbreviationRepository abbreviationRepository)

Method Summary

Modifier and TypeMethod and Description
public JournalAbbreviationRepository
abbreviationRepository()

Record Component getter of abbreviationRepository.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public ClipboardContent
generate(List<BibEntry> selectedEntries, CitationStyleOutputFormat outputFormat, BibDatabaseContext bibDatabaseContext)

private List<String>
generateCitations(List<BibEntry> selectedEntries, CitationStyleOutputFormat outputFormat, BibDatabaseContext bibDatabaseContext)

private List<String>
public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public LayoutFormatterPreferences
public PreviewPreferences
previewPreferences()

Record Component getter of previewPreferences.

pack-priv static ClipboardContent
processHtml(List<String> citations)

Inserts each citation into a HTML body and copies it to the clipboard.

pack-priv static ClipboardContent

Returns:

clipboard content containing the Markdown representation in its plain string flavor
processMarkdown
(List<String>
the list of already-formatted citation strings to be combined as Markdown
citations
)

Joins each citation using the platform-specific newline into a single Markdown string (from citeproc) and copies it to the clipboard.

pack-priv static ClipboardContent
processPreview(List<String> citations)

Generates a plain text string out of the preview (based on TextBasedPreviewLayout or org.jabref.logic.preview.BstPreviewLayout) and copies it additionally to the html to the clipboard (WYSIWYG Editors use the HTML, plain text editors the text)

pack-priv static ClipboardContent
processText(List<String> citations)

Joins every citation with a newline and returns it.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

abbreviationRepositoryback to summary
private final JournalAbbreviationRepository abbreviationRepository

Record Component accessed by abbreviationRepository().

layoutFormatterPreferencesback to summary
private final LayoutFormatterPreferences layoutFormatterPreferences

Record Component accessed by layoutFormatterPreferences().

previewPreferencesback to summary
private final PreviewPreferences previewPreferences

Record Component accessed by previewPreferences().

Constructor Detail

ClipboardContentGeneratorback to summary
public ClipboardContentGenerator(PreviewPreferences previewPreferences, LayoutFormatterPreferences layoutFormatterPreferences, JournalAbbreviationRepository abbreviationRepository)

Method Detail

abbreviationRepositoryback to summary
public JournalAbbreviationRepository abbreviationRepository()

Record Component getter of abbreviationRepository.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
generateback to summary
public ClipboardContent generate(List<BibEntry> selectedEntries, CitationStyleOutputFormat outputFormat, BibDatabaseContext bibDatabaseContext) throws IOException
generateCitationsback to summary
private List<String> generateCitations(List<BibEntry> selectedEntries, CitationStyleOutputFormat outputFormat, BibDatabaseContext bibDatabaseContext) throws IOException
generateTextBasedPreviewLayoutCitationsback to summary
private List<String> generateTextBasedPreviewLayoutCitations(List<BibEntry> selectedEntries, BibDatabaseContext bibDatabaseContext) throws IOException
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

layoutFormatterPreferencesback to summary
public LayoutFormatterPreferences layoutFormatterPreferences()

Record Component getter of layoutFormatterPreferences.

previewPreferencesback to summary
public PreviewPreferences previewPreferences()

Record Component getter of previewPreferences.

processHtmlback to summary
pack-priv static ClipboardContent processHtml(List<String> citations)

Inserts each citation into a HTML body and copies it to the clipboard. The given preview is based on CitationStylePreviewLayout.

Annotations
@VisibleForTesting
processMarkdownback to summary
pack-priv static ClipboardContent processMarkdown(List<String> citations)

Joins each citation using the platform-specific newline into a single Markdown string (from citeproc) and copies it to the clipboard.

A trailing newline is appended if missing to keep the behavior consistent with other output formats and to satisfy tests expecting a newline-terminated string.

Parameters
citations:List<String>

the list of already-formatted citation strings to be combined as Markdown

Returns:ClipboardContent

clipboard content containing the Markdown representation in its plain string flavor

Annotations
@VisibleForTesting
processPreviewback to summary
pack-priv static ClipboardContent processPreview(List<String> citations)

Generates a plain text string out of the preview (based on TextBasedPreviewLayout or org.jabref.logic.preview.BstPreviewLayout) and copies it additionally to the html to the clipboard (WYSIWYG Editors use the HTML, plain text editors the text)

Annotations
@VisibleForTesting
processTextback to summary
pack-priv static ClipboardContent processText(List<String> citations)

Joins every citation with a newline and returns it.

Annotations
@VisibleForTesting
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.