Interface App


public interface App
The entry point of the DeltaWalker Scripting API. Every script can use it through the global variables App and dw, which both refer to the same object.

From here a script reaches the Comparisons collection used to create comparisons, the application-wide Settings, and the main application Window.


 const Comparison = Java.type('com.deltawalker.script.Comparison');

 console.log('DeltaWalker ' + App.getVersion() + ' (' + App.getEdition() + ')');

 const IN = App.getProperty('user.home') + '/test/samples';
 const comp = App.getComparisons().create(Comparison.Type.TEXT,
         [IN + '/q0.txt', IN + '/q1.txt'], null);
 await comp.compare();
 console.log('Files differ: ' + comp.hasDifferences());
 
Since:
2.0
  • Method Details

    • addListener

      void addListener(ComparisonListener listener)
      Adds an application-wide ComparisonListener.

      Listeners are a legacy mechanism; new scripts should await the operation they are interested in instead. Note that in the current release ComparisonEvents are delivered only to listeners added to individual comparisons with Comparison.addListener(ComparisonListener); listeners added here are kept but are not notified.

      Adding the same, or an equal, listener more than once has no effect. To remove a listener use removeListener(ComparisonListener).

      Parameters:
      listener - the listener to add; must not be null
      Since:
      2.0
      See Also:
    • getComparisons

      Comparisons getComparisons()
      Returns the Comparisons collection, used to create comparisons and to look up existing ones.
      Returns:
      the Comparisons object; never null
      Since:
      2.0
    • getEdition

      String getEdition()
      Returns the name of the product edition, for example "Standard", "Pro", "Oro" or "Trial". Scripts do not run in the "Free" edition.
      Returns:
      the display name of the product edition
      Since:
      2.0
    • getProperty

      String getProperty(String key)
      Returns the value of the Java system property with the specified key. Useful keys include user.home (the user's home folder), os.name (the operating system name) and dw.samples (the folder holding the samples that ship with DeltaWalker).
      
       const HOME = App.getProperty('user.home');
       const isMac = App.getProperty('os.name').indexOf('Mac') >= 0;
       
      Parameters:
      key - the name of the property
      Returns:
      the value of the property, or null if there is no property with that key
      Since:
      2.0
    • getSettings

      Settings getSettings()
      Returns the application-level Settings: global settings, the default settings used for new comparisons, and the page and printer settings used for printing.
      Returns:
      the application Settings object; never null
      Since:
      2.0
    • getVersion

      String getVersion()
      Returns the product version as major.minor.micro, for example "3.0.7".
      Returns:
      the product version
      Since:
      2.0
    • getWindow

      Window getWindow()
      Returns the main application window.
      Returns:
      a Window object representing the main application window
      Since:
      2.0
    • removeListener

      void removeListener(ComparisonListener listener)
      Removes a listener previously added with addListener(ComparisonListener). Has no effect if the listener is not registered.
      Parameters:
      listener - the listener to remove; must not be null
      Since:
      2.0