Packagecom.yworks.canvas.model
Classpublic class CollectionModelManager
InheritanceCollectionModelManager Inheritance ModelManager Inheritance Object

An implementation of the ModelManager class that automatically installs, updates and removes visual representations of items in an ICollectionModel.



Public Properties
 PropertyDefined By
 Inheritedcanvas : 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
Protected Properties
 PropertyDefined By
 Inherited_canvas : CanvasComponent
The canvas instance this instance is managing.
ModelManager
Public Methods
 MethodDefined By
  
Constructs a new instance of CollectionModelManager
CollectionModelManager
 Inherited
Adds an item to the canvas.
ModelManager
  
Adds an item installer to the list of installers that will be queried during an install call.
CollectionModelManager
 Inherited
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
  
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
  
Retrieves the main canvas object that has been registered for the given item or null.
CollectionModelManager
 Inherited
Removes the canvas objects associated with the given descriptor handle.
ModelManager
  
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
 Inherited
Updates the item in the canvas by uninstalling and reinstalling it into the canvas.
ModelManager
Protected Methods
 MethodDefined By
  
install(member:Object):Array
[override] Abstract method that actually adds the visual representation of an item to the canvas.
CollectionModelManager
 Inherited
uninstall(descriptor:IModelItemDescriptor, canvasObjects:Array):void
Simple implementation that removes all of the given canvasObjects.
ModelManager
Property Detail
collectionModelproperty
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.


Implementation
    public function get collectionModel():ICollectionModel
    public function set collectionModel(value:ICollectionModel):void
Constructor Detail
CollectionModelManager()Constructor
public function CollectionModelManager(canvas:CanvasComponent, model:ICollectionModel = null, mapper:DictionaryMapper = null)

Constructs a new instance of CollectionModelManager

Parameters
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.
Method Detail
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.

Returns
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.

Returns
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.

Returns
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.

Returns
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.

Returns
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.