| Package | com.yworks.canvas.model |
| Class | public class CollectionModelManager |
| Inheritance | CollectionModelManager ModelManager |
ModelManager class
that automatically installs, updates and removes visual representations
of items in an ICollectionModel.
| Property | Defined by | ||
|---|---|---|---|
![]() | canvas : CanvasComponent
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:IMapper = null)
Constructs a new instance of
CollectionModelManager
| CollectionModelManager | ||
![]() |
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:IModelItem):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 | ||
|
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):void
Updates the item in the canvas by uninstalling and reinstalling it
into the canvas.
| ModelManager | |
| Method | Defined by | ||
|---|---|---|---|
|
install(member:IModelItem):Array
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 [read-write]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
| CollectionModelManager | () | constructor |
public function CollectionModelManager(canvas:CanvasComponent, model:ICollectionModel = null, mapper:IMapper = null)
Constructs a new instance of CollectionModelManager
canvas:CanvasComponent — The canvas to manage.
|
|
model:ICollectionModel (default = null) — The model to manage.
|
|
mapper:IMapper (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.
installer:IModelItemInstaller — An installer that is capable of installing an item of type T into the canvas.
|
| getCanvasObjects | () | method |
public function getCanvasObjects(item:IModelItem):Array
Retrieves all canvas objects that have been registered for the given item or null.
item:IModelItem — The item to retrieve the canvas objects for.
|
Array — An array of canvas object instances or null.
|
| getDescriptor | () | method |
public function getDescriptor(item:Object):IModelItemDescriptorObtains the descriptor associated with the given item using the internal mapper.
Parametersitem:Object — The item to retrieve the descriptor handle for.
|
IModelItemDescriptor —
The descriptor or null.
|
| getItem | () | method |
public function getItem(forObject:ICanvasObject, type:Class):ObjectTries to find the item managed by this instance that is associated with the given canvas object.
ParametersforObject: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:IModelItem):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.
Parametersitem:IModelItem — The item to retrieve "the" canvas object for.
|
ICanvasObject —
A canvas object instance or null.
|
| install | () | method |
protected override function install(member:IModelItem):ArrayAbstract method that actually adds the visual representation of an item to the canvas.
Parametersmember:IModelItem — 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):voidRemoves a previously registered installer from the list of installers.
Parametersinstaller:IModelItemInstaller — The installer to be removed.
|
| update | () | method |
public function update(item:Object):voidThis method may be called to update the visual representation of the given item.
This will trigger a call to code>updateDescriptor for the descriptor
associated with the item. If there is no descriptor, add will be called.
item:Object — The item to update.
|