com.adobe.icc.editors.model

# CategoryModel - AS3 Asset Composer

Package | com.adobe.icc.editors.model
Class | public class CategoryModel
Inheritance | CategoryModel 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 `CategoryModel` class represents the domain object for the assets of type Category. 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
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | id : String [read-only] The GUID of the underlying value object. | CategoryModel
|  | isNew : Boolean Indicates if this Category is new. | CategoryModel
|  | name : String Name of the category | CategoryModel
|  | type : int Type of the category. | CategoryModel
|  | vo : Category The underlying category value object. | CategoryModel

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
|  | createFromVO(categoryVO:Category):CategoryModel [static] Creates the domain object from the corresponding value object. | CategoryModel
|  | dispatchEvent(event:Event):Boolean Dispatches an event into the event flow. | EventDispatcher
|  | 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
|  | 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 Saves the underlying value object on the server. | CategoryModel
|  | 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
|  | 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

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
|  | saveComplete | Dispatched when the category is successfully saved. | CategoryModel
|  | saveFault | Dispatched when a fault occurs while saving the category. | CategoryModel
|  | saving | Dispatched when the current category is requested for save. | CategoryModel

Property Detail

### id

property

`id:String` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 10

Runtime Versions: | AIR (unsupported), Flash Player 10.2

The GUID of the underlying value object.

Implementation
`public function get id():String`

### isNew

property

`isNew: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 if this Category is new. New Category objects are existent purely on the client side until they are saved.

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

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

### name

property

`name:String`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

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

Name of the category

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

Implementation
`public function get name():String`
`public function set name(value:String):void`

### type

property

`type:int`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

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

Type of the category. The value is amongst the constants defined in the class `CategoryType`

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

Implementation
`public function get type():int`
`public function set type(value:int):void`

Related API Elements

com.adobe.icc.enum.CategoryType

### vo

property

`vo:Category`

Language Version: | ActionScript 3.0

Product Version: | Asset Composer Building Block 9.5

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

The underlying category value object.

Implementation
`public function get vo():Category`
`public function set vo(value:Category):void`
Method Detail

### createFromVO

()
method

`public static function createFromVO(categoryVO:Category):CategoryModel`

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.

Parameters

| `categoryVO:Category` — The value object of the type Category

Returns

| `CategoryModel` — The Category domain object corresponding the passed Category value object.

### save

()
method

`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 and the domain object starightaway instantiated on the client would inoke the "create" module api.

Category is somewhat different when compared to other assets. The category object is a "thin" object and thus isn't ever shallow. Moreover, categories cannot be copied.

Event Detail

### 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 category 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 category.

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 category 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