| Package | vegas.models.maps |
| Class | public class IndexedMapModelObject |
| Inheritance | IndexedMapModelObject MapModelObject CoreModelObject CoreModel CoreEventDispatcher Object |
index (int) property.
| Property | Defined By | ||
|---|---|---|---|
![]() | channel : String [read-only]
Indicates the channel of this dispatcher if this instance is global. | CoreEventDispatcher | |
![]() | id : *
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 | ||
![]() | security : Boolean = true
This property defined if the setCurrentVO method can accept the same vo in argument as the current one. | CoreModelObject | |
| Method | Defined By | ||
|---|---|---|---|
IndexedMapModelObject(global:Boolean = true, channel:String = null, id:* = null)
Creates a new IndexedMapModelObject instance. | IndexedMapModelObject | ||
![]() | 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 | |
![]() | addVO(vo:ValueObject):void
Inserts a value object in the model. | MapModelObject | |
clear():void [override]
Clear the model. | IndexedMapModelObject | ||
![]() | contains(vo:ValueObject):Boolean
Returns true if the model contains the specified ValueObject. | MapModelObject | |
![]() | containsByID(id:*):Boolean
Returns true if the model contains the specified id key in argument. | MapModelObject | |
![]() | containsByProperty(propName:String, value:*):Boolean
Returns true if the model contains the specified attribute value. | MapModelObject | |
![]() |
Returns and creates a new empty ModelObjectEvent. | CoreModelObject | |
![]() | 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 | ||
![]() |
Returns the current ValueObject selected in this model. | CoreModelObject | |
![]() |
Returns the internal system.events.EventDispatcher reference. | CoreEventDispatcher | |
![]() | getEventTypeADD():String
Returns the event name use in the addVO method. | MapModelObject | |
![]() | getEventTypeBEFORE_CHANGE():String
Returns the event name use in the setCurrentVO method before is changed. | CoreModelObject | |
![]() | getEventTypeCHANGE():String
Returns the event name use in the setVO method. | CoreModelObject | |
![]() | getEventTypeCLEAR():String
Returns the event name use in the clear method. | CoreModelObject | |
![]() | getEventTypeREMOVE():String
Returns the event name use in the removeVO method. | MapModelObject | |
![]() | getEventTypeUPDATE():String
Returns the event name use in the updateVO method. | MapModelObject | |
![]() |
Returns the internal map of this model. | MapModelObject | |
![]() | getVO(id:*):ValueObject
Returns the ValueObject defined by the id passed in argument. | MapModelObject | |
![]() | getVOByProperty(propName:String, value:*):ValueObject
Returns a ValueObject if the model contains a ValueObject with the specified member. | MapModelObject | |
![]() | hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | CoreEventDispatcher | |
![]() | initEventType():void [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 | ||
![]() | isEmpty():Boolean
Returns true if the model is empty. | MapModelObject | |
![]() | isGlobal():Boolean
Indicates if the dispatcher use a global event flow. | CoreEventDispatcher | |
![]() | isLocked():Boolean
Returns true if the object is locked. | CoreEventDispatcher | |
![]() |
Returns the iterator of this model. | MapModelObject | |
![]() | lock():void
Locks the object. | CoreEventDispatcher | |
![]() | notifyAdd(vo:ValueObject):void
Notify a ModelObjectEvent when a ValueObject is inserted in the model. | MapModelObject | |
![]() | notifyBeforeChange(vo:ValueObject):void
Notify a ModelObjectEvent before the current ValueObject selected in the model is changed. | CoreModelObject | |
![]() | notifyChange(vo:ValueObject):void
Notify a ModelObjectEvent when a ValueObject change in the model. | CoreModelObject | |
![]() | notifyClear():void
Notify a ModelObjectEvent when the model is cleared. | CoreModelObject | |
![]() | notifyRemove(vo:ValueObject):void
Notify a ModelObjectEvent when a ValueObject is removed in the model. | MapModelObject | |
![]() | notifyUpdate(vo:ValueObject):void
Notify a ModelObjectEvent when a ValueObject is updated in the model. | MapModelObject | |
![]() | 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 | |
![]() | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object. | CoreEventDispatcher | |
removeVO(vo:ValueObject):void [override]
Removes a value object in the model. | IndexedMapModelObject | ||
![]() | run(... arguments):void
Run the first process with this model. | CoreModel | |
setCurrentVO(vo:ValueObject):void [override]
Sets the current ValueObject selected in this model. | IndexedMapModelObject | ||
![]() | setEventDispatcher(dispatcher:EventDispatcher):void
Sets the internal EventDispatcher reference. | CoreEventDispatcher | |
![]() | setEventTypeADD(type:String):void
Sets the event name use in the addVO method. | MapModelObject | |
![]() | setEventTypeBEFORE_CHANGE(type:String):void
Returns the event name use in the setCurrentVO method before is changed. | CoreModelObject | |
![]() | setEventTypeCHANGE(type:String):void
Returns the event name use in the setVO method. | CoreModelObject | |
![]() | setEventTypeCLEAR(type:String):void
Returns the event name use in the clear method. | CoreModelObject | |
![]() | setEventTypeREMOVE(type:String):void
Sets the event name use in the removeVO method. | MapModelObject | |
![]() | setEventTypeUPDATE(type:String):void
Sets the event name use in the addVO method. | MapModelObject | |
![]() | 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 | |
![]() |
Sets the internal map of this model. | MapModelObject | |
![]() | size():Number
Returns the number of ValueObject in this model. | MapModelObject | |
![]() | supports(value:*):Boolean
Returns true if the IValidator object validate the value. | CoreModelObject | |
![]() | unlock():void
Unlocks the display. | CoreEventDispatcher | |
![]() | unregisterEventListener(type:String, listener:*, useCapture:Boolean = false):void
Removes a listener (Function or EventListener object) from the EventDispatcher object. | CoreEventDispatcher | |
![]() | updateVO(vo:ValueObject):void
Update a value object in the model. | MapModelObject | |
![]() | validate(value:*):void
Evaluates the specified value and throw a TypeError object if the value is not valid. | CoreModelObject | |
![]() | 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 | |
| index | property |
index:intIndicates the current index of the current selected value object in the model.
public function get index():int public function set index(value:int):void| looping | property |
public var looping:BooleanIndicates if index attribute loop when this value is out of the range (between 0 and the size()-1).
| IndexedMapModelObject | () | Constructor |
public function IndexedMapModelObject(global:Boolean = true, channel:String = null, id:* = null)Creates a new IndexedMapModelObject instance.
Parametersglobal: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.
|
| clear | () | method |
override public function clear():voidClear the model.
| getAt | () | method |
public function getAt(index:uint):ValueObjectReturns 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 |
ValueObject — the ValueObject registerd in the model at the specified numeric index (int).
|
| initializeMap | () | method |
override public function initializeMap():MapInitialize the internal Map instance in the constructor of the class.
ReturnsMap |
| removeVO | () | method |
override public function removeVO(vo:ValueObject):voidRemoves 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 |
ArgumentError — If the passed-in ValueObject parameter is not register in the model.
|
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 ;
}
}
}
}
}