Last updated

API / geotoolkit / controls / tools / editors / History / History

Class: History

editors.History.History

Editors history that stores editing commands and is able to undo/redo it

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new History(layer)

new History(layer)

Parameters

Name Type
layerCompositeNode<Node>

Overrides

EventDispatcher.constructor

Methods

canRedo

canRedo(): boolean

Checks if there is command in history to redo

Returns

boolean


canUndo

canUndo(): boolean

Checks if there is command in history to undo

Returns

boolean


clear

clear(): History

Removes all records from the history

Returns

History

this


dispose

dispose(): void

Dispose.

Returns

void

Inherited from

EventDispatcher.dispose


getClassName

getClassName(): string

Returns

string

Inherited from

EventDispatcher.getClassName


getCurrentPosition

getCurrentPosition(): number

Returns current position in history (number of commands recorded from initial to the current state)

Returns

number


getRegistry

getRegistry(): Registry

Gets editors registry

Returns

Registry


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

EventDispatcher.hasEventListener


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

EventDispatcher.isDisposed


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

EventDispatcher.isSilent


notify

notify<E>(type, source, args?): History

Notify listeners

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourceHistoryof the event
Optional argsEventMap[E]arguments of the event

Returns

History

this

Overrides

EventDispatcher.notify


off

off<E>(type?, callback?): History

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: History, args: EventMap[E]) => voidfunction to be called

Returns

History

this

Overrides

EventDispatcher.off


on

on<E>(type, callback): History

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: History, args: EventMap[E]) => voidto be called

Returns

History

this

Overrides

EventDispatcher.on


push

push(command, editor?): History

Pushes editor's command to the history

Fires

EditEvents.BeforeCommandApplied

Fires

EditEvents.CommandApplying

Fires

EditEvents.CommandApplied

Fires

EditEvents.EditorChanged

Parameters

Name Type Description
commandAbstractCommandcommand to push
Optional editorAbstractEditorBase<Node | Node[]>editor generated command

Returns

History


redo

redo(): History

Reapplies last canceled command in history (if possible)

Fires

EditEvents.Redo

Fires

EditEvents.BeforeCommandApplied

Fires

EditEvents.CommandApplying

Fires

EditEvents.CommandApplied

Fires

EditEvents.EditorChanged

Returns

History


setRegistry

setRegistry(registry): History

Sets registry for node editors

Parameters

Name Type Description
registryRegistrythe editors registry

Returns

History


setSilent

setSilent(bool): History

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

History

this

Inherited from

EventDispatcher.setSilent


undo

undo(): History

Cancels last command in history (if possible)

Fires

EditEvents.Undo

Fires

EditEvents.BeforeCommandApplied

Fires

EditEvents.CommandApplying

Fires

EditEvents.CommandApplied

Fires

EditEvents.EditorChanged

Returns

History


getClassName

Static getClassName(): string

Returns

string

Inherited from

EventDispatcher.getClassName