ramblings/oxygen/js-options/hello.js

51 lines
1.8 KiB
JavaScript

hello = function () {
include('options.js');
// Instanciation
Packages.java.lang.System.out.println("<new Options(authorAccess, 'hello', 3)>");
var options = new Options(authorAccess, 'hello', 3);
Packages.java.lang.System.out.println("</new Options(authorAccess, 'hello', 3)");
// Set up a couple of options
options.setOption('Hello', 'World');
options.setOption('See you later', 'aligator');
// Retrieve and display these options
var myOptions = options.getOptions();
for (var key in myOptions) {
var value = myOptions[key];
Packages.java.lang.System.out.println(key + ' ' + value);
}
// Do the same with file specific options
Packages.java.lang.System.out.println("<options.setSystemId(undefined, 2)>");
options.setSystemId(null, 2);
Packages.java.lang.System.out.println("</options.setSystemId(undefined, 2)>");
options.setSystemIdOption('Hello', 'aligator');
options.setSystemIdOption('See you later', 'World');
var myOptions = options.getSystemIdOptions();
for (var key in myOptions) {
var value = myOptions[key];
Packages.java.lang.System.out.println(key + ' ' + value);
}
// Display some file specific properties
Packages.java.lang.System.out.println('options.systemId: ' + options.systemId);
Packages.java.lang.System.out.println('options.systemIdDigest: ' + options.systemIdDigest);
Packages.java.lang.System.out.println("<new Options(authorAccess, 'hello2', 20)>");
var options = new Options(authorAccess, 'hello2', 20);
Packages.java.lang.System.out.println("</new Options>");
// Delete options
// Packages.java.lang.System.out.println('Deleting options');
// options.deleteOption ('Hello');
// options.deleteOption ('See you later');
// myOptions = options.getOptions();
// for (var key in myOptions) {
// var value = myOptions[key];
// Packages.java.lang.System.out.println(key + ' ' + value);
// }
}