Package com.deltawalker.script
Interface Settings
public interface Settings
A collection of settings and the operations on them. There are two levels
of settings:
- Application settings, returned by
App.getSettings(): global settings, the defaults for new comparisons, and the page and printer settings used for printing. - Comparison settings, returned by
HistoryEntry.getSettings(): the settings of a single comparison, which start as a copy of the application defaults.
Settings are identified by the keys of the com.deltopia.io.SettingKey
enum, loaded with Java.type():
const Comparison = Java.type('com.deltawalker.script.Comparison');
const SettingKey = Java.type('com.deltopia.io.SettingKey');
const settings = comp.getSettings();
settings.set(SettingKey.D_COMP_METHOD, [
Comparison.Method.SIZE,
Comparison.Method.DATE_MODIFIED
]);
await comp.compare();
-
Method Summary
Modifier and TypeMethodDescriptionfilters(Comparison.Type type) Returns theFiltersfor comparisons of the specifiedComparison.Type.get(com.deltopia.io.SettingKey key) Returns the current value of the setting with the specified key.getPage()Returns thePageSettingsused for printing, such as the page orientation, margins, header and footer.Returns thePrinterSettingsused for printing, such as the printer, number of copies and page range.voidImports all settings - application settings, defaults for new comparisons, and the settings of the comparisons stored in the file - from a file previously written bysave(String).voidExports all settings - application settings, defaults for new comparisons, and the settings of all existing comparisons - to a file.voidSets the setting with the specified key to the specified value.
-
Method Details
-
filters
Returns theFiltersfor comparisons of the specifiedComparison.Type. On the settings of a comparison, returns the filters of that comparison. On the application settings, returns the default filters used for new comparisons of that type.Only folder and text comparisons use filters.
const filters = comp.getSettings().filters(Comparison.Type.FOLDER);- Parameters:
type- the type of comparison whose filters to return. Ignored, and can benull, on the settings of a comparison; cannot benullon the application settings.- Returns:
- the
Filtersfor the specifiedComparison.Type - Throws:
NullPointerException- iftypeisnulland this is the application settings object- Since:
- 2.0
-
get
Returns the current value of the setting with the specified key. Only settings whose value is a boolean or a number can be read; the value is returned as a JavaScript boolean or number.const followLinks = App.getSettings().get(SettingKey.C_FOLLOW_SYMLINKS);- Parameters:
key- the key of the setting to read- Returns:
- the value of the setting
- Throws:
NullPointerException- ifkeyisnullIllegalArgumentException- if the value of the setting is neither a boolean nor a number- Since:
- 2.0
-
getPage
Returns thePageSettingsused for printing, such as the page orientation, margins, header and footer.Page settings are application-level settings: call
getPage()onApp.getSettings(), not on the settings of a comparison.- Returns:
- the application's
PageSettings - Throws:
UnsupportedOperationException- if called on the settings of a comparison- Since:
- 2.0
-
getPrinter
Returns thePrinterSettingsused for printing, such as the printer, number of copies and page range.Printer settings are application-level settings: call
getPrinter()onApp.getSettings(), not on the settings of a comparison.- Returns:
- the application's
PrinterSettings - Throws:
UnsupportedOperationException- if called on the settings of a comparison- Since:
- 2.0
-
load
Imports all settings - application settings, defaults for new comparisons, and the settings of the comparisons stored in the file - from a file previously written bysave(String).- Parameters:
path- the full path of a DeltaWalker settings file; cannot benull- Throws:
FileNotFoundException- declared for compatibilityIOException- declared for compatibilityNullPointerException- ifpathisnull- Since:
- 2.0
-
save
Exports all settings - application settings, defaults for new comparisons, and the settings of all existing comparisons - to a file.- Parameters:
path- the full path of the file to write; cannot benullor empty- Throws:
IOException- if the file cannot be writtenNullPointerException- ifpathisnullIllegalArgumentException- ifpathis an empty string- Since:
- 2.0
-
set
Sets the setting with the specified key to the specified value. The value must match the type of the setting: a boolean, a number or a string.SettingKey.D_COMP_METHODtakes aComparison.Methodor an array of them.Setting a value does not start a comparison or a re-comparison; the new value is used the next time the comparison runs.
comp.getSettings().set(SettingKey.D_COMP_METHOD, Comparison.Method.AS_TEXT);- Parameters:
key- the key of the setting to set; cannot benullvalue- the new value; cannot benullor empty- Throws:
NullPointerException- ifkeyorvalueisnullIllegalArgumentException- ifvalueis empty, does not match the type of the setting, or is a number out of range for it- Since:
- 2.0
-