Hello all. 
 I have a requirement that allows users to do submit a search query
which when submitted, adds a new tab to the tab navigator, with a
datagrid, and adds the returned data as the dataprovider to the
datagrid within that tab. That all works fine. 

However, I have data that is being pushed to the client via the
XMLSocket so I need to maintain a registry which maps the name of each
datagrid dataprovider to the criteria that matches the data being
pushed in (so that I know which dataprovider(s) the incoming piece of
data relates to).

I set up a singleton that contains an Actionscript like Hashmap, but
I'm having trouble setting it b/c I'm using the cairngorm framework
and when data returns via the onResult handler within the Command
class, I only have the result event and not the other data I need to
create my hashmap object (i.e. - the key -- which in this case is the
name of the datagrid).

Here's a copy of my Command class. As you can see, within the execute
method I capture the other 2 pieces of data I need from the event
object passed in. The dataGridName is the key of my map (which is
implemented in the Singleton class named 'Registry'). Here, I try to
assign the 2 vartaiables to an instance variables so I can later
access it in the onResult method, but that didn't work. I get compiler
errors. This isn't the ideal way to do it I know and I'm trying to
think of a pattern that can fix this. Perhaps there's a way
Actionscript itself lends to this. Any help is appreciated. Thanks.

class org.nevis.cairngorm.samples.store.command.GetTripsCommand
implements Command, Responder
{
        private var dataGridName : String;
        private var relatedData: Array;
        
        public function GetTripsCommand()
        {        
        }
        
//----------------------------------------------------------------------------

        public function execute( event : Event ):Void
        {
                this.dataGridName = event.dataGridName ;
                this.relatedData= event.relatedData;
                
                var delegate : TripDelegate = new TripDelegate( this );
                delegate.getTrips();
        }
        
//----------------------------------------------------------------------------

        public function onResult( event : Object ) : Void
        {                               
                var trips : Array = event.result;
                Registry.getInstance().addEntry(new RegistryEntry(dataGridName ,
relatedData, trips));
                
        }
}







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to