Package g3.project.core
Class Tool
- java.lang.Object
-
- nu.xom.Node
-
- nu.xom.ParentNode
-
- nu.xom.Element
-
- g3.project.core.Tool
-
- All Implemented Interfaces:
Scriptable
public class Tool extends nu.xom.Element implements Scriptable
- Author:
- Group 3
-
-
Field Summary
Fields Modifier and Type Field Description protected RecursiveBindings
elementScriptBindings
My script bindings.protected java.lang.Boolean
evalRequired
Is Eval Required.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addScriptFile(java.nio.file.Path path, java.lang.String language)
Do not support modifying tools file on the fly.java.lang.Boolean
bubbleEvents()
Get if events are allowed to bubble up.java.lang.Boolean
getEvalRequired()
Evaluate only at load.java.lang.String
getID()
Get tool ID.java.util.Optional<java.lang.String>
getImagePath()
Get the path to the associated image.java.lang.String
getName()
Get tool name.java.util.Optional<RecursiveBindings>
getParentElementScriptingBindings()
Return the Global bindings.java.util.Optional<Scriptable>
getParentScriptable()
Get the parent of this Scriptable element.java.lang.String
getRealType()
Return the type of the element.java.util.Optional<ScriptElement>
getScriptEl()
Get the ScriptElement attached to this object.RecursiveBindings
getScriptingBindings()
Get the local scope for this object.void
setEvalRequired(java.lang.Boolean req)
Set if I should be re-evaluated.java.lang.Boolean
sinkEvents()
Get whether this tool sinks all events, or is pass-through.-
Methods inherited from class nu.xom.Element
addAttribute, addNamespaceDeclaration, appendChild, copy, getAttribute, getAttribute, getAttribute, getAttributeCount, getAttributeValue, getAttributeValue, getBaseURI, getChildElements, getChildElements, getChildElements, getFirstChildElement, getFirstChildElement, getLocalName, getNamespaceDeclarationCount, getNamespacePrefix, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getQualifiedName, getValue, insertChild, removeAttribute, removeChildren, removeNamespaceDeclaration, setBaseURI, setLocalName, setNamespacePrefix, setNamespaceURI, shallowCopy, toString, toXML
-
Methods inherited from class nu.xom.ParentNode
appendChild, getChild, getChildCount, indexOf, insertChild, removeChild, removeChild, replaceChild
-
-
-
-
Field Detail
-
evalRequired
protected java.lang.Boolean evalRequired
Is Eval Required.
-
elementScriptBindings
protected RecursiveBindings elementScriptBindings
My script bindings.
-
-
Constructor Detail
-
Tool
public Tool(java.lang.String name)
Constructor.- Parameters:
name
- Tool name.
-
Tool
public Tool(java.lang.String name, java.lang.String uri)
Constructor.- Parameters:
name
- Tool name.uri
- Tool URI.
-
Tool
public Tool(nu.xom.Element element)
Constructor.- Parameters:
element
- Tool Element.
-
-
Method Detail
-
getName
public final java.lang.String getName()
Get tool name.- Returns:
- Tool name string.
-
getID
public final java.lang.String getID()
Get tool ID.- Returns:
- Tool ID string.
-
getImagePath
public final java.util.Optional<java.lang.String> getImagePath()
Get the path to the associated image.- Returns:
- Maybe path.
-
sinkEvents
public final java.lang.Boolean sinkEvents()
Get whether this tool sinks all events, or is pass-through.- Returns:
- Is sink?
-
bubbleEvents
public final java.lang.Boolean bubbleEvents()
Get if events are allowed to bubble up.- Returns:
- Bubble?
-
getScriptingBindings
public final RecursiveBindings getScriptingBindings()
Get the local scope for this object.- Specified by:
getScriptingBindings
in interfaceScriptable
- Returns:
- my Bindings.
-
getParentElementScriptingBindings
public final java.util.Optional<RecursiveBindings> getParentElementScriptingBindings()
Return the Global bindings.- Specified by:
getParentElementScriptingBindings
in interfaceScriptable
- Returns:
- Optional Bindings
-
getScriptEl
public final java.util.Optional<ScriptElement> getScriptEl()
Get the ScriptElement attached to this object. There should only be one element.- Specified by:
getScriptEl
in interfaceScriptable
- Returns:
- my (first) script element.
-
getRealType
public final java.lang.String getRealType()
Description copied from interface:Scriptable
Return the type of the element.- Specified by:
getRealType
in interfaceScriptable
- Returns:
- Type-name
-
addScriptFile
public void addScriptFile(java.nio.file.Path path, java.lang.String language) throws java.io.IOException
Do not support modifying tools file on the fly. Will always throw IOException.- Specified by:
addScriptFile
in interfaceScriptable
- Parameters:
path
- path to file.language
- Script language.- Throws:
java.io.IOException
- If called.
-
getEvalRequired
public java.lang.Boolean getEvalRequired()
Evaluate only at load.- Specified by:
getEvalRequired
in interfaceScriptable
- Returns:
- False.
-
setEvalRequired
public void setEvalRequired(java.lang.Boolean req)
Set if I should be re-evaluated.- Specified by:
setEvalRequired
in interfaceScriptable
- Parameters:
req
- Re-eval?
-
getParentScriptable
public java.util.Optional<Scriptable> getParentScriptable()
Description copied from interface:Scriptable
Get the parent of this Scriptable element.- Specified by:
getParentScriptable
in interfaceScriptable
- Returns:
- Maybe parent.
-
-