Changeset 1949
- Timestamp:
- 05/21/12 15:39:51 (12 years ago)
- Location:
- ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDAttribute.as
r1946 r1949 1 1 package clarin.cmdi.componentregistry.editor.model { 2 import clarin.cmdi.componentregistry.common.ChangeTrackingCMDElement; 2 3 import clarin.cmdi.componentregistry.common.ComponentMD; 3 4 import clarin.cmdi.componentregistry.common.XmlAble; … … 7 8 import mx.collections.ArrayCollection; 8 9 9 public class CMDAttribute implements XmlAble, ValueSchemeInterface {10 public class CMDAttribute implements XmlAble, ValueSchemeInterface, ChangeTrackingCMDElement { 10 11 //No Attributes 11 12 … … 18 19 19 20 private var changed:Boolean = false; 20 p ublic varchangeTracking:Boolean = false;21 private var _changeTracking:Boolean = false; 21 22 22 23 public function CMDAttribute() { … … 29 30 } 30 31 32 public function set changeTracking(value:Boolean):void{ 33 _changeTracking = value; 34 } 35 31 36 public function setChanged(value:Boolean):void { 32 if( changeTracking) {37 if(_changeTracking) { 33 38 this.changed = value; 34 39 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponent.as
r1946 r1949 1 1 package clarin.cmdi.componentregistry.editor.model { 2 import clarin.cmdi.componentregistry.common.ChangeTrackingCMDElement; 2 3 import clarin.cmdi.componentregistry.common.XmlAble; 3 4 … … 6 7 import mx.events.CollectionEventKind; 7 8 8 public class CMDComponent implements XmlAble, AttributeContainer {9 public class CMDComponent implements XmlAble, AttributeContainer, ChangeTrackingCMDElement { 9 10 10 11 //Attributes … … 38 39 if(event.kind == CollectionEventKind.ADD ||event.kind == CollectionEventKind.MOVE || event.kind == CollectionEventKind.REMOVE){ 39 40 setChanged(true); 41 } 42 if(event.kind == CollectionEventKind.ADD){ 43 for each(var item:ChangeTrackingCMDElement in event.items){ 44 item.changeTracking = _changeTracking; 45 } 40 46 } 41 47 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentElement.as
r1946 r1949 1 1 package clarin.cmdi.componentregistry.editor.model { 2 import clarin.cmdi.componentregistry.common.ChangeTrackingCMDElement; 2 3 import clarin.cmdi.componentregistry.common.ComponentMD; 3 4 import clarin.cmdi.componentregistry.common.XmlAble; … … 6 7 7 8 import mx.collections.ArrayCollection; 8 9 import mx.events.CollectionEvent; 10 import mx.events.CollectionEventKind; 11 9 12 [Bindable] 10 public class CMDComponentElement implements XmlAble, ValueSchemeInterface, AttributeContainer {11 13 public class CMDComponentElement implements XmlAble, ValueSchemeInterface, AttributeContainer, ChangeTrackingCMDElement { 14 12 15 //Attributes 13 16 public var name:String; … … 19 22 public var cardinalityMin:String = "1"; 20 23 public var cardinalityMax:String = "1"; 21 24 22 25 //elements 23 26 public var attributeList:ArrayCollection = new ArrayCollection(); … … 25 28 private var _valueSchemePattern:String; 26 29 private var changed:Boolean = false; 27 p ublic varchangeTracking:Boolean = false;28 30 private var _changeTracking:Boolean = false; 31 29 32 public function CMDComponentElement() { 33 attributeList.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionChangedHandler); 34 } 35 36 public function set changeTracking(value:Boolean):void{ 37 _changeTracking = value; 38 for each (var attribute:CMDAttribute in attributeList){ 39 attribute.changeTracking = value; 40 } 41 } 42 43 private function collectionChangedHandler(event:CollectionEvent):void { 44 if(event.kind == CollectionEventKind.ADD ||event.kind == CollectionEventKind.MOVE || event.kind == CollectionEventKind.REMOVE){ 45 setChanged(true); 46 } 47 if(event.kind == CollectionEventKind.ADD){ 48 for each(var item:ChangeTrackingCMDElement in event.items){ 49 item.changeTracking = _changeTracking; 50 } 51 } 30 52 } 31 53 32 54 public function setChanged(value:Boolean):void { 33 if( changeTracking) {55 if(_changeTracking) { 34 56 this.changed = value; 35 57 } … … 37 59 38 60 public function get hasChanged():Boolean{ 39 return changed; 61 if(changed){ 62 return changed; 63 } else { 64 for each (var attribute:CMDAttribute in attributeList){ 65 if(attribute.hasChanged){ 66 return true; 67 } 68 } 69 } 70 return false; 40 71 } 41 72 42 73 public static function createEmptyElement():CMDComponentElement { 43 74 var result:CMDComponentElement = new CMDComponentElement(); … … 45 76 return result; 46 77 } 47 48 78 79 49 80 public function get valueSchemeSimple():String { 50 81 return this._valueSchemeSimple 51 82 } 52 83 53 84 public function set valueSchemeSimple(valueSchemeSimple:String):void { 54 85 this._valueSchemeSimple = valueSchemeSimple; 55 86 setChanged(true); 56 87 } 57 88 58 89 public function get valueSchemeEnumeration():ArrayCollection { 59 90 return this._valueSchemeEnumeration 60 91 } 61 92 62 93 public function set valueSchemeEnumeration(valueSchemeEnumeration:ArrayCollection):void { 63 94 this._valueSchemeEnumeration = valueSchemeEnumeration; 64 95 setChanged(true); 65 96 } 66 97 67 98 public function get valueSchemePattern():String { 68 99 return this._valueSchemePattern; 69 100 } 70 101 71 102 public function set valueSchemePattern(valueSchemePattern:String):void { 72 103 this._valueSchemePattern = valueSchemePattern; 73 104 setChanged(true); 74 105 } 75 106 76 107 public function toXml():XML { 77 108 var result:XML = <CMD_Element></CMD_Element>; … … 111 142 return result; 112 143 } 113 144 114 145 public function getAttributeList():ArrayCollection { 115 146 return attributeList; 116 147 } 117 148 118 149 } 119 150 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpec.as
r1946 r1949 1 1 package clarin.cmdi.componentregistry.editor.model { 2 import clarin.cmdi.componentregistry.common.ChangeTrackingCMDElement; 2 3 import clarin.cmdi.componentregistry.common.XmlAble; 3 4 4 5 import mx.collections.ArrayCollection; 5 6 import mx.events.CollectionEvent; 7 import mx.events.CollectionEventKind; 6 8 7 9 [Bindable] 8 public class CMDSpec implements XmlAble {10 public class CMDSpec implements XmlAble, ChangeTrackingCMDElement { 9 11 //Attribute 10 12 public var isProfile:Boolean; … … 55 57 56 58 private function collectionChangedHandler(event:CollectionEvent):void { 57 setChanged(true); 59 if(event.kind == CollectionEventKind.ADD ||event.kind == CollectionEventKind.MOVE || event.kind == CollectionEventKind.REMOVE){ 60 setChanged(true); 61 } 62 if(event.kind == CollectionEventKind.ADD){ 63 for each(var item:ChangeTrackingCMDElement in event.items){ 64 item.changeTracking = _changeTracking; 65 } 66 } 58 67 } 59 68
Note: See TracChangeset
for help on using the changeset viewer.