Packagevegas.models.maps
Classpublic class IndexedMapModelObject
InheritanceIndexedMapModelObject Inheritance MapModelObject Inheritance CoreModelObject Inheritance CoreModel Inheritance CoreEventDispatcher Inheritance Object

This map model is indexed and you can select all value objects register with the basic index (int) property.

View the examples



Public Properties
 PropertyDefined By
 Inheritedchannel : String
[read-only] Indicates the channel of this dispatcher if this instance is global.
CoreEventDispatcher
 Inheritedid : *
Returns the id of this IModelObject.
CoreModel
  index : int
Indicates the current index of the current selected value object in the model.
IndexedMapModelObject
  looping : Boolean
Indicates if index attribute loop when this value is out of the range (between 0 and the size()-1).
IndexedMapModelObject
 Inheritedsecurity : Boolean = true
This property defined if the setCurrentVO method can accept the same vo in argument as the current one.
CoreModelObject
Protected Properties
 PropertyDefined By
 Inherited_map : Map
The internal map of this model.
MapModelObject
 Inherited_sAddType : String
The internal ModelObjectEvent type use in the addVO method.
MapModelObject
 Inherited_sRemoveType : String
The internal ModelObjectEvent type use in the removeVO method.
MapModelObject
 Inherited_sUpdateType : String
The internal ModelObjectEvent type when the update event type is use.
MapModelObject
Public Methods
 MethodDefined By
  
IndexedMapModelObject(global:Boolean = true, channel:String = null, id:* = null)
Creates a new IndexedMapModelObject instance.
IndexedMapModelObject
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = false):void
Allows the registration of event listeners on the event target.
CoreEventDispatcher
 Inherited
Inserts a value object in the model.
MapModelObject
  
clear():void
[override] Clear the model.
IndexedMapModelObject
 Inherited
contains(vo:ValueObject):Boolean
Returns true if the model contains the specified ValueObject.
MapModelObject
 Inherited
containsByID(id:*):Boolean
Returns true if the model contains the specified id key in argument.
MapModelObject
 Inherited
containsByProperty(propName:String, value:*):Boolean
Returns true if the model contains the specified attribute value.
MapModelObject
 Inherited
Returns and creates a new empty ModelObjectEvent.
CoreModelObject
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
CoreEventDispatcher
  
getAt(index:uint):ValueObject
Returns the ValueObject registerd in the model at the specified numeric index (int).
IndexedMapModelObject
 Inherited
Returns the current ValueObject selected in this model.
CoreModelObject
 Inherited
Returns the internal system.events.EventDispatcher reference.
CoreEventDispatcher
 Inherited
Returns the event name use in the addVO method.
MapModelObject
 Inherited
Returns the event name use in the setCurrentVO method before is changed.
CoreModelObject
 Inherited
Returns the event name use in the setVO method.
CoreModelObject
 Inherited
Returns the event name use in the clear method.
CoreModelObject
 Inherited
Returns the event name use in the removeVO method.
MapModelObject
 Inherited
Returns the event name use in the updateVO method.
MapModelObject
 Inherited
Returns the internal map of this model.
MapModelObject
 Inherited
Returns the ValueObject defined by the id passed in argument.
MapModelObject
 Inherited
getVOByProperty(propName:String, value:*):ValueObject
Returns a ValueObject if the model contains a ValueObject with the specified member.
MapModelObject
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
CoreEventDispatcher
 Inherited
[override] This method is invoked in the constructor of the class to initialize all events.
MapModelObject
  
[override] Initialize the internal Map instance in the constructor of the class.
IndexedMapModelObject
 Inherited
isEmpty():Boolean
Returns true if the model is empty.
MapModelObject
 Inherited
isGlobal():Boolean
Indicates if the dispatcher use a global event flow.
CoreEventDispatcher
 Inherited
isLocked():Boolean
Returns true if the object is locked.
CoreEventDispatcher
 Inherited
Returns the iterator of this model.
MapModelObject
 Inherited
lock():void
Locks the object.
CoreEventDispatcher
 Inherited
Notify a ModelObjectEvent when a ValueObject is inserted in the model.
MapModelObject
 Inherited
Notify a ModelObjectEvent before the current ValueObject selected in the model is changed.
CoreModelObject
 Inherited
Notify a ModelObjectEvent when a ValueObject change in the model.
CoreModelObject
 Inherited
Notify a ModelObjectEvent when the model is cleared.
CoreModelObject
 Inherited
Notify a ModelObjectEvent when a ValueObject is removed in the model.
MapModelObject
 Inherited
Notify a ModelObjectEvent when a ValueObject is updated in the model.
MapModelObject
 Inherited
