Path: blob/trunk/third_party/closure/goog/editor/plugins/undoredostate.js
2868 views
// Copyright 2008 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview Code for an UndoRedoState interface representing an undo and16* redo action for a particular state change. To be used by17* {@link goog.editor.plugins.UndoRedoManager}.18*19*/202122goog.provide('goog.editor.plugins.UndoRedoState');2324goog.require('goog.events.EventTarget');25262728/**29* Represents an undo and redo action for a particular state transition.30*31* @param {boolean} asynchronous Whether the undo or redo actions for this32* state complete asynchronously. If true, then this state must fire33* an ACTION_COMPLETED event when undo or redo is complete.34* @constructor35* @extends {goog.events.EventTarget}36*/37goog.editor.plugins.UndoRedoState = function(asynchronous) {38goog.editor.plugins.UndoRedoState.base(this, 'constructor');3940/**41* Indicates if the undo or redo actions for this state complete42* asynchronously.43* @type {boolean}44* @private45*/46this.asynchronous_ = asynchronous;47};48goog.inherits(goog.editor.plugins.UndoRedoState, goog.events.EventTarget);495051/**52* Event type for events indicating that this state has completed an undo or53* redo operation.54*/55goog.editor.plugins.UndoRedoState.ACTION_COMPLETED = 'action_completed';565758/**59* @return {boolean} Whether or not the undo and redo actions of this state60* complete asynchronously. If true, the state will fire an ACTION_COMPLETED61* event when an undo or redo action is complete.62*/63goog.editor.plugins.UndoRedoState.prototype.isAsynchronous = function() {64return this.asynchronous_;65};666768/**69* Undoes the action represented by this state.70*/71goog.editor.plugins.UndoRedoState.prototype.undo = goog.abstractMethod;727374/**75* Redoes the action represented by this state.76*/77goog.editor.plugins.UndoRedoState.prototype.redo = goog.abstractMethod;787980/**81* Checks if two undo-redo states are the same.82* @param {goog.editor.plugins.UndoRedoState} state The state to compare.83* @return {boolean} Wether the two states are equal.84*/85goog.editor.plugins.UndoRedoState.prototype.equals = goog.abstractMethod;868788