Module: nagvis Branch: master Commit: 14ffb6684f58f3a1cace4789c465408219ab6250 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=14ffb6684f58f3a1cace4789c465408219ab6250
Author: Andriy Skuratov <[email protected]> Date: Wed Aug 19 17:32:53 2009 +0300 gmap: Fixed the newly created links to contain locations properly. --- uifx/src/modules/gmap/data/LinksData.as | 27 ++++++++++++++++++++------- uifx/src/modules/gmap/mate/StartupEM.mxml | 8 ++++++-- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/uifx/src/modules/gmap/data/LinksData.as b/uifx/src/modules/gmap/data/LinksData.as index 0da6496..5facae6 100644 --- a/uifx/src/modules/gmap/data/LinksData.as +++ b/uifx/src/modules/gmap/data/LinksData.as @@ -22,26 +22,35 @@ package modules.gmap.data { import modules.gmap.domain.Link; - + import mx.collections.ArrayCollection; - import mx.events.CollectionEvent; public class LinksData extends ArrayCollection { + private var _locations : LocationsData; + public function LinksData(source : Array = null) { super(source); } - public function fill(data : Array, locations:LocationsData) : void + public function set locations(value:LocationsData):void + { + _locations = value; + } + + public function fill(data : Array) : void { this.source = data; for each(var link : Link in this) - { - link.location1 = locations.getItemById(link.id1); - link.location2 = locations.getItemById(link.id2); - } + resolveLink(link); + } + + protected function resolveLink(link:Link):void + { + link.location1 = _locations.getItemById(link.id1); + link.location2 = _locations.getItemById(link.id2); } public function getItemByIds(id1 : String, id2 : String) : Link @@ -55,10 +64,14 @@ package modules.gmap.data public function addUpdateItem(item : Link) : void { + trace(item.id1); var link : Link = this.getItemByIds(item.id1, item.id2); if (link == null) + { + resolveLink(item); this.addItem(item); + } else link.update(item); } diff --git a/uifx/src/modules/gmap/mate/StartupEM.mxml b/uifx/src/modules/gmap/mate/StartupEM.mxml index f78359b..c98b851 100644 --- a/uifx/src/modules/gmap/mate/StartupEM.mxml +++ b/uifx/src/modules/gmap/mate/StartupEM.mxml @@ -50,18 +50,22 @@ <MethodInvoker generator="{ViewpointsData}" method="fill" arguments="{resultObject}"/> </resultHandlers> </RemoteObjectInvoker> + <RemoteObjectInvoker destination="zend" source="LocationService" method="getAll" debug="true"> <resultHandlers> <MethodInvoker generator="{LocationsData}" method="fill" arguments="{resultObject}"/> <MethodInvoker generator="{Poller}" method="resourceReady"/> + + <DataCopier destination="{LinksData}" destinationKey="locations" source="{LocationsData}"/> <RemoteObjectInvoker destination="zend" source="LinkService" method="getAll" debug="true"> <resultHandlers> - <DataCopier destination="data" destinationKey="locations" source="{LocationsData}"/> - <MethodInvoker generator="{LinksData}" method="fill" arguments="{[resultObject, data.locations]}"/> + <MethodInvoker generator="{LinksData}" method="fill" arguments="{resultObject}"/> </resultHandlers> </RemoteObjectInvoker> + </resultHandlers> </RemoteObjectInvoker> + <RemoteObjectInvoker destination="zend" source="NagVisService" method="getMaps"> <resultHandlers> <MethodInvoker generator="{NagVisMapsData}" method="fill" arguments="{resultObject}"/> ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