registerEventListener(type:String, listener:*, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Allows the registration of event listeners on the event target (Function or EventListener).
CoreEventDispatcher
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
CoreEventDispatcher
  
[override] Removes a value object in the model.
IndexedMapModelObject
 Inherited
run(... arguments):void
Run the first process with this model.
CoreModel
  
[override] Sets the current ValueObject selected in this model.
IndexedMapModelObject
 Inherited
Sets the internal EventDispatcher reference.
CoreEventDispatcher
 Inherited
setEventTypeADD(type:String):void
Sets the event name use in the addVO method.
MapModelObject
 Inherited
setEventTypeBEFORE_CHANGE(type:String):void
Returns the event name use in the setCurrentVO method before is changed.
CoreModelObject
 Inherited
setEventTypeCHANGE(type:String):void
Returns the event name use in the setVO method.
CoreModelObject
 Inherited
setEventTypeCLEAR(type:String):void
Returns the event name use in the clear method.
CoreModelObject
 Inherited
setEventTypeREMOVE(type:String):void
Sets the event name use in the removeVO method.
MapModelObject
 Inherited
setEventTypeUPDATE(type:String):void
Sets the event name use in the addVO method.
MapModelObject
 Inherited
setGlobal(flag:Boolean = false, channel:String = null):void
Sets if the instance use a global system.events.EventDispatcher to dispatch this events, if the flag value is false the instance use a local EventDispatcher.
CoreEventDispatcher
 Inherited
setMap(m:Map):void
Sets the internal map of this model.
MapModelObject
 Inherited
size():Number
Returns the number of ValueObject in this model.
MapModelObject
 Inherited
supports(value:*):Boolean
Returns true if the IValidator object validate the value.
CoreModelObject
 Inherited
unlock():void
Unlocks the display.
CoreEventDispatcher
 Inherited
unregisterEventListener(type:String, listener:*, useCapture:Boolean = false):void
Removes a listener (Function or EventListener object) from the EventDispatcher object.
CoreEventDispatcher
 Inherited
Update a value object in the model.
MapModelObject
 Inherited
validate(value:*):void
Evaluates the specified value and throw a TypeError object if the value is not valid.
CoreModelObject
 Inherited
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.
CoreEventDispatcher
Protected Methods
 MethodDefined By
 Inherited
Creates and returns the internal EventDispatcher reference (this method is invoked in the constructor).
CoreEventDispatcher
Property Detail
indexproperty
index:int

Indicates the current index of the current selected value object in the model.


Implementation
    public function get index():int
    public function set index(value:int):void
loopingproperty 
public var looping:Boolean

Indicates if index attribute loop when this value is out of the range (between 0 and the size()-1).

Constructor Detail
IndexedMapModelObject()Constructor
public function IndexedMapModelObject(global:Boolean = true, channel:String = null, id:* = null)

Creates a new IndexedMapModelObject instance.

Parameters
global:Boolean (default = true) — the flag to use a global event flow or a local event flow (default true).
 
channel:String (default = null) — (optional) the name of the global event flow if the global argument is true.
 
id:* (default = null) — the id of this model.
Method Detail
clear()method
override public function clear():void

Clear the model.

getAt()method 
public function getAt(index:uint):ValueObject

Returns the ValueObject registerd in the model at the specified numeric index (int).

Example :

         import vegas.models.maps.IndexedMapModelObject;
         import vegas.vo.FilterVO;
         
         var model:IndexedMapModelObject = new IndexedMapModelObject() ;
          
         for (var i:int ; i < 4 ; i++ ) 
         {
             model.addVO( new FilterVO( { id : i , filter : i << 1 } ) ) ;
         }
         
         trace( "model.getAt(1) : " + model.getAt(1) ) ; // model.getAt(1) : [FilterVO:2]
         trace( "model.getAt(9) : " + model.getAt(9) ) ; // model.getAt(9) : null
         

Parameters

index:uint

Returns
ValueObject — the ValueObject registerd in the model at the specified numeric index (int).
initializeMap()method 
override public function initializeMap():Map

Initialize the internal Map instance in the constructor of the class.

Returns
Map
removeVO()method 
override public function removeVO(vo:ValueObject):void

Removes a value object in the model.

Parameters

vo:ValueObject

setCurrentVO()method 
override public function setCurrentVO(vo:ValueObject):void

Sets the current ValueObject selected in this model.

Parameters

vo:ValueObject


Throws
ArgumentError — If the passed-in ValueObject parameter is not register in the model.
Examples
Example
     
     package examples
     {
         import vegas.events.ModelObjectEvent;
         import vegas.models.maps.IndexedMapModelObject;
         import vegas.vo.FilterVO;
         
         import flash.display.Sprite;
         import flash.events.KeyboardEvent;
         import flash.ui.Keyboard;
         
         public class IndexedMapModelObjectExample extends Sprite 
         {
             public function IndexedMapModelObjectExample()
             {
                 model = new IndexedMapModelObject() ;
                 
                 model.addEventListener( ModelObjectEvent.ADD_VO    , debug ) ;
                 model.addEventListener( ModelObjectEvent.CHANGE_VO , debug ) ;
                 
                 var count:uint = 4 ;
                 
                 for (var i:int ; i < count ; i++ ) 
                 {
                     model.addVO( new FilterVO( { id : i , filter : i << 1 } ) ) ;
                 }
                 
                 model.index = 0 ;
                 
                 stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
             }
             
             public var model:IndexedMapModelObject ;
             
             public function debug( e:ModelObjectEvent ):void
             {
                 trace( "type:" + e.type + " vo:" + e.getVO() + " index:" + model.index ) ;
             }
             
             public function keyDown( e:KeyboardEvent ):void
             {
                 var code:uint = e.keyCode ;
                 switch( code )
                 {
                     case Keyboard.LEFT :
                     {
                         model.index -- ;
                         break ;
                     }
                     case Keyboard.RIGHT :
                     {
                         model.index ++ ;
                         break ;
                     }
                 }
             }
         }
     }