Is it OK to have a constructor in the Command classes and have delegate initialized there rather than doing it in every time execute method is called?
So Could the code of LoginCommand of sample code that came with CAIRNGORM 0.99 be changed to: class org.nevis.cairngorm.samples.login.commands.LoginCommand implements Command, Responder { private var delegate: CustomerDelegate; public function LoginCommand () { delegate = new CustomerDelegate( this ); } public function execute( event:Event ) : Void { var loginVO : LoginVO = LoginVO( event.data ); delegate.login( loginVO ); } //------------------------------------------------------------------- ------ public function onResult( event : Object ) : Void { ModelLocator.workflowState = ModelLocator.VIEWING_LOGGED_IN_SCREEN; var loginDate : Date = Date( event.result ); ModelLocator.loginDate = loginDate; } //------------------------------------------------------------------- ------ public function onFault( event : Object ) : Void { ModelLocator.statusMessage = "Your username or password was wrong, please try again."; } } from /* Copyright 2005 iteration::two Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. @ignore */ import org.nevis.cairngorm.business.Responder; import org.nevis.cairngorm.commands.Command; import org.nevis.cairngorm.control.Event; import org.nevis.cairngorm.samples.login.business.CustomerDelegate; import org.nevis.cairngorm.samples.login.vo.LoginVO; import org.nevis.cairngorm.samples.login.model.ModelLocator; /** * @version $Revision: 1.4 $ */ class org.nevis.cairngorm.samples.login.commands.LoginCommand implements Command, Responder { public function execute( event:Event ) : Void { var delegate: CustomerDelegate = new CustomerDelegate( this ); var loginVO : LoginVO = LoginVO( event.data ); delegate.login( loginVO ); } //------------------------------------------------------------------- ------ public function onResult( event : Object ) : Void { ModelLocator.workflowState = ModelLocator.VIEWING_LOGGED_IN_SCREEN; var loginDate : Date = Date( event.result ); ModelLocator.loginDate = loginDate; } //------------------------------------------------------------------- ------ public function onFault( event : Object ) : Void { ModelLocator.statusMessage = "Your username or password was wrong, please try again."; } } ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- 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/