Namespace mmir.ModelManager
Defined in: modelManager.js.
Constructor Attributes | Constructor Name and Description |
---|---|
A class for managing the models of the application (MVC-Component).
|
Field Attributes | Field Name and Description |
---|---|
<private> <constant> |
The global namespace
|
<private> <constant> |
Name of the default namespace
(within the global space)
into which Models will be loaded
|
<private> |
Array of models
|
Method Attributes | Method Name and Description |
---|---|
<private> |
_init(myCallbackFunction)
This function invokes the method
mmir.ModelManager#foundModelsCallBack to load all
models in the path specified by *modelPath*.
|
<private> |
doGetModelInstance(modelImplObject)
Returns the instance for a model implementation:
If the model-object is a constructor (i.e.
|
<private> |
getFullModelName(modelClassName)
This function returns the fully qualified model name (including namespace(s)).
|
getModel(modelName)
This function gets the model by name.
|
|
<private> |
getModelByName(fullModelName)
This function returns the fully qualified model name (incl.
|
This function returns all loaded models.
|
|
This function returns all loaded models.
|
|
<private> |
init()
init as alias for #getInstance |
Namespace Detail
mmir.ModelManager
A class for managing the models of the application (MVC-Component).
It's purpose is to load the models automatically. This "class" is a singleton - so that only one instance is in use.
TODO add example for usage (models as "class" / models as "singleton")
It's purpose is to load the models automatically. This "class" is a singleton - so that only one instance is in use.
TODO add example for usage (models as "class" / models as "singleton")
- Requires:
- jQuery.Deferred
Field Detail
<private> <constant>
{Object}
GLOBAL_NAMESPACE
The global namespace
<private> <constant>
{String}
MODEL_DEFAULT_NAMESPACE_NAME
Name of the default namespace
(within the global space)
into which Models will be loaded
<private>
{Dictionary}
models
Array of models
Method Detail
<private>
_init(myCallbackFunction)
This function invokes the method
mmir.ModelManager#foundModelsCallBack to load all
models in the path specified by *modelPath*.
- Parameters:
- {Function} myCallbackFunction
- The callback function from the constructor which shall be called after the initialization of the mmir.ModelManager.
<private>
doGetModelInstance(modelImplObject)
Returns the instance for a model implementation:
If the model-object is a constructor (i.e. a function),
a new instance is created and returned.
Otherwise the model-object itself is returned (e.g. for
singleton pattern models).
- Parameters:
- modelImplObject
<private>
{String}
getFullModelName(modelClassName)
This function returns the fully qualified model name (including namespace(s)).
- Parameters:
- {String} modelClassName
- the model's class-name (i.e. without namespace)
- Returns:
- {String} fully qualified name for the model
getInstance()
- Deprecated:
- use ModelManager object directly, e.g. instead of: mmir.ModelManager.getInstance().getModel() use: mmir.ModelManager.getModel() NOTE: ModelManager must be initialized before it can be used.
{Object}
getModel(modelName)
This function gets the model by name.
- Parameters:
- {String} modelName
- Name of the model which should be returned
- Returns:
- {Object} The model if found, null else
<private>
{Object}
getModelByName(fullModelName)
This function returns the fully qualified model name (incl. namespace(s)).
- Parameters:
-
{String|Array
} fullModelName - the fully qualified model name (i.e. with namespace(s))
Note, if {String} components/namespaces are separated by a . (dot)
If {Array
} the entries correspond to the namespace components (without dots), where the last entry corresponds to the class/singleton name
- Returns:
- {Object} the "raw" model object (may be a constructor or the main-singleton-namespace). Or null if there is no Model with the name.
- Requires:
- mmir.CommonUtils#isArray
{Array}
getModelNames()
This function returns all loaded models.
- Returns:
- {Array
} all loaded model names
{Array}
getModels()
This function returns all loaded models.
- Returns:
- {Array} All loaded models
<private>
init()
init
as alias for #getInstance