first stage of undo/redo functionality -- there are still a number of actions that...
[potlatch2.git] / net / systemeD / halcyon / connection / UndoableEntityAction.as
1 package net.systemeD.halcyon.connection {
2
3     public class UndoableEntityAction extends UndoableAction {
4         private var wasDirty:Boolean;
5         protected var name:String;
6         protected var entity:Entity;
7             
8         public function UndoableEntityAction(entity:Entity, name:String) {
9             this.entity = entity;
10             this.name = name;
11         }
12             
13         protected function markDirty():void {
14             wasDirty = entity.isDirty;
15             if ( !wasDirty )
16                 entity.markDirty();
17         }
18             
19         protected function markClean():void {
20             if ( !wasDirty )
21                 entity.markClean(entity.id, entity.version);
22         }
23             
24         public function toString():String {
25             return name + " " + entity.getType() + " " + entity.id;
26         }
27     }
28 }
29