Package com.deltawalker.script
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 Summary
Modifier and TypeMethodDescriptionvoidaddListener(ComparisonListener listener) Adds an application-wideComparisonListener.Returns theComparisonscollection, used to create comparisons and to look up existing ones.Returns the name of the product edition, for example"Standard","Pro","Oro"or"Trial".getProperty(String key) Returns the value of the Java system property with the specified key.Returns the application-levelSettings: global settings, the default settings used for new comparisons, and the page and printer settings used for printing.Returns the product version asmajor.minor.micro, for example"3.0.7".Returns the main application window.voidremoveListener(ComparisonListener listener) Removes a listener previously added withaddListener(ComparisonListener).
-
Method Details
-
addListener
Adds an application-wideComparisonListener.Listeners are a legacy mechanism; new scripts should
awaitthe operation they are interested in instead. Note that in the current releaseComparisonEvents are delivered only to listeners added to individual comparisons withComparison.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 benull- Since:
- 2.0
- See Also:
-
getComparisons
Comparisons getComparisons()Returns theComparisonscollection, used to create comparisons and to look up existing ones.- Returns:
- the
Comparisonsobject; nevernull - 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
Returns the value of the Java system property with the specified key. Useful keys includeuser.home(the user's home folder),os.name(the operating system name) anddw.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
nullif there is no property with that key - Since:
- 2.0
-
getSettings
Settings getSettings()Returns the application-levelSettings: global settings, the default settings used for new comparisons, and the page and printer settings used for printing.- Returns:
- the application
Settingsobject; nevernull - Since:
- 2.0
-
getVersion
String getVersion()Returns the product version asmajor.minor.micro, for example"3.0.7".- Returns:
- the product version
- Since:
- 2.0
-
getWindow
Window getWindow()Returns the main application window.- Returns:
- a
Windowobject representing the main application window - Since:
- 2.0
-
removeListener
Removes a listener previously added withaddListener(ComparisonListener). Has no effect if the listener is not registered.- Parameters:
listener- the listener to remove; must not benull- Since:
- 2.0
-