Package org.apache.batik.bridge
Class BaseScriptingEnvironment
java.lang.Object
org.apache.batik.bridge.BaseScriptingEnvironment
- Direct Known Subclasses:
ScriptingEnvironment
This class is the base class for SVG scripting.
- Version:
- $Id: BaseScriptingEnvironment.java 1851346 2019-01-15 13:41:00Z ssteiner $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
Represents the window object of this environment. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected static final String
The 'application/ecmascript' MIME type.protected BridgeContext
The bridge context.protected ParsedURL
The URL of the document ot manageprotected Document
The document to manage.protected static final String
static final String
Constant used to describe inline scripts.protected WeakHashMap
Set of <script> elements that have already been executed.static final String
Constant used to describe inline scripts.protected Interpreter
The default Interpreter for the documentprotected Set
protected UserAgent
The user-agent.protected Map
Map ofInterpreter
toWindow
objects. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new BaseScriptingEnvironment. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkCompatibleScriptURL
(String scriptType, ParsedURL scriptPURL) Checks that the script URLs and the document url are compatible.protected Window
createWindow
(Interpreter interp, String lang) Creates a new Window object.protected void
dispatchSVGDocEvent
(String eventType) protected void
dispatchSVGLoad
(Element elt, boolean checkCanRun, String lang) Auxiliary method for dispatchSVGLoad.void
Recursively dispatch the SVG 'onload' event.protected void
Method to dispatch SVG Resize event.protected void
Method to dispatch SVG Scroll event.protected void
Method to dispatch SVG Zoom event.Returns the default Interpreter for this document.getInterpreter
(String lang) Returns the Window object for scripting languages that have noInterpreter
object.getWindow
(Interpreter interp, String lang) Returns the Window object for the specifiedInterpreter
.protected void
Handles the given exception.protected void
Handles the given exception.void
initializeEnvironment
(Interpreter interp, String lang) Initializes the environment of the given interpreter.static boolean
isDynamicDocument
(BridgeContext ctx, Document doc) Tells whether the given SVG document is dynamic.static boolean
isDynamicElement
(BridgeContext ctx, Element elt) static boolean
isDynamicElement
(Element elt, BridgeContext ctx, List bridgeExtensions) Tells whether the given SVG element is dynamic.protected void
loadScript
(AbstractElement script) Executes the specified <script> element, if it hasn't been executed already.void
Loads the scripts contained in the <script> elements.
-
Field Details
-
INLINE_SCRIPT_DESCRIPTION
Constant used to describe inline scripts.{0} - URL of document containing script. {1} - Element tag {2} - line number of element.
- See Also:
-
EVENT_SCRIPT_DESCRIPTION
Constant used to describe inline scripts.{0} - URL of document containing script. {1} - Event attribute name {2} - line number of element.
- See Also:
-
EVENT_NAME
- See Also:
-
ALTERNATE_EVENT_NAME
- See Also:
-
APPLICATION_ECMASCRIPT
The 'application/ecmascript' MIME type.- See Also:
-
bridgeContext
The bridge context. -
userAgent
The user-agent. -
document
The document to manage. -
docPURL
The URL of the document ot manage -
languages
-
interpreter
The default Interpreter for the document -
windowObjects
Map ofInterpreter
toWindow
objects. -
executedScripts
Set of <script> elements that have already been executed.
-
-
Constructor Details
-
BaseScriptingEnvironment
Creates a new BaseScriptingEnvironment.- Parameters:
ctx
- the bridge context
-
-
Method Details
-
isDynamicDocument
Tells whether the given SVG document is dynamic. -
isDynamicElement
-
isDynamicElement
Tells whether the given SVG element is dynamic. -
getWindow
Returns the Window object for the specifiedInterpreter
. -
getWindow
Returns the Window object for scripting languages that have noInterpreter
object. -
createWindow
Creates a new Window object. -
getInterpreter
Returns the default Interpreter for this document. -
getInterpreter
-
initializeEnvironment
Initializes the environment of the given interpreter. -
loadScripts
public void loadScripts()Loads the scripts contained in the <script> elements. -
loadScript
Executes the specified <script> element, if it hasn't been executed already. -
checkCompatibleScriptURL
Checks that the script URLs and the document url are compatible. A SecurityException is thrown if loading the script is not allowed. -
dispatchSVGLoadEvent
public void dispatchSVGLoadEvent()Recursively dispatch the SVG 'onload' event. -
dispatchSVGLoad
Auxiliary method for dispatchSVGLoad. -
dispatchSVGZoomEvent
protected void dispatchSVGZoomEvent()Method to dispatch SVG Zoom event. -
dispatchSVGScrollEvent
protected void dispatchSVGScrollEvent()Method to dispatch SVG Scroll event. -
dispatchSVGResizeEvent
protected void dispatchSVGResizeEvent()Method to dispatch SVG Resize event. -
dispatchSVGDocEvent
-
handleInterpreterException
Handles the given exception. -
handleSecurityException
Handles the given exception.
-