Class AddPageResources.ScriptResource
java.lang.Object
org.jgrapes.webconsole.base.events.AddPageResources.ScriptResource
- Enclosing class:
AddPageResources
Represents a script resource that is to be loaded or evaluated
by the browser.
Note that a single instance can either be used for a URI or inline JavaScript, not for both.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The Class Serializer. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the script id (defaults to no id).Gets the script type (defaults to no type).Loads the script source to evaluate.String[]
provides()
Returns the list of JavaScript features that this script resource provides.String[]
requires()
Returns the list of JavaScript features that this script resource requires.setProvides
(String... provides) Sets the list of JavaScript features that this script resource provides.setRequires
(String... requires) Sets the list of JavaScript features that this script resource requires.setScriptId
(String scriptId) Sets the script id.setScriptSource
(String scriptSource) Sets the script source to evaluate.setScriptType
(String scriptType) Sets the script type.setScriptUri
(URI scriptUri) Sets the scriptUri to to be loaded, clears thescriptSource
attribute.
-
Constructor Details
-
ScriptResource
public ScriptResource()
-
-
Method Details
-
scriptUri
- Returns:
- the scriptUri to be loaded
-
setScriptUri
Sets the scriptUri to to be loaded, clears thescriptSource
attribute.- Parameters:
scriptUri
- the scriptUri to to be loaded- Returns:
- this object for easy chaining
-
getScriptType
Gets the script type (defaults to no type).- Returns:
- the script type
-
setScriptType
Sets the script type.- Parameters:
scriptType
- the new script type- Returns:
- the script resource
-
getScriptId
Gets the script id (defaults to no id).- Returns:
- the script type
-
setScriptId
Sets the script id.- Parameters:
scriptId
- the script id- Returns:
- the script resource
-
scriptSource
- Returns:
- the script source
-
setScriptSource
Sets the script source to evaluate.Clears the
scriptUri
attribute.- Parameters:
scriptSource
- the scriptSource to set- Returns:
- this object for easy chaining
-
loadScriptSource
Loads the script source to evaluate.Clears the
scriptUri
attribute. Closes the reader.- Parameters:
in
- the input stream- Returns:
- this object for easy chaining
- Throws:
IOException
-
provides
Returns the list of JavaScript features that this script resource provides.- Returns:
- the list of features
-
setProvides
Sets the list of JavaScript features that this script resource provides.For commonly available JavaScript libraries, it is recommended to use their home page URL (without the protocol part) as feature name.
- Parameters:
provides
- the list of features- Returns:
- this object for easy chaining
-
requires
Returns the list of JavaScript features that this script resource requires.- Returns:
- the list of features
-
setRequires
Sets the list of JavaScript features that this script resource requires.- Parameters:
requires
- the list of features- Returns:
- this object for easy chaining
-