Package com.vaadin.flow.shared.ui
Class Dependency
java.lang.Object
com.vaadin.flow.shared.ui.Dependency
- All Implemented Interfaces:
Serializable
Represents an html import, stylesheet or JavaScript to include on the page.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDependency(JsFunction dynamicImport) Creates a newDependency.Type.DYNAMIC_IMPORTdependency, loaded by calling the given function, which is supposed to return aPromise.Dependency(Dependency.Type type, String expression) Creates a new dependency of the given type, to be loaded using JS expression which is supposed to return aPromise.Dependency(Dependency.Type type, String url, LoadMode loadMode) Creates a new dependency of the given type, to be loaded from the given URL.Dependency(Dependency.Type type, String url, LoadMode loadMode, String id) Creates a new dependency of the given type, to be loaded from the given URL with an optional ID for tracking.Dependency(Dependency.Type type, String url, LoadMode loadMode, String id, String layer) Creates a new dependency of the given type, to be loaded from the given URL into the given CSS cascade layer, with an optional ID for tracking. -
Method Summary
Modifier and TypeMethodDescriptionbooleantools.jackson.databind.JsonNodeGets the function that loads aDependency.Type.DYNAMIC_IMPORTdependency created withDependency(JsFunction), as the JSON it is sent to the browser as.getId()Gets the ID associated with this dependency.getLayer()Gets the CSS cascade layer the style sheet is loaded into.Gets load mode that will be used for dependency loading.getType()Gets the type of the dependency.getUrl()Gets the untranslated URL for the dependency.inthashCode()toString()
-
Field Details
-
KEY_URL
- See Also:
-
KEY_TYPE
- See Also:
-
KEY_LOAD_MODE
- See Also:
-
KEY_CONTENTS
- See Also:
-
KEY_ID
- See Also:
-
KEY_LAYER
- See Also:
-
-
Constructor Details
-
Dependency
Creates a newDependency.Type.DYNAMIC_IMPORTdependency, loaded by calling the given function, which is supposed to return aPromise.The created instance dependency mode is
LoadMode.LAZY. Its URL is the JSON the function is sent to the browser as, which tells apart dependencies that load different things, and which a copy made from the type and the URL keeps.For internal use only. May be renamed or removed in a future release.
- Parameters:
dynamicImport- the function that loads the dependency, notnull- Throws:
IllegalArgumentException- if the function captures an element or a component, attached or not, directly or in a collection, a map, an array or a captured function or other snippet, or an attached one in a bean property: the browser loads dependencies before it applies the changes of the same round trip, and a detached element cannot be referenced- Since:
- 25.4
-
Method Details
-
getUrl
Gets the untranslated URL for the dependency.- Returns:
- the URL for the dependency
-
getType
Gets the type of the dependency.- Returns:
- the type of the dependency
-
getLoadMode
Gets load mode that will be used for dependency loading. Refer toLoadModefor details.- Returns:
- the load mode that will be used during dependency loading
-
getId
Gets the ID associated with this dependency.For internal use only. May be renamed or removed in a future release.
- Returns:
- the dependency ID or null if not set
- Since:
- 25.0
-
getLayer
Gets the CSS cascade layer the style sheet is loaded into.For internal use only. May be renamed or removed in a future release.
- Returns:
- the layer name or null if the dependency does not use a layer
- Since:
- 25.4
-
getEncodedDynamicImport
public tools.jackson.databind.JsonNode getEncodedDynamicImport()Gets the function that loads aDependency.Type.DYNAMIC_IMPORTdependency created withDependency(JsFunction), as the JSON it is sent to the browser as.For internal use only. May be renamed or removed in a future release.
- Returns:
- the encoded function, or
nullfor a dependency that is loaded from its URL or a JavaScript expression - Since:
- 25.4
-
hashCode
public int hashCode() -
equals
-
toString
-