Search the web
Sign In
New User? Sign Up
cairngorm-devel · Cairngorm Developers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
FlexPhoneBook ModelLocator problem   Message List  
Reply | Forward Message #47 of 210 |
RE: [cairngorm-devel] FlexPhoneBook ModelLocator problem

Maybe don't do model = new ModelLocator() in the getInstance() function
since you'll assign ModelLocator.model in the constructor?

Matt

-----Original Message-----
From: cairngorm-devel@yahoogroups.com
[mailto:cairngorm-devel@yahoogroups.com] On Behalf Of gault17
Sent: Tuesday, January 17, 2006 9:29 AM
To: cairngorm-devel@yahoogroups.com
Subject: [cairngorm-devel] FlexPhoneBook ModelLocator problem

I'm trying to implement a ModelLocator similar to the one use in the
FlexPhoneBook example. However, whenever I try to compile the app, I
get
a java.lang.StackOverflowError in FlexXmlServlet (with no stack
trace). If I remove the getInstance function, it compiles fine. Can
someone explain what my problem is? Thanks for your assistance.

Gary


Code below:

import control.*;
import vo.*;
import model.*;
import de.richinternet.utils.Dumper;

class model.ModelLocator
{

private static var model : ModelLocator;
public static var statusMessage : String = "";


public static var users : Array;
public static var selectedUser : UserVO;
public static var trees : Array;
public static var selectedTree : TreeVO;
private var _tasks : Array;

public static var selectedTask : TaskVO;

public static function getInstance() : ModelLocator {
Dumper.dump("modellocator getInstance");
if( model == undefined ) {

model = new ModelLocator();
model.initialize();
}
return model;
}

public function ModelLocator() {
if( ModelLocator.model != undefined ) throw new Error( "Only one
Model instance should be instantiated" );
ModelLocator.model = this;
mx.events.EventDispatcher.initialize( this );
}

public function initialize() : Void {
selectedUser=new UserVO();
selectedTask=new TaskVO();
selectedTree=new TreeVO();

}


public function get tasks() : Array {
if (_tasks == undefined) {
EventBroadcaster.getInstance().broadcastEvent
("getTaskList");

}


return _tasks;
}
public function set tasks(data: Array): Void {
_tasks = data;
}


}






Yahoo! Groups Links









Tue Jan 17, 2006 6:34 pm

m_chotin
Offline Offline
Send Email Send Email

Forward
Message #47 of 210 |
Expand Messages Author Sort by Date

I'm trying to implement a ModelLocator similar to the one use in the FlexPhoneBook example. However, whenever I try to compile the app, I get a...
gault17
Offline Send Email
Jan 17, 2006
6:23 pm

Maybe don't do model = new ModelLocator() in the getInstance() function since you'll assign ModelLocator.model in the constructor? Matt ... From:...
Matt Chotin
m_chotin
Offline Send Email
Jan 17, 2006
6:36 pm

Ok. Thanks, Matt. I followed the ModelLocator approach used in Cairngormstore (has no getInstance() function and initialize() is called from the application...
Ault, Gary - BLS
gault17
Offline Send Email
Jan 18, 2006
4:18 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help