| Changes to /trunk/propertiesInvalidation/src/com/tearaway_tea/model/OpportunityDTO.as |
r0 vs. r23
Edit
|
r23
|
| /trunk/propertiesInvalidation/src/com/tearaway_tea/model/OpportunityDTO.as | /trunk/propertiesInvalidation/src/com/tearaway_tea/model/OpportunityDTO.as r23 | ||
| 1 | package com.tearaway_tea.model | ||
|---|---|---|---|
| 2 | { | ||
| 3 | import flash.events.EventDispatcher; | ||
| 4 | |||
| 5 | import mx.collections.ArrayCollection; | ||
| 6 | |||
| 7 | import org.goverla.interfaces.IPropertiesInvalidable; | ||
| 8 | import org.goverla.managers.PropertiesInvalidationManager; | ||
| 9 | |||
| 10 | public class OpportunityDTO extends EventDispatcher implements IPropertiesInvalidable | ||
| 11 | { | ||
| 12 | public function get date() : Date | ||
| 13 | { | ||
| 14 | return _date; | ||
| 15 | } | ||
| 16 | |||
| 17 | public function set date(value : Date) : void | ||
| 18 | { | ||
| 19 | _date = value; | ||
| 20 | _dateChanged = true; | ||
| 21 | invalidateProperties(); | ||
| 22 | } | ||
| 23 | |||
| 24 | public function get children() : ArrayCollection | ||
| 25 | { | ||
| 26 | return _children; | ||
| 27 | } | ||
| 28 | |||
| 29 | public function set children(value : ArrayCollection) : void | ||
| 30 | { | ||
| 31 | _children = value; | ||
| 32 | _childrenChanged = true; | ||
| 33 | invalidateProperties(); | ||
| 34 | } | ||
| 35 | |||
| 36 | public function invalidateProperties() : void | ||
| 37 | { | ||
| 38 | PropertiesInvalidationManager.instance.invalidateProperties(this); | ||
| 39 | } | ||
| 40 | |||
| 41 | public function commitProperties() : void | ||
| 42 | { | ||
| 43 | if (_dateChanged && _childrenChanged) | ||
| 44 | { | ||
| 45 | _dateChanged = false; | ||
| 46 | _childrenChanged = false; | ||
| 47 | |||
| 48 | for each (var item : ItemDTO in children) | ||
| 49 | { | ||
| 50 | item.name += "/" + date.toString(); | ||
| 51 | } | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | private var _date : Date; | ||
| 56 | |||
| 57 | private var _dateChanged : Boolean; | ||
| 58 | |||
| 59 | private var _children : ArrayCollection; | ||
| 60 | |||
| 61 | private var _childrenChanged : Boolean; | ||
| 62 | } | ||
| 63 | } | ||