com.adobe.icc.editors.model

# TextModel - AS3 Asset Composer

Package | com.adobe.icc.editors.model
Class | public class TextModel
Inheritance | TextModel ModuleModel AssetModel EventDispatcher Object

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

The `TextModel` class represents the domain object for the assets of type Text. Domain objects can be leveraged to build presentation on top of them. They ease the process of coding views by abstracting all the service calls and maintaining meaningful states.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | activeEndDate : Date The activeEndDate of the underlying value object. | AssetModel
|  | activeStartDate : Date The activeStartDate date of the underlying value object. | AssetModel
|  | category : Category The Category of the underlying value object. | AssetModel
|  | comment : String The comment of the underlying value object. | AssetModel
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | crxVersion : String The crx version of the underlying value object. | AssetModel
|  | dataDictionary : DataDictionary The typed DataDictionary object being used by this module. | ModuleModel
|  | dataDictionaryName : String The name of the data dictionary being used by this module. | ModuleModel
|  | description : String The description of the underlying value object. | AssetModel
|  | editorData : EditorResult Represents that data held by the Rich Text Editor. | TextModel
|  | extendedProperties : Object The extended properties of the underlying value object. | AssetModel
|  | id : String The GUID of the underlying value object. | AssetModel
|  | isDDReferenced : Boolean Indicates whether the data dictionary defined for this text has been referred in any of the assignments. | TextModel
|  | isNew : Boolean Indicates if this Asset is new. | AssetModel
|  | lastChangeBy : String The lastChangeBy property of the underlying value object. | AssetModel
|  | name : String The name of the underlying value object. | AssetModel
|  | service : IModuleService [static] The module service instance that is used for saving/retrieving the module on the server. | TextModel
|  | shallow : Boolean Flag to indicate if the underlying value object is shallow. | ModuleModel
|  | state : int The state of the underlying value object. | AssetModel
|  | subCategory : Category The Sub-Category of the underlying value object. | AssetModel
|  | variables : IList [read-only] The variables defined within this module. | ModuleModel
|  | version : int The version of the underlying value object. | AssetModel
|  | vo : * The value object which this asset domain object is built atop. | AssetModel

Protected Properties
Hide Inherited Protected Properties
Show Inherited Protected Properties

| Property | Defined By
--- | --- | ---
|  | isCopy : Boolean Indicates that the object is a copy of an existing Asset. | AssetModel
|  | oldId : String Id of the Asset which was cloned to create this copy. | AssetModel
|  | preferencesManager : PreferencesManager To manage user preferences for category, subcategory and data dictionary. | AssetModel

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | EventDispatcher
|  | copy():com.adobe.icc.editors.model:TextModel Creates a copy of the domain object. | TextModel
|  | createFromId(moduleId:String):ModuleModel [static] Fetches a module by the given id and constructs the domain module object on top of it. | ModuleModel
|  | createFromVO(textVO:com.adobe.consulting.pst.vo:TBX, fetchFromServer:Boolean = true):com.adobe.icc.editors.model:TextModel [static] Creates the domain object from the corresponding value object. | TextModel
|  | dispatchEvent(event:Event):Boolean Dispatches an event into the event flow. | EventDispatcher
|  | fetchComplete():void [override] Fetches the complete value object via remoting call. | TextModel
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | EventDispatcher
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | isShallow():Boolean Indicates if the underlying value object is shallow. | ModuleModel
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | EventDispatcher
|  | save():void [override] Saves the underlying value object on the server. | TextModel
|  | setDataDictionaryName(ddName:String, fetchDataDictionary:Boolean = true):void Sets the data dictionary name to the one specified and also fetches the corresponding DataDictionary object from the server. | ModuleModel
|  | setDataDictRegistryService(value:DataDictionaryRegistryService):void [static] This method lets you inject a custom implementation of the infrastructure data dictionary service. | ModuleModel
|  | setModuleService(value:IModuleService):void [static] This method lets you inject a custom implementation of the infrastructure module service. | TextModel
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | validate():void Runs the client validations and raises events of the type AssetValidationEvent for notifying validation result. | ModuleModel
|  | valueOf():Object Returns the primitive value of the specified object. | Object
|  | willTrigger(type:String):Boolean Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | EventDispatcher

Protected Methods
Hide Inherited Protected Methods
Show Inherited Protected Methods

| Method | Defined By
--- | --- | ---
|  | fetchDataDictionary():void Fetches the data dictionary corresponding to the name specified. | ModuleModel

Events
Click for more information on events
Hide Inherited Events
Show Inherited Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | activate | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher
|  | deactivate | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher
|  | fetchComplete | Dispatched when this Asset is completely fetched from the server. | TextModel
|  | saveComplete | Dispatched when the text is successfully saved. | TextModel
|  | saveFault | Dispatched when a fault occurs while saving the text. | TextModel
|  | saving | Dispatched when the current text is requested for save. | TextModel

Property Detail

### editorData

property

`editorData:EditorResult`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Represents that data held by the Rich Text Editor.

This property can be used as the source for data binding. When this property is modified, it dispatches the `editorDataChange` event.

Implementation
`public function get editorData():EditorResult`
`public function set editorData(value:EditorResult):void`

### isDDReferenced

property

`isDDReferenced:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Indicates whether the data dictionary defined for this text has been referred in any of the assignments.

This property can be used as the source for data binding. When this property is modified, it dispatches the `isDDReferencedChange` event.

Implementation
`public function get isDDReferenced():Boolean`
`public function set isDDReferenced(value:Boolean):void`

### service

property

`public static var service:IModuleService`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

The module service instance that is used for saving/retrieving the module on the server. This service is internally invoked by this class for performing CRUD operations.

Method Detail

### copy

()
method

`public function copy():com.adobe.icc.editors.model:TextModel`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Creates a copy of the domain object.

Note that this is different than cloning via ObjectUtil.copy() since a "copied" object needs to be saved via a specific server api.

Returns

| `com.adobe.icc.editors.model:TextModel` — A copy of current domain object.

### createFromVO

()
method

`public static function createFromVO(textVO:com.adobe.consulting.pst.vo:TBX, fetchFromServer:Boolean = true):com.adobe.icc.editors.model:TextModel`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Creates the domain object from the corresponding value object.

Value Objects are pure data entities mostly acting as parameters to the server apis. Domain objects are build atop to provide more meaningful business data and behavior thereby enabling faster and convenient UI view development. In some cases, the value objects could be shallow; for instance when obtained via Data Services. The complete value object could be requested by passing the `fetchFromServer` flag as true. In that case, the value object is obtained from the server via remoting call and the domain object shapes accordingly as the server response arrives.

Parameters

| `textVO:com.adobe.consulting.pst.vo:TBX` — The value object of the type TBX
| `fetchFromServer:Boolean` (default = `true`)`` — Flag to indicate if the complete value object should be obtained from the server

Returns

| `com.adobe.icc.editors.model:TextModel` — The Text domain object corresponding the passed Text value object.

### fetchComplete

()
method

`override public function fetchComplete():void`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Fetches the complete value object via remoting call. This should be called when the underlying value object is shallow.

### save

()
method

`override public function save():void`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Saves the underlying value object on the server.

Under the hood, separate calls are required for creating a new asset and copying or copying an existing one.

The save() method internally invokes the relevant server calls on the basis of its current state. The domain object constructed from the `createFromVO()` method would invoke the "update" api, the domain object starightaway instantiated on the client would inoke the "create" module api and the domain object obtained by the `copy()` method would internally call "copy api".

Invoking the `save()` implicitly invokes the `validate()` method to perform the necessary client side validations. Only when the client side validations are successful, is the actual save() call made. A save() method wouldn't proceed past the validation stage unless the object's state is made valid via user input or otherwise.

### setModuleService

()
method

`public static function setModuleService(value:IModuleService):void`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

This method lets you inject a custom implementation of the infrastructure module service. By default, the class `ModuleServiceDelegate` is used as the infrastructure service.

Parameters

| `value:IModuleService` — An implementation for IModuleService.

Event Detail

### fetchComplete

Event

Event Object Type: `flash.events.Event`
property Event.type = `flash.events.Event`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Dispatched when this Asset is completely fetched from the server. Assets are often kept shallow in the Asset Manager and fetched completely only when necessary. The fetchComplete event is dispatched when the Asset has been retrieved completely from the server.

### saveComplete

Event

Event Object Type: `com.adobe.icc.editors.events.AssetEvent`
property AssetEvent.type = `com.adobe.icc.editors.events.AssetEvent.SAVE_COMPLETE`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Dispatched when the text is successfully saved.

The `AssetEvent.SAVE_COMPLETE` constant defines the value of the `type` property of the event object for a `saveComplete` event.

The `saveComplete` event is dispatched when the domain object has been successfully saved on the server. Unlike the `saving` event, this is dispatched in an aysnchronous manner only after the server has responded with a result for the save api call.

This event can be used to stop UI animations indicating "save in progress" or to popup an info box indicating save success.

### saveFault

Event

Event Object Type: `com.adobe.icc.editors.events.AssetEvent`
property AssetEvent.type = `com.adobe.icc.editors.events.AssetEvent.SAVE_FAULT`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Dispatched when a fault occurs while saving the text.

The `AssetEvent.SAVE_FAULT` constant defines the value of the `type` property of the event object for a `saveFault` event.

The `saveFault` event is dispatched when the server reports an error while saving the asset on the server. Unlike the `saving` event, this is dispatched in an aysnchronous manner only after the server has responded with a result for the save api call.

When this event is dispatched, the `fault` property contains the fault object encapsulating the error sent by the server. The `fault` property can be used to determine the faultCode and show an error message accordingly.

This event can be used to stop UI animations indicating "save in progress" or to popup an info box indicating save success.

### saving

Event

Event Object Type: `com.adobe.icc.editors.events.AssetEvent`
property AssetEvent.type = `com.adobe.icc.editors.events.AssetEvent.SAVING`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

Runtime Versions: | AIR (unsupported), Flash Player 9, Flash Player 10

Dispatched when the current text is requested for save. This event, being bubbling in nature, can be leveraged by the UI to display a progress bar or animation to indicate the save progress.

The `AssetEvent.SAVING` constant defines the value of the `type` property of the event object for a `saving` event.

The `saving` event is dispatched when the save() method has been called on the domain object. This event is dispatched before any server api is invoked but after the domain client validations are complete. This is because the actual save starts once the client validations are complete.

This event can be used to start a UI animation indicating "save in progress".

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00