RenameOperation
Operation to change element's name.
Using this class you can change element's name.
Properties
affectedSelectable : ModelSelectablereadonlymodule:engine/model/operation/renameoperation~RenameOperation#affectedSelectableA selectable that will be affected by the operation after it is executed.
The exact returned parameter differs between operation types.
baseVersion : null | numberinheritedmodule:engine/model/operation/renameoperation~RenameOperation#baseVersionversionon which operation can be applied. If you try to apply operation with different base version than the document version the model-document-applyOperation-wrong-version error is thrown.module:engine/model/operation/renameoperation~RenameOperation#batchBatch to which the operation is added or
nullif the operation is not added to any batch yet.Note, that a non-document operation has this property always set to
null, and is never added to any batch.isDocumentOperation : booleanreadonlyinheritedmodule:engine/model/operation/renameoperation~RenameOperation#isDocumentOperationDefines whether operation is executed on attached or detached items.
newName : stringmodule:engine/model/operation/renameoperation~RenameOperation#newNameNew name for the element.
oldName : stringmodule:engine/model/operation/renameoperation~RenameOperation#oldNameCurrent name of the element.
module:engine/model/operation/renameoperation~RenameOperation#positionPosition before an element to change.
type : 'rename'readonlymodule:engine/model/operation/renameoperation~RenameOperation#typeOperation type.
Static properties
className : stringreadonlystaticmodule:engine/model/operation/renameoperation~RenameOperation.classNameName of the operation class used for serialization.
Methods
constructor( position, oldName, newName, baseVersion )module:engine/model/operation/renameoperation~RenameOperation#constructorCreates an operation that changes element's name.
Parameters
position : ModelPositionPosition before an element to change.
oldName : stringCurrent name of the element.
newName : stringNew name for the element.
baseVersion : null | numberDocument
versionon which operation can be applied ornullif the operation operates on detached (non-document) tree.
clone() → RenameOperationmodule:engine/model/operation/renameoperation~RenameOperation#cloneCreates and returns an operation that has the same parameters as this operation.
Returns
RenameOperationClone of this operation.
getReversed() → Operationmodule:engine/model/operation/renameoperation~RenameOperation#getReversedtoJSON() → unknownmodule:engine/model/operation/renameoperation~RenameOperation#toJSONCustom toJSON method to solve child-parent circular dependencies.
Returns
unknownClone of this object with the operation property replaced with string.
_execute() → voidinternalmodule:engine/model/operation/renameoperation~RenameOperation#_executeExecutes the operation - modifications described by the operation properties will be applied to the model tree.
Returns
void
_validate() → voidinternalmodule:engine/model/operation/renameoperation~RenameOperation#_validateChecks whether the operation's parameters are correct and the operation can be correctly executed. Throws an error if operation is not valid.
Returns
void
Static methods
fromJSON( json, document ) → RenameOperationstaticmodule:engine/model/operation/renameoperation~RenameOperation.fromJSONCreates
RenameOperationobject from deserialized object, i.e. from parsed JSON string.Parameters
json : anyDeserialized JSON object.
document : ModelDocumentDocument on which this operation will be applied.
Returns