Model

A Model is a representation of data. Extend the Model into a custom class to add data fields that can be saved/loaded. To reference other Models, use the ModelRef and ModelRefs to keep references intact after serialization.

A Model will delete itself automatically when all ModelRef(s) stop referencing it.

Use Models in combination with Controllers for max use.

Static Methods

SaveAll Saves all models into ModelBlobs or in separate xml files in a given directory.
Save Saves the given Model and referenced Models into ModelBlobs or in separate xml files in a given directory.
Load Reads the given ModelBlobs or xml files in the given directory and constructs models accordingly.
Find Returns the Model with the given type and/or id.
First Returns the first found instance of the given Model type.
GetAll Returns all Models, optionally of a given type.
DeleteAll Deletes all models, optionally of a given type.

Fields

Id The id of this Model, which can be used to find it later on.

Methods

AddChangeListener Adds a listener that triggers the given callback when the NotifyChange is called on this Model.
RemoveChangeListener Removes a listener that would trigger the given callback when the NotifyChange is called on this Model.
AddDeleteListener Adds a listener that triggers the given callback when this Model is deleted.
RemoveDeleteListener Removes a listener that triggers the given callback when this Model is deleted.
NotifyChange Sends out callbacks to this Model’s change listeners.
Delete Deletes this Model, removing it from ModelRefs lists and destroying its linked Controllers.