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 RecursiveBindingselementScriptBindingsMy script bindings.protected java.lang.BooleanevalRequiredIs Eval Required.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddScriptFile(java.nio.file.Path path, java.lang.String language)Do not support modifying tools file on the fly.java.lang.BooleanbubbleEvents()Get if events are allowed to bubble up.java.lang.BooleangetEvalRequired()Evaluate only at load.java.lang.StringgetID()Get tool ID.java.util.Optional<java.lang.String>getImagePath()Get the path to the associated image.java.lang.StringgetName()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.StringgetRealType()Return the type of the element.java.util.Optional<ScriptElement>getScriptEl()Get the ScriptElement attached to this object.RecursiveBindingsgetScriptingBindings()Get the local scope for this object.voidsetEvalRequired(java.lang.Boolean req)Set if I should be re-evaluated.java.lang.BooleansinkEvents()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:
getScriptingBindingsin interfaceScriptable- Returns:
- my Bindings.
-
getParentElementScriptingBindings
public final java.util.Optional<RecursiveBindings> getParentElementScriptingBindings()
Return the Global bindings.- Specified by:
getParentElementScriptingBindingsin 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:
getScriptElin interfaceScriptable- Returns:
- my (first) script element.
-
getRealType
public final java.lang.String getRealType()
Description copied from interface:ScriptableReturn the type of the element.- Specified by:
getRealTypein interfaceScriptable- Returns:
- Type-name
-
addScriptFile
public void addScriptFile(java.nio.file.Path path, java.lang.String language) throws java.io.IOExceptionDo not support modifying tools file on the fly. Will always throw IOException.- Specified by:
addScriptFilein 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:
getEvalRequiredin interfaceScriptable- Returns:
- False.
-
setEvalRequired
public void setEvalRequired(java.lang.Boolean req)
Set if I should be re-evaluated.- Specified by:
setEvalRequiredin interfaceScriptable- Parameters:
req- Re-eval?
-
getParentScriptable
public java.util.Optional<Scriptable> getParentScriptable()
Description copied from interface:ScriptableGet the parent of this Scriptable element.- Specified by:
getParentScriptablein interfaceScriptable- Returns:
- Maybe parent.
-
-