Class Tool

  • All Implemented Interfaces:
    Scriptable

    public class Tool
    extends nu.xom.Element
    implements Scriptable
    Author:
    Group 3
    • Constructor Summary

      Constructors 
      Constructor Description
      Tool​(java.lang.String name)
      Constructor.
      Tool​(java.lang.String name, java.lang.String uri)
      Constructor.
      Tool​(nu.xom.Element element)
      Constructor.
    • 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
      • Methods inherited from class nu.xom.Node

        detach, equals, getDocument, getParent, hashCode, query, query
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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?
      • 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 interface Scriptable
        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 interface Scriptable
        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 interface Scriptable
        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 interface Scriptable
        Returns:
        False.
      • setEvalRequired

        public void setEvalRequired​(java.lang.Boolean req)
        Set if I should be re-evaluated.
        Specified by:
        setEvalRequired in interface Scriptable
        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 interface Scriptable
        Returns:
        Maybe parent.