Package | com.yworks.canvas.model |
Class | public class CollectionModelManager |
Inheritance | CollectionModelManager ModelManager Object |
ModelManager
class
that automatically installs, updates and removes visual representations
of items in an ICollectionModel
.
Property | Defined By | ||
---|---|---|---|
canvas : CanvasComponent [read-only]
Gets the canvas instance this instance is managing. | ModelManager | ||
collectionModel : ICollectionModel
Gets or sets the model of the items to display in the canvas. | CollectionModelManager |
Method | Defined By | ||
---|---|---|---|
CollectionModelManager(canvas:CanvasComponent, model:ICollectionModel = null, mapper:DictionaryMapper = null)
Constructs a new instance of CollectionModelManager
| CollectionModelManager | ||
add(item:Object):IModelItemDescriptor
Adds an item to the canvas. | ModelManager | ||
addInstaller(installer:IModelItemInstaller):void
Adds an item installer to the list of installers that will be queried
during an install call. | CollectionModelManager | ||
containsDescriptor(descriptor:IModelItemDescriptor):Boolean
Checks whether this descriptor is currently being managed by this instance. | ModelManager | ||
getCanvasObjects(item:Object):Array
Retrieves all canvas objects that have been registered for the given item or null. | CollectionModelManager | ||
getDescriptor(item:Object):IModelItemDescriptor
Obtains the descriptor associated with the given item using the internal mapper. | CollectionModelManager | ||
getItem(forObject:ICanvasObject, type:Class):Object
Tries to find the item managed by this instance that is associated with
the given canvas object. | CollectionModelManager | ||
getMainCanvasObject(item:Object):ICanvasObject
Retrieves the main canvas object that has been registered for the given item or null. | CollectionModelManager | ||
removeDescriptor(descriptor:IModelItemDescriptor):void
Removes the canvas objects associated with the given descriptor handle. | ModelManager | ||
removeInstaller(installer:IModelItemInstaller):void
Removes a previously registered installer from the list of installers. | CollectionModelManager | ||
update(item:Object):void
This method may be called to update the visual representation of the given item. | CollectionModelManager | ||
updateDescriptor(descriptor:IModelItemDescriptor):Boolean
Updates the item in the canvas by uninstalling and reinstalling it
into the canvas. | ModelManager |
Method | Defined By | ||
---|---|---|---|
install(member:Object):Array [override]
Abstract method that actually adds the visual representation of an item
to the canvas. | CollectionModelManager | ||
uninstall(descriptor:IModelItemDescriptor, canvasObjects:Array):void
Simple implementation that removes all of the given canvasObjects. | ModelManager |
collectionModel | property |
collectionModel:ICollectionModel
Gets or sets the model of the items to display in the canvas.
Setting the model will automatically remove the items installed for a previously installed model. Also the items contained in the new model will immediately be queried and installed into the canvas.
public function get collectionModel():ICollectionModel
public function set collectionModel(value:ICollectionModel):void
CollectionModelManager | () | Constructor |
public function CollectionModelManager(canvas:CanvasComponent, model:ICollectionModel = null, mapper:DictionaryMapper = null)
Constructs a new instance of CollectionModelManager
canvas:CanvasComponent — The canvas to manage.
| |
model:ICollectionModel (default = null ) — The model to manage.
| |
mapper:DictionaryMapper (default = null ) — The mapper to use for mapping internal state.
|
addInstaller | () | method |
public function addInstaller(installer:IModelItemInstaller):void
Adds an item installer to the list of installers that will be queried
during an install
call.
Parameters
installer:IModelItemInstaller — An installer that is capable of installing an item into the canvas.
|
getCanvasObjects | () | method |
public function getCanvasObjects(item:Object):Array
Retrieves all canvas objects that have been registered for the given item or null
.
Parameters
item:Object — The item to retrieve the canvas objects for.
|
Array — An array of canvas object instances or null .
|
getDescriptor | () | method |
public function getDescriptor(item:Object):IModelItemDescriptor
Obtains the descriptor associated with the given item using the internal mapper.
Parameters
item:Object — The item to retrieve the descriptor handle for.
|
IModelItemDescriptor — The descriptor or null .
|
getItem | () | method |
public function getItem(forObject:ICanvasObject, type:Class):Object
Tries to find the item managed by this instance that is associated with the given canvas object.
Parameters
forObject:ICanvasObject — The canvas object to query the corresponding model item for.
| |
type:Class — The type of the item that is to be returned.
|
Object — The item or null if no such item could be found.
|
getMainCanvasObject | () | method |
public function getMainCanvasObject(item:Object):ICanvasObject
Retrieves the main canvas object that has been registered for the given item or null
.
This implementation treats the first element in the array of canvas objects installed into the canvas for the item as the main object.
Parameters
item:Object — The item to retrieve "the" canvas object for.
|
ICanvasObject — A canvas object instance or null .
|
install | () | method |
override protected function install(member:Object):Array
Abstract method that actually adds the visual representation of an item to the canvas.
Parameters
member:Object — The item whose visual representation is to be added to the canvas.
|
Array — An array of canvas objects this instance has added to the canvas for the given item.
|
removeInstaller | () | method |
public function removeInstaller(installer:IModelItemInstaller):void
Removes a previously registered installer from the list of installers.
Parameters
installer:IModelItemInstaller — The installer to be removed.
|
update | () | method |
public function update(item:Object):void
This method may be called to update the visual representation of the given item.
This will trigger a call to updateDescriptor
for the descriptor
associated with the item. If there is no descriptor, add
will be called.
Parameters
item:Object — The item to update.
|