Packagecom.adobe.rtc.pods.simpleChatClasses
Classpublic class SimpleChatModel
InheritanceSimpleChatModel Inheritance flash.events.EventDispatcher
ImplementsISessionSubscriber

SimpleChatModel is a model component which drives the SimpleChat pod. Its job is to keep the shared state of the chat pod synchronized across multiple users using an internal CollectionNode. It exposes methods for manipulating that shared model as well as events indicating when that model changes. In general, user with the viewer role and higher can both add new messages and view those messages.

See also

com.adobe.rtc.pods.SimpleChat
com.adobe.rtc.pods.simpleChatClasses.ChatMessageDescriptor
com.adobe.rtc.sharedModel.CollectionNode


Public Properties
 PropertyDefined by
  accessModel : int
The role value required for accessing the chat history
SimpleChatModel
  allowPrivateChat : Boolean
Specifies whether private chat is allowed.
SimpleChatModel
  connectSession : IConnectSession
The IConnectSession with which this component is associated.
SimpleChatModel
  history : String
[read-only] Returns the current history of chat messages as a string.
SimpleChatModel
  isSynchronized : Boolean
[read-only] Determines whether the Model is connected and fully synchronized with the service.
SimpleChatModel
  nameColor : Number = 0x000000
The default color used in formatting messages for the user's name
SimpleChatModel
  publishModel : int
The role value required for publishing to the chat
SimpleChatModel
  sharedID : String
Defines the logical location of the component on the service - typically this assigns the sharedID of the collectionNode used by the component.
SimpleChatModel
  timeFormat : String
Specifies the format of timestamps (see the constants on this class).
SimpleChatModel
  timeStampColor : Number = 0x999999
The default color used in formatting messages for the timestamp
SimpleChatModel
  usersTyping : String
[read-only] Returns a list of currently typing users as a string.
SimpleChatModel
  useTimeStamps : Boolean
Specifies whether or not to display timestamps next to each message.
SimpleChatModel
Public Methods
 MethodDefined by
  
SimpleChatModel(p_isClearAfterSessionRemoved:Boolean = false)
Constructor.
SimpleChatModel
  
clear():void
Clears all chat history.
SimpleChatModel
  
close():void
Disposes all listeners to the network and framework classes.
SimpleChatModel
  
Formats a given MessageDescriptor into a readable string
SimpleChatModel
  
Gets the NodeConfiguration on a specific node in the ChatModel.
SimpleChatModel
  
getUserRole(p_userID:String):int
Returns the role of a given user for the chat.
SimpleChatModel
  
iAmTyping():void
Returns whether or not the current user is typing.
SimpleChatModel
  
Sends a message which is specified by the ChatMessageDescriptor.
SimpleChatModel
  
setNodeConfiguration(p_nodeName:String, p_nodeConfiguration:NodeConfiguration):void
Sets the NodeConfiguration on a already defined node in chatModel.
SimpleChatModel
  
setUserRole(p_userID:String, p_userRole:int, p_nodeName:String = null):void
Sets the role of a given user for the chat.
SimpleChatModel
  
subscribe():void
Tells the component to begin synchronizing with the service.
SimpleChatModel
Events
 EventSummaryDefined by
   Dispatched when private chat is turned on or off.SimpleChatModel
   Dispatched when the message history changes; for example, when there is a new message or the messages are cleared.SimpleChatModel
   Dispatched when the NoteModel has fully connected and synchronized with the service or when it loses that connection.SimpleChatModel
   Dispatched when the timestamp time format changes.SimpleChatModel
   Dispatched when the list of currently typing users is updated.SimpleChatModel
   Dispatched when timestamps are turned on or off.SimpleChatModel
Public Constants
 ConstantDefined by
  TIMEFORMAT_24H : String = "24h"
[static] Constant for setting the time format of timestamps to 24 hour mode.
SimpleChatModel
  TIMEFORMAT_AM_PM : String = "ampm"
[static] Constant for setting the time format of timestamps to AM/PM mode.
SimpleChatModel
Property detail
accessModelproperty
accessModel:int  [read-write]

The role value required for accessing the chat history

Implementation
    public function get accessModel():int
    public function set accessModel(value:int):void
allowPrivateChatproperty 
allowPrivateChat:Boolean  [read-write]

Specifies whether private chat is allowed. Note that only users with the owner role can configure this setting.

Implementation
    public function get allowPrivateChat():Boolean
    public function set allowPrivateChat(value:Boolean):void
connectSessionproperty 
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.

Implementation
    public function get connectSession():IConnectSession
    public function set connectSession(value:IConnectSession):void
historyproperty 
history:String  [read-only]

Returns the current history of chat messages as a string.

This property can be used as the source for data binding.

Implementation
    public function get history():String
isSynchronizedproperty 
isSynchronized:Boolean  [read-only]

Determines whether the Model is connected and fully synchronized with the service.

This property can be used as the source for data binding.

Implementation
    public function get isSynchronized():Boolean
nameColorproperty 
public var nameColor:Number = 0x000000

The default color used in formatting messages for the user's name

publishModelproperty 
publishModel:int  [read-write]

The role value required for publishing to the chat

Implementation
    public function get publishModel():int
    public function set publishModel(value:int):void
sharedIDproperty 
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.

Implementation
    public function get sharedID():String
    public function set sharedID(value:String):void
timeFormatproperty 
timeFormat:String  [read-write]

Specifies the format of timestamps (see the constants on this class). Note that only a user with a publisher role or higher can change this setting.

Implementation
    public function get timeFormat():String
    public function set timeFormat(value:String):void
timeStampColorproperty 
public var timeStampColor:Number = 0x999999

The default color used in formatting messages for the timestamp

usersTypingproperty 
usersTyping:String  [read-only]

Returns a list of currently typing users as a string.

Implementation
    public function get usersTyping():String
useTimeStampsproperty 
useTimeStamps:Boolean  [read-write]

Specifies whether or not to display timestamps next to each message. Only users with a publisher role or higher can configure this setting.

Implementation
    public function get useTimeStamps():Boolean
    public function set useTimeStamps(value:Boolean):void
Constructor detail
SimpleChatModel()constructor
public function SimpleChatModel(p_isClearAfterSessionRemoved:Boolean = false)

Constructor.

Parameters
p_isClearAfterSessionRemoved:Boolean (default = false)
Method detail
clear()method
public function clear():void

Clears all chat history. Note that only a user with role UserRoles.OWNER may clear the chat

close()method 
public function close():void

Disposes all listeners to the network and framework classes. Recommended for proper garbage collection of the component.

formatMessageDescriptor()method 
public function formatMessageDescriptor(p_msgDesc:ChatMessageDescriptor):String

Formats a given MessageDescriptor into a readable string

Parameters
p_msgDesc:ChatMessageDescriptor — the desired ChatMessageDescriptor to format

Returns
String
getNodeConfiguration()method 
public function getNodeConfiguration(p_nodeName:String):NodeConfiguration

Gets the NodeConfiguration on a specific node in the ChatModel. If the node is not defined, it will return null

Parameters
p_nodeName:String — The name of the node.

Returns
NodeConfiguration
getUserRole()method 
public function getUserRole(p_userID:String):int

Returns the role of a given user for the chat.

Parameters
p_userID:String — UserID of the user in question

Returns
int
iAmTyping()method 
public function iAmTyping():void

Returns whether or not the current user is typing.

sendMessage()method 
public function sendMessage(p_msgDesc:ChatMessageDescriptor):void

Sends a message which is specified by the ChatMessageDescriptor.

Parameters
p_msgDesc:ChatMessageDescriptor — the message to send
setNodeConfiguration()method 
public function setNodeConfiguration(p_nodeName:String, p_nodeConfiguration:NodeConfiguration):void

Sets the NodeConfiguration on a already defined node in chatModel. If the node is not defined, it will not do anything.

Parameters
p_nodeName:String — The node Configuration on a node in the NodeConfiguration.
 
p_nodeConfiguration:NodeConfiguration — The name of the node.
setUserRole()method 
public function setUserRole(p_userID:String, p_userRole:int, p_nodeName:String = null):void

Sets the role of a given user for the chat.

Parameters
p_userID:String — UserID of the user whose role we are setting
 
p_userRole:int — Role value we are setting
 
p_nodeName:String (default = null)
subscribe()method 
public function subscribe():void

Tells the component to begin synchronizing with the service. For "headless" components such as this one, this method must be called explicitly.

Event detail
allowPrivateChatChangeevent 
Event object type: com.adobe.rtc.events.ChatEvent

Dispatched when private chat is turned on or off.

historyChangeevent  
Event object type: com.adobe.rtc.events.ChatEvent

Dispatched when the message history changes; for example, when there is a new message or the messages are cleared.

synchronizationChangeevent  
Event object type: com.adobe.rtc.events.CollectionNodeEvent

Dispatched when the NoteModel has fully connected and synchronized with the service or when it loses that connection.

timeFormatChangeevent  
Event object type: com.adobe.rtc.events.ChatEvent

Dispatched when the timestamp time format changes.

typingListUpdateevent  
Event object type: com.adobe.rtc.events.ChatEvent

Dispatched when the list of currently typing users is updated.

useTimeStampsChangeevent  
Event object type: com.adobe.rtc.events.ChatEvent

Dispatched when timestamps are turned on or off.

Constant detail
TIMEFORMAT_24Hconstant
public static const TIMEFORMAT_24H:String = "24h"

Constant for setting the time format of timestamps to 24 hour mode.

TIMEFORMAT_AM_PMconstant 
public static const TIMEFORMAT_AM_PM:String = "ampm"

Constant for setting the time format of timestamps to AM/PM mode.





 

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/pods/simpleChatClasses/SimpleChatModel.html