Top Description Inners Fields Constructors Methods
org.jabref.logic.util

public Class WebViewStore

extends Object
Class Inheritance
Imports
java.util.ArrayDeque, .Queue, javafx.application.Platform, javafx.scene.web.WebView, org.slf4j.Logger, .LoggerFactory

A dynamic web view store. This is used primarily to prevent UI freezes while constructing web view instances.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record

Field Summary

Modifier and TypeField and Description
private static WebViewStore.Configuration
private static boolean
private static final Logger
private static final Queue<WebView>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
public static WebView

Returns:

WebView instance
get
()

Returns a preloaded web view instance if available; And it will create a new one if not.

public static boolean

Returns:

true if the store has at least one web view instance available; false otherwise
hasMore
()

public static void
init(WebViewStore.Configuration config)

Initialize WebViewStore and preload web view instances.

public static void
init()

Initialize WebViewStore and preload web view instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configback to summary
private static WebViewStore.Configuration config
isInitializedback to summary
private static boolean isInitialized
LOGGERback to summary
private static final Logger LOGGER
WEB_VIEWSback to summary
private static final Queue<WebView> WEB_VIEWS

Constructor Detail

WebViewStoreback to summary
public WebViewStore()

Method Detail

addWebViewLaterback to summary
private static void addWebViewLater()
getback to summary
public static WebView get()

Returns a preloaded web view instance if available; And it will create a new one if not.

Returns:WebView

WebView instance

Exceptions
IllegalStateException:
if the webViewStore has not been initialized
hasMoreback to summary
public static boolean hasMore()
Returns:boolean

true if the store has at least one web view instance available; false otherwise

initback to summary
public static void init(WebViewStore.Configuration config)

Initialize WebViewStore and preload web view instances.

Note that this method must be called at application startup.

initback to summary
public static void init()

Initialize WebViewStore and preload web view instance.

Note that this method must be called at application startup.

org.jabref.logic.util back to summary

public final Record WebViewStore.Configuration

extends Record
Class Inheritance
Record Components
numberOfPreloadedInstances:int 
minimumNumberOfInstances:int 

Field Summary

Modifier and TypeField and Description
private final int
private final int

Constructor Summary

AccessConstructor and Description
public
Configuration(int numberOfPreloadedInstances, int minimumNumberOfInstances)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object
the reference object with which to compare.
o
)

Implements abstract java.lang.Record.equals.

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

public int

Returns:

The minimum number of web views the store can reach. The store needs to load more instances once it reaches this threshold
getMinimumNumberOfInstances
()

public int

Returns:

The number of web view instances to be loaded at application startup
getNumberOfPreloadedInstances
()

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public int
public int
public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

minimumNumberOfInstancesback to summary
private final int minimumNumberOfInstances

Record Component accessed by minimumNumberOfInstances().

numberOfPreloadedInstancesback to summary
private final int numberOfPreloadedInstances

Record Component accessed by numberOfPreloadedInstances().

Constructor Detail

Configurationback to summary
public Configuration(int numberOfPreloadedInstances, int minimumNumberOfInstances)

Method Detail

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).
Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this record is equal to the argument; false otherwise.

getMinimumNumberOfInstancesback to summary
public int getMinimumNumberOfInstances()
Returns:int

The minimum number of web views the store can reach. The store needs to load more instances once it reaches this threshold

getNumberOfPreloadedInstancesback to summary
public int getNumberOfPreloadedInstances()
Returns:int

The number of web view instances to be loaded at application startup

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.

Returns:int

a hash code value for this record.

minimumNumberOfInstancesback to summary
public int minimumNumberOfInstances()

Record Component getter of minimumNumberOfInstances.

numberOfPreloadedInstancesback to summary
public int numberOfPreloadedInstances()

Record Component getter of numberOfPreloadedInstances.

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.

Returns:String

a string representation of the object.