| Package | com.adobe.rtc.sharedModel |
| Class | public class SharedCollection |
| Inheritance | SharedCollection mx.collections.ListCollectionView |
| Implements | ISessionSubscriber |
The collection does not share sort order - any sorting desired should be performed on each respective client. As such,
addItemAt isn't supported, although addItem is. The collection makes update decisions on items based on a unique id -
items added to the collection should either implement the IUID interface, or provide a field which is guaranteed to be unique
for this collection. The SharedCollection exposes an idField property to specify which field to use as unique id, in the case the items
do not implement IUID.
At the moment (due to issues with the service which we're investigating), class types are not preserved
once sent and received from the service. However, by specifying the itemClass property of the SharedCollection, the collection will
automatically create instances of the appropriate class and transfer any properties from the received item to the typed objects.
The SharedCollection exposes the ability to set NodeConfiguration options for the node upon which the items are sent - in this way
the collection can have its access and publish rights assigned, as well as the other settings allowed by NodeConfiguration.
Note that this component supports "piggybacking" on existing CollectionNodes, through its
See also
collectionNode property, and its subscribe
method - developers can avoid CollectionNode proliferation in their apps by pre-supplying a CollectionNode (to the collectionNode property)
and a nodeName (in the subscribe method) for the SharedCollection to use. If none is supplied, the SharedCollection will create its own
collectionNode (named for the uniqueID supplied in subscribe()) for sending and receiving messages.
| Property | Defined by | ||
|---|---|---|---|
| collectionNode : CollectionNode
Specifies an existing collectionNode to use in case a developer wishes to supply their own, and avoid having the
sharedCollection create a new one.
| SharedCollection | ||
| connectSession : IConnectSession
The IConnectSession with which this component is associated.
| SharedCollection | ||
| idField : String
If each item doesn't implement IUID, specifies a field within the item to use as a unique ID.
| SharedCollection | ||
| isSynchronized : Boolean [read-only]
Returns whether or not the sharedCollection has retrieved any information previously stored on the service, and
is currently connected to the service.
| SharedCollection | ||
| itemClass : Class
Specifies the class to use in deserializing any items which arrive from the service.
| SharedCollection | ||
| nodeName : String
Sets the Node name for the node being create
| SharedCollection | ||
| sharedID : String
Defines the logical location of the component on the service - typically this assigns the sharedID of the collectionNode
used by the component.
| SharedCollection | ||
| Method | Defined by | ||
|---|---|---|---|
|
SharedCollection(p_list:IList = null)
The SharedCollection constructor
| SharedCollection | ||
|
addItem(p_item:Object):void
Adds the specified item to the end of the list.
| SharedCollection | ||
|
close():void
Disposes all listeners to the network and framework classes.
| SharedCollection | ||
|
removeAll():void
Removes all items in the collection.
| SharedCollection | ||
|
removeItemAt(p_index:int):Object
Removes the item at the specified index.
| SharedCollection | ||
|
setItemAt(p_item:Object, p_index:int):Object
Replaces the item at the specified index.
| SharedCollection | ||
|
setNodeConfiguration(p_nodeConfig:NodeConfiguration):void
Sets the Node Configuration
| SharedCollection | ||
|
subscribe():void
Tells the component to begin synchronizing with the service.
| SharedCollection | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when the ICollectionView has been updated in some way. | SharedCollection | |||
| Dispatched when the SharedCollection goes in and out of sync with the service | SharedCollection | |||
| collectionNode | property |
public var collectionNode:CollectionNodeSpecifies an existing collectionNode to use in case a developer wishes to supply their own, and avoid having the sharedCollection create a new one.
| connectSession | property |
connectSession:IConnectSession [read-write]
The IConnectSession with which this component is associated. Note that this may only be set once before subscribe
is called; re-sessioning of components is not supported. Defaults to the first IConnectSession created in the application.
public function get connectSession():IConnectSession
public function set connectSession(value:IConnectSession):void
| idField | property |
public var idField:StringIf each item doesn't implement IUID, specifies a field within the item to use as a unique ID.
| isSynchronized | property |
isSynchronized:Boolean [read-only]Returns whether or not the sharedCollection has retrieved any information previously stored on the service, and is currently connected to the service.
This property can be used as the source for data binding.
Implementation public function get isSynchronized():Boolean
| itemClass | property |
public var itemClass:ClassSpecifies the class to use in deserializing any items which arrive from the service.
| nodeName | property |
nodeName:String [read-write]Sets the Node name for the node being create
Implementation public function get nodeName():String
public function set nodeName(value:String):void
| sharedID | property |
sharedID:String [read-write]
Defines the logical location of the component on the service - typically this assigns the sharedID of the collectionNode
used by the component. sharedIDs should be unique within a room (if they're expressing 2 unique locations). Note that
this can only be assigned once (before subscribe() is called). For components with an id property,
sharedID defaults to that value.
public function get sharedID():String
public function set sharedID(value:String):void
| SharedCollection | () | constructor |
public function SharedCollection(p_list:IList = null)The SharedCollection constructor
Parametersp_list:IList (default = null) — The IList this SharedCollection is meant to wrap.
|
| addItem | () | method |
public override function addItem(p_item:Object):voidAdds the specified item to the end of the list.
Parametersp_item:Object — The item to add.
|
| close | () | method |
public function close():voidDisposes all listeners to the network and framework classes. Recommended for proper garbage collection of the component.
| removeAll | () | method |
public override function removeAll():voidRemoves all items in the collection.
| removeItemAt | () | method |
public override function removeItemAt(p_index:int):ObjectRemoves the item at the specified index.
Parametersp_index:int — The index of the item to remove. Note that this index is local-only; on remote collections, it's the
unique id of the item which is used to locate and remove the item.
|
Object — The item preivously at this location.
|
| setItemAt | () | method |
public override function setItemAt(p_item:Object, p_index:int):ObjectReplaces the item at the specified index.
Parametersp_item:Object — new item to set.
|
|
p_index:int — index of the item to replace. Note that this index is local-only; on remote collections, it's the unique id
of the item which is used to locate and replace the item.
|
Object — The item previously at this location.
|
| setNodeConfiguration | () | method |
public function setNodeConfiguration(p_nodeConfig:NodeConfiguration):voidSets the Node Configuration
Parametersp_nodeConfig:NodeConfiguration — The Node Configuration
|
| subscribe | () | method |
public function subscribe():voidTells the component to begin synchronizing with the service. For "headless" components such as this one, this method must be called explicitly.
| collectionChange | event |
mx.events.CollectionEvent
Dispatched when the ICollectionView has been updated in some way.
| synchronizationChange | event |
com.adobe.rtc.events.CollectionNodeEvent
Dispatched when the SharedCollection goes in and out of sync with the service
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/labs/acrobatcom/com/adobe/rtc/sharedModel/SharedCollection.html