Top Fields Constructors Methods
org.jabref.gui.theme

pack-priv final Class StyleSheetFile

extends StyleSheet
Class Inheritance
Imports
java.io.IOException, .InputStream, java.net.URI, .URL, .URLConnection, java.nio.file.Files, .Path, java.util.Base64, .Optional, java.util.concurrent.atomic.AtomicReference, com.google.common.base.Strings, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private final AtomicReference<String>
private static final Logger
pack-priv static final int
MAX_IN_MEMORY_CSS_LENGTH

A size limit above which Theme will not attempt to keep a data-embedded URL in memory for the CSS.

private final Path
private final URL
Inherited from org.jabref.gui.theme.StyleSheet:
DATA_URL_PREFIXEMPTY_WEBENGINE_CSS

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static Optional<String>
public URL
pack-priv Path
public String

Returns:

the stylesheet location if there is an additional stylesheet present and available. The location will be a local URL. Typically it will be a 'data:' URL where the CSS is embedded. However for large themes it can be 'file:'.
getWebEngineStylesheet
()

Implements abstract org.jabref.gui.theme.StyleSheet.getWebEngineStylesheet.

This method allows callers to obtain the theme's additional stylesheet.

pack-priv void
public String
toString()

Overrides org.jabref.gui.theme.StyleSheet.toString.

Returns a string representation of the object.

Inherited from org.jabref.gui.theme.StyleSheet:
create

Field Detail

dataUrlback to summary
private final AtomicReference<String> dataUrl
LOGGERback to summary
private static final Logger LOGGER

Hides org.jabref.gui.theme.StyleSheet.LOGGER.

MAX_IN_MEMORY_CSS_LENGTHback to summary
pack-priv static final int MAX_IN_MEMORY_CSS_LENGTH

A size limit above which Theme will not attempt to keep a data-embedded URL in memory for the CSS. It's tolerable for CSS to exceed this limit; the functional benefit of the encoded CSS is in some edge case error handling. Specifically, having a reference to a data-embedded URL means that the Preview Viewer isn't impacted if the source CSS file is removed while the application is running. If the CSS is over this limit, then the user won't see any functional impact, as long as the file exists. Only if it becomes unavailable, might there be some impact. First, the Preview Viewer when created might not be themed. Second, there is a very small chance of uncaught exceptions. Theme makes a best effort to avoid this: it checks for CSS file existence before passing it to the Preview Viewer for theming. Still, as file existence checks are immediately out of date, it can't be perfectly ruled out. At the time of writing this comment:

  • src/main/java/org/jabref/gui/Base.css is 33k
  • src/main/java/org/jabref/gui/Dark.css is 4k
  • The dark custom theme in the Jabref documentation is 2k, see Custom themes
So realistic custom themes will fit comfortably within 48k, even if they are modified copies of the base theme. Note that Base-64 encoding will increase the memory footprint of the URL by a third.
pathback to summary
private final Path path
urlback to summary
private final URL url

Constructor Detail

StyleSheetFileback to summary
pack-priv StyleSheetFile(URL url)

Method Detail

getDataUrlback to summary
pack-priv static Optional<String> getDataUrl(URL url)
getSceneStylesheetback to summary
public URL getSceneStylesheet()

Implements abstract org.jabref.gui.theme.StyleSheet.getSceneStylesheet.

Annotations
@Override
getWatchPathback to summary
pack-priv Path getWatchPath()

Overrides org.jabref.gui.theme.StyleSheet.getWatchPath.

Annotations
@Override
getWebEngineStylesheetback to summary
public String getWebEngineStylesheet()

Implements abstract org.jabref.gui.theme.StyleSheet.getWebEngineStylesheet.

This method allows callers to obtain the theme's additional stylesheet.

Returns:String

the stylesheet location if there is an additional stylesheet present and available. The location will be a local URL. Typically it will be a 'data:' URL where the CSS is embedded. However for large themes it can be 'file:'.

Annotations
@Override
reloadback to summary
pack-priv void reload()

Implements abstract org.jabref.gui.theme.StyleSheet.reload.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.jabref.gui.theme.StyleSheet.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override