Class Tool

java.lang.Object
java.util.Observable
com.nomagic.magicreport.engine.Tool
All Implemented Interfaces:
ITool, IVariable, Serializable, Cloneable
Direct Known Subclasses:
ArrayTool, BookmarkTool, ChartTool, ConcurrentTool, DependencyMatrixTool, DialogTool, DocBookTool, GenericTableTool, GroovyTool, GroupTool, ImageTool, ImportTool, JavaDocTool, JavaScriptTool, MapTool, MathTool, ModelValidationTool, ProfilingTool, ProjectTool, QueryTool, ReportHelper, SortTool, TemplateTool, TextTool

@OpenApiAll public class Tool extends Observable implements ITool, Cloneable
A base class realizing from interface ITool. This class provide default implementation for ITool. The extended class from this class may send message or object to observer class by invoke notifyObservers(Object) of class Observable. The observer class such as AbstractTemplateEngine or graphical user interface can catch notified object and interact with user.

This class also implement Cloneable interface with allow an object to create and return copy of this object.

Since:
Aug 3, 2007
See Also:
  • Field Details

    • properties

      protected Properties properties
      Template engine properties.
    • context

      protected IContext context
      Template context.
  • Constructor Details

    • Tool

      public Tool()
  • Method Details

    • setProperties

      public void setProperties(Properties properties)
      This method is invoked by the template engine runtime, after class has been initializing, to set the template properties. Override current properties will not affect with the engine.
      Specified by:
      setProperties in interface ITool
      Parameters:
      properties - template engine properties
      Throws:
      IllegalArgumentException - if properties is null
    • getProperties

      public Properties getProperties()
      Return template engine properties.
      Specified by:
      getProperties in interface ITool
      Returns:
      template engine properties
    • getProperty

      public String getProperty(String key)
      Return template engine property value.
      Parameters:
      key - property key
      Returns:
      template engine value
    • getProperty

      public String getProperty(String key, String defaultValue)
      Return template engine property value. If the key is not found in this property, the default value is return.
      Parameters:
      key - property key
      defaultValue - default value
      Returns:
      template engine value
    • setContext

      public void setContext(IContext context)
      This method is invoked by the template engine runtime, after class has been initializing, to set the template context. This method automatically called by template engine.
      Specified by:
      setContext in interface ITool
      Parameters:
      context - template context
    • getContext

      public IContext getContext()
      Return template context.
      Specified by:
      getContext in interface ITool
      Returns:
      template context
    • notifyObservers

      public void notifyObservers(Object event)
      Override notifyObservers by provide sequence of calling these methods.
      
       setChanged();
       super.notifyObservers(event);
       
      Overrides:
      notifyObservers in class Observable
      Parameters:
      event - any object.
      See Also:
    • clone

      public Object clone() throws CloneNotSupportedException
      Creates and returns a copy of this object.
      Overrides:
      clone in class Object
      Returns:
      a clone of this instance.
      Throws:
      CloneNotSupportedException - if the object's class does not support the Cloneable interface.