/**
* {@link XMLEditorEvent} sent after a document has been successfully opened
* in an XMLEditor.
*
* <p>Contains not only the HTML+CSS view of the opened document but also
* all the information (commands, bindings, toolbar buttons, etc)
* needed to configure the {@link XMLEditor} in order to make it usable
* to edit this opened document.
*
* @see XMLEditor#openDocument
* @see XMLEditor#openFile
*/
export class DocumentOpenedEvent extends XMLEditorEvent {
constructor(xmlEditor, data, type="documentOpened") {
super(xmlEditor, data, type);
if (!this._diffSupport) {
this._diffSupport = 0;
}
if (!Array.isArray(this._contextualCmds)) {
// An array of (cmdName, cmdParam) pairs.
this._contextualCmds = null;
}
if (!this._configName) {
this._configName = null;
}
if (!Array.isArray(this._bindings)) {
this._bindings = null;
} else {
let bindings = [];
for (let data of this._bindings) {
let binding = Binding.fromJSON(data);
if (binding !== null) {
bindings.push(binding);
}
}
this._bindings = (bindings.length === 0)? null : bindings;
}
if (!Array.isArray(this._toolSets)) {
this._toolSets = null;
}
if (!Array.isArray(this._extensionModules)) {
this._extensionModules = null;
}
}
/**
* Get the <code>uid</code> property of this event.
*
* @type {string}
*/
get uid() {
return this._uid;
}
/**
* Get the <code>url</code> property of this event.
*
* @type {string}
*/
get url() {
return this._url;
}
/**
* Get the <code>persistent</code> property of this event.
*
* @type {boolean}
*/
get persistent() {
return this._persistent;
}
/**
* Get the <code>nsPrefixes</code> property of this event.
*
* @type {array}
*/
get nsPrefixes() {
return this._nsPrefixes;
}
/**
* Get the <code>readOnly</code> property of this event.
*
* @type {boolean}
*/
get readOnly() {
return this._readOnly;
}
/**
* Get the <code>saveNeeded</code> property of this event.
*
* @type {boolean}
*/
get saveNeeded() {
return this._saveNeeded;
}
/**
* Get the <code>saveAsNeeded</code> property of this event.
*
* @type {boolean}
*/
get saveAsNeeded() {
return this._saveAsNeeded;
}
/**
* Get the <code>diffSupport</code> property of this event:
* 0 (comparison of revisions not enabled),
* 1 (comparison of revisions enabled) or
* 2 (all revisions stored in the document).
*
* @type {number}
*/
get diffSupport() {
return this._diffSupport;
}
/**
* Get the <code>view</code> property of this event.
*
* @type {string}
*/
get view() {
return this._view;
}
/**
* Get the <code>styles</code> property of this event.
*
* @type {string}
*/
get styles() {
return this._styles;
}
/**
* Get the <code>marks</code> property of this event.
*
* @type {array}
*/
get marks() {
return this._marks;
}
/**
* Get the <code>contextualCommands</code> property of this event.
*
* @type {array}
*/
get contextualCommands() {
return this._contextualCmds;
}
/**
* Get the <code>configurationName</code> property of this event.
*
* @type {string}
*/
get configurationName() {
return this._configName;
}
/**
* Get the <code>bindings</code> property of this event.
*
* @type {array}
*/
get bindings() {
return this._bindings;
}
/**
* Get the <code>toolSets</code> property of this event.
*
* @type {array}
*/
get toolSets() {
return this._toolSets;
}
/**
* Get the <code>extensionModules</code> property of this event.
*
* @type {array}
*/
get extensionModules() {
return this._extensionModules;
}
}