Package | com.soma.core.model |
Class | public class SomaModels |
Inheritance | SomaModels ![]() |
Author: Romuald Quantin - www.soundstep.com
Resources: http://www.soundstep.com/downloads/somacore
Actionscript version: 3.0
Copyright: Mozilla Public License 1.1 (MPL 1.1) http://www.opensource.org/licenses/mozilla1.1.php
The SomaModels class handles the models of the application. See the Model class documentation for implementation.See also
Property | Defined By | ||
---|---|---|---|
models : Dictionary
List of the models registered to the framework. | SomaModels |
Method | Defined By | ||
---|---|---|---|
SomaModels(instance:ISoma)
Create an instance of the SomaModels class. | SomaModels | ||
Registers a model to the framework. | SomaModels | ||
dispose():void
Destroys all the models and properties. | SomaModels | ||
Retrieves the model instance that has been registered using its name. | SomaModels | ||
getModels():Dictionary
Retrieves all the model instances that have been registered to the framework. | SomaModels | ||
hasModel(modelName:String):Boolean
Indicates wether a model has been registered to the framework. | SomaModels | ||
removeModel(modelName:String):void
Removes a model from the framework and call the dispose method of this model. | SomaModels |
models | property |
protected var models:Dictionary
List of the models registered to the framework.
SomaModels | () | Constructor |
public function SomaModels(instance:ISoma)
Create an instance of the SomaModels class. Should not be directly instantiated, the framework will instantiate the class.
Parametersinstance:ISoma — Framework instance.
|
addModel | () | method |
public function addModel(modelName:String, model:IModel):IModel
Registers a model to the framework.
Parameters
modelName:String — Name of the model.
| |
model:IModel — Instance of the model.
|
IModel — The model instance.
|
addModel(MyModel.NAME, new MyModel());
dispose | () | method |
public function dispose():void
Destroys all the models and properties. The class will call the dispose method of each model instance.
getModel | () | method |
public function getModel(modelName:String):IModel
Retrieves the model instance that has been registered using its name.
Parameters
modelName:String — Name of the model.
|
IModel — A IModel instance.
|
var myModel:MyModel = getModel(MyModel.NAME) as MyModel;
getModels | () | method |
public function getModels():Dictionary
Retrieves all the model instances that have been registered to the framework.
ReturnsDictionary — A Dictionary (the key of the Dictionary is the name used for the registration).
|
var models:Dictionary = getModels();
hasModel | () | method |
public function hasModel(modelName:String):Boolean
Indicates wether a model has been registered to the framework.
Parameters
modelName:String — Name of the model.
|
Boolean — A Boolean.
|
hasModel(MyModel.NAME);
removeModel | () | method |
public function removeModel(modelName:String):void
Removes a model from the framework and call the dispose method of this model.
Parameters
modelName:String — Name of the model.
|
removeModel(MyModel.NAME);