forked from yui/yui3-gallery
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gallery-2009.12.15-22 ipeychev gallery-undo
- Loading branch information
YUI Builder
committed
Dec 15, 2009
1 parent
e72cbcc
commit 4759c2f
Showing
10 changed files
with
1,627 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Undo Manager for YUI 3 | ||
|
||
I. Changelog | ||
|
||
16.11.2009 - Initial load |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
# The location of your yuidoc install | ||
yuidoc_home=../../../yuidoc | ||
|
||
# The location of the files to parse. Parses subdirectories, but will fail if | ||
# there are duplicate file names in these directories. You can specify multiple | ||
# source trees: | ||
# parser_in="%HOME/www/yui/src %HOME/www/event/src" | ||
parser_in="js" | ||
|
||
# The location to output the parser data. This output is a file containing a | ||
# json string, and copies of the parsed files. | ||
parser_out=../../build/gallery-undo/apidocs/parser_out | ||
|
||
# The directory to put the html file outputted by the generator | ||
generator_out=../../build/gallery-undo/apidocs/ | ||
|
||
# The location of the template files. Any subdirectories here will be copied | ||
# verbatim to the destination directory. | ||
template=$yuidoc_home/template | ||
|
||
# The version of your project to display within the documentation. | ||
version=1.00 | ||
|
||
# The version of YUI the project is using. This effects the output for | ||
# YUI configuration attributes. This should start with '2' or '3'. | ||
yuiversion=3 | ||
|
||
############################################################################## | ||
# add -s to the end of the line to show items marked private | ||
|
||
$yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out -o $generator_out -t $template -v $version -Y $yuiversion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
builddir=../../../builder/componentbuild | ||
|
||
component=gallery-undo | ||
component.jsfiles=gallery-undomanager.js gallery-undoableaction.js | ||
component.requires=base,event |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="YUI" default="local"> | ||
<property environment="env" /> | ||
|
||
<property file="build.properties" /> | ||
|
||
<import file="${builddir}/3.x/bootstrap.xml" | ||
description="Default Build Properties and Targets" /> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
/** | ||
* Provides UndoableAction class | ||
* | ||
* @module gallery-undo | ||
*/ | ||
|
||
(function(){ | ||
|
||
|
||
/** | ||
* Create a UndoableAction | ||
* | ||
* @class UndoableAction | ||
* @extends Base | ||
* @param config {Object} Configuration object | ||
* @constructor | ||
*/ | ||
function UndoableAction( config ){ | ||
UndoableAction.superclass.constructor.apply( this, arguments ); | ||
} | ||
|
||
var Lang = Y.Lang, | ||
UAName = "UndoableAction", | ||
LABEL = "label", | ||
BEFOREUNDO = "beforeUndo", | ||
UNDOFINISHED = "undoFinished", | ||
BEFOREREDO = "beforeRedo", | ||
REDOFINISHED = "redoFinished"; | ||
|
||
Y.mix( UndoableAction, { | ||
/** | ||
* The identity of UndoableAction. | ||
* | ||
* @property UndoableAction.NAME | ||
* @type String | ||
* @static | ||
*/ | ||
NAME : UAName, | ||
|
||
/** | ||
* Static property used to define the default attribute configuration of UndoableAction. | ||
* | ||
* @property UndoableAction.ATTRS | ||
* @type Object | ||
* @protected | ||
* @static | ||
*/ | ||
ATTRS : { | ||
/** | ||
* The label of action | ||
* | ||
* @attribute label | ||
* @type String | ||
* @default "" | ||
*/ | ||
label: { | ||
value: "", | ||
validator: Lang.isString | ||
}, | ||
|
||
|
||
/** | ||
* Boolean, indicates if action must be processed asynchronously. | ||
* If true, <code>undo</code> method must fire <code>undoFinished</code> event. | ||
* Respectively, <code>redo</code> method must fire <code>redoFinished</code> event | ||
* | ||
* @attribute asyncProcessing | ||
* @type Boolean | ||
* @default false | ||
*/ | ||
asyncProcessing : { | ||
value: false, | ||
validator: Lang.isBoolean | ||
} | ||
} | ||
}); | ||
|
||
|
||
Y.extend( UndoableAction, Y.Base, { | ||
|
||
/** | ||
* Container for child actions of this action | ||
* | ||
* @property _childActions | ||
* @protected | ||
* @type Array | ||
*/ | ||
_childActions : [], | ||
|
||
/** | ||
* Publishes events | ||
* | ||
* @method initializer | ||
* @protected | ||
*/ | ||
initializer : function( cfg ) { | ||
this._initEvents(); | ||
}, | ||
|
||
/** | ||
* Destructor lifecycle implementation for UndoableAction class. | ||
* | ||
* @method destructor | ||
* @protected | ||
*/ | ||
destructor : function() { | ||
}, | ||
|
||
|
||
/** | ||
* Publishes UndoableAction's events | ||
* | ||
* @method _initEvents | ||
* @protected | ||
*/ | ||
_initEvents : function(){ | ||
|
||
/** | ||
* Signals the beginning of action undo. | ||
* | ||
* @event beforeUndo | ||
* @param event {Event.Facade} An Event Facade object | ||
*/ | ||
this.publish( BEFOREUNDO ); | ||
|
||
/** | ||
* Signals the end of action undo. | ||
* | ||
* @event undoFinished | ||
* @param event {Event.Facade} An Event Facade object | ||
*/ | ||
this.publish( UNDOFINISHED ); | ||
|
||
/** | ||
* Signals the beginning of action redo. | ||
* | ||
* @event beforeRedo | ||
* @param event {Event.Facade} An Event Facade object | ||
*/ | ||
this.publish( BEFOREREDO ); | ||
|
||
/** | ||
* Signals the end of action redo. | ||
* | ||
* @event redoFinished | ||
* @param event {Event.Facade} An Event Facade object | ||
*/ | ||
this.publish( REDOFINISHED ); | ||
}, | ||
|
||
|
||
/** | ||
* The default implemetation undoes all child actions in reverse order. | ||
* | ||
* @method undo | ||
*/ | ||
undo : function(){ | ||
var childActions, action, i; | ||
|
||
this.fire( BEFOREUNDO ); | ||
|
||
childActions = this._childActions; | ||
|
||
for( i = childActions.length - 1; i > 0; i-- ){ | ||
action = childActions[i]; | ||
action.undo(); | ||
} | ||
|
||
this.fire( UNDOFINISHED ); | ||
}, | ||
|
||
|
||
/** | ||
* The default implemetation redoes all child actions. | ||
* | ||
* @method redo | ||
*/ | ||
redo : function(){ | ||
var childActions, action, i, length; | ||
|
||
this.fire( BEFOREREDO ); | ||
|
||
childActions = this._childActions; | ||
length = childActions.length; | ||
|
||
for( i = 0; i < length; i++ ){ | ||
action = childActions[i]; | ||
action.redo(); | ||
} | ||
|
||
this.fire( REDOFINISHED ); | ||
}, | ||
|
||
|
||
/** | ||
* Depending on the application, an UndoableAction may merge with another action. If merge was successfull, merge must return true; otherwise returns false. | ||
* The default implemetation returns false. | ||
* | ||
* @method merge | ||
* @param {Y.UndoableAction} newAction The action to merge with | ||
* @return {Boolean} false | ||
*/ | ||
merge : function( newAction ){ | ||
return false; | ||
}, | ||
|
||
|
||
/** | ||
* UndoManager invokes <code>cancel</code> method of action before removing it from the list.<br> | ||
* The default implemetation does nothing. | ||
* | ||
* @method cancel | ||
*/ | ||
cancel : function(){ | ||
}, | ||
|
||
|
||
/** | ||
* Overrides <code>toString()</code> method.<br> | ||
* The default implementation returns the value of <code>label</code> property. | ||
* | ||
*/ | ||
toString : function(){ | ||
return this.get( LABEL ); | ||
} | ||
}); | ||
|
||
Y.UndoableAction = UndoableAction; | ||
|
||
}()); |
Oops, something went wrong.