Class AddPageResources.ScriptResource

java.lang.Object
org.jgrapes.webconsole.base.events.AddPageResources.ScriptResource
Enclosing class:
AddPageResources

public static class AddPageResources.ScriptResource extends Object
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.

  • Constructor Details

  • Method Details

    • scriptUri

      public URI scriptUri()
      Returns:
      the scriptUri to be loaded
    • setScriptUri

      Sets the scriptUri to to be loaded, clears the scriptSource 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

      public String 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

      public String 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

      public String[] 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

      public String[] 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