| Package | com.adobe.cairngorm.model |
| Interface | public interface ModelLocator extends IModelLocator |
Deprecated as of Cairngorm 2.1, replaced by com.adobe.cairngorm.model.IModelLocator
Deprecated, replaced by com.adobe.cairngorm.model.IModelLocator Marker interface used to mark the custom ModelLocator.ModelLocator is the marker interface used by Cairngorm applications to implement the model in an Model-View-Controller architecture.
The model locator in an application is a singleton that the application uses to store the client side model. An example implementation might be:
[Bindable]
public class ShopModelLocator implements ModelLocator
{
private static var instance : ShopModelLocator;
public function ShopModelLocator()
{
if ( instance != null )
{
throw new CairngormError(
CairngormMessageCodes.SINGLETON_EXCEPTION, "ShopModelLocator" );
}
instance = this;
}
public static function getInstance() : ShopModelLocator
{
if ( instance == null )
instance = new ShopModelLocator();
return instance;
}
public var products : ICollectionView;
}
Throughout the rest of the application, the developer can then access the products from the model, as follows:
var products : ICollectionView = ShopModelLocator.getInstance().products;