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

public Class ClipBoardManager

extends Object
Class Inheritance
Annotations
@org.jabref.architecture.AllowedToUseAwt
Imports
java.awt.Toolkit, java.awt.datatransfer.DataFlavor, .StringSelection, .Transferable, .UnsupportedFlavorException, java.io.IOException, java.util.List, .Optional, javafx.application.Platform, javafx.scene.control.TextInputControl, javafx.scene.input.Clipboard, .ClipboardContent, .DataFormat, .MouseButton, org.jabref.architecture.AllowedToUseAwt, org.jabref.gui.StateManager, org.jabref.logic.bibtex.BibEntryWriter, .FieldWriter, org.jabref.logic.importer.util.MediaTypes, org.jabref.logic.os.OS, org.jabref.logic.preferences.CliPreferences, org.jabref.model.TransferInformation, .TransferMode, org.jabref.model.database.BibDatabaseContext, .BibDatabaseMode, org.jabref.model.entry.BibEntry, .BibEntryTypesManager, .BibtexString, com.airhacks.afterburner.injection.Injector, org.jspecify.annotations.Nullable, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private static Clipboard
private static final DataFormat
private static final Logger
private static Clipboard
private final StateManager

Constructor Summary

AccessConstructor and Description
public
public
ClipBoardManager(StateManager stateManager, Clipboard clipboard, Clipboard primary)

Method Summary

Modifier and TypeMethod and Description
public static void
addX11Support(TextInputControl
the TextInputControl (e.g., TextField, TextArea, and children) where adding this functionality.
input
)

Add X11 clipboard support to a text input control.

public static String

Returns:

any text found on the Clipboard; if none found, return an empty String.
getContents
()

Get the String residing on the system clipboard.

public static String

Returns:

any text found on the primary Clipboard; if none found, try with the system clipboard.
getContentsPrimary
()

Get the String residing on the primary clipboard (if it exists).

public static String
public Optional<TransferInformation>
public static boolean
private String
serializeEntries(List<BibEntry> entries, BibEntryTypesManager entryTypesManager)

public void
setContent(ClipboardContent
the ClipboardContent to set as current value of the system clipboard.
content
)

Puts content onto the system clipboard.

public void
private void
setContent(String string, @Nullable JabRefClipboardData jabRefClipboardData)

public void
setContent(TransferMode transferMode, BibDatabaseContext bibDatabaseContext, List<BibEntry> entries, BibEntryTypesManager entryTypesManager, List<BibtexString> stringConstants)

public void
setHtmlContent(String html, String fallbackPlain)

public void
setPrimaryClipboardContent(ClipboardContent
the ClipboardContent to set as current value of the primary clipboard.
content
)

Puts content onto the primary clipboard (if it exists).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clipboardback to summary
private static Clipboard clipboard
DATAFORMAT_JABREF_DATAback to summary
private static final DataFormat DATAFORMAT_JABREF_DATA
LOGGERback to summary
private static final Logger LOGGER
primaryback to summary
private static Clipboard primary
stateManagerback to summary
private final StateManager stateManager

Constructor Detail

ClipBoardManagerback to summary
public ClipBoardManager(StateManager stateManager)
ClipBoardManagerback to summary
public ClipBoardManager(StateManager stateManager, Clipboard clipboard, Clipboard primary)

Method Detail

addX11Supportback to summary
public static void addX11Support(TextInputControl input)

Add X11 clipboard support to a text input control. It is necessary to call this method in every input where you want to use it: ClipBoardManager.addX11Support(TextInputControl input);.

Parameters
input:TextInputControl

the TextInputControl (e.g., TextField, TextArea, and children) where adding this functionality.

See Also
Short summary for X11 clipboards, Longer text over clipboards
getContentsback to summary
public static String getContents()

Get the String residing on the system clipboard.

Returns:String

any text found on the Clipboard; if none found, return an empty String.

getContentsPrimaryback to summary
public static String getContentsPrimary()

Get the String residing on the primary clipboard (if it exists).

Returns:String

any text found on the primary Clipboard; if none found, try with the system clipboard.

getHtmlContentsback to summary
public static String getHtmlContents()
getJabRefClipboardTransferDataback to summary
public Optional<TransferInformation> getJabRefClipboardTransferData()
hasHtmlback to summary
public static boolean hasHtml()
serializeEntriesback to summary
private String serializeEntries(List<BibEntry> entries, BibEntryTypesManager entryTypesManager) throws IOException
setContentback to summary
public void setContent(ClipboardContent content)

Puts content onto the system clipboard.

Parameters
content:ClipboardContent

the ClipboardContent to set as current value of the system clipboard.

setContentback to summary
public void setContent(String string)
setContentback to summary
private void setContent(String string, @Nullable JabRefClipboardData jabRefClipboardData)
setContentback to summary
public void setContent(TransferMode transferMode, BibDatabaseContext bibDatabaseContext, List<BibEntry> entries, BibEntryTypesManager entryTypesManager, List<BibtexString> stringConstants) throws IOException
setHtmlContentback to summary
public void setHtmlContent(String html, String fallbackPlain)
setPrimaryClipboardContentback to summary
public void setPrimaryClipboardContent(ClipboardContent content)

Puts content onto the primary clipboard (if it exists).

Parameters
content:ClipboardContent

the ClipboardContent to set as current value of the primary clipboard.